https://pulumi.com logo
#kubernetes
Title
# kubernetes
p

purple-plumber-90981

06/02/2021, 1:06 AM
while we are talking about aws=load-balancer-controller . . . when i deploy this manually with helm into my eks there is no problem, when i do so with pulumi :-
Copy code
File "/Users/bmeehan/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi_kubernetes/apiextensions/v1/CustomResourceDefinition.py", line 121, in __init__
        __self__._internal_init(resource_name, *args, **kwargs)
    TypeError: _internal_init() got an unexpected keyword argument 'status'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
details in thread, help please
so manually :-
Copy code
10:54:34 bmeehan@_C02WD05DHTDG:~/repos/itplat-pulumi-infrastructure$ helm install aws-load-balancer-controller eks/aws-load-balancer-controller --set clusterName=itplat-eks-cluster -n kube-system

NAME: aws-load-balancer-controller
LAST DEPLOYED: Wed Jun  2 10:55:14 2021
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
AWS Load Balancer controller installed!
10:55:33 bmeehan@_C02WD05DHTDG:~/repos/itplat-pulumi-infrastructure$ helm list -n kube-system

NAME                        	NAMESPACE  	REVISION	UPDATED                              	STATUS  	CHART                             	APP VERSION
aws-load-balancer-controller	kube-system	1       	2021-06-02 10:55:14.608507 +1000 AEST	deployed	aws-load-balancer-controller-1.2.0	v2.2.0
10:55:46 bmeehan@_C02WD05DHTDG:~/repos/itplat-pulumi-infrastructure$ helm uninstall aws-load-balancer-controller -n kube-system


release "aws-load-balancer-controller" uninstalled
no problems
using this code :-
Copy code
# # setup aws-load-balancer-controller (ALB) via helm
    k8s_h_alb_controller = k8s.helm.v3.Chart(
        "itplat-helm-alb-controller",
        k8s.helm.v3.ChartOpts(
            chart="aws-load-balancer-controller",
            fetch_opts=k8s.helm.v3.FetchOpts(
                repo="<https://aws.github.io/eks-charts>",
            ),
            namespace='kube-system',
            values={
                "clusterName": "itplat-eks-cluster"
            },
        ),
        opts=pulumi.ResourceOptions(depends_on=[eks_cluster], provider=k8s_use1_provider),
    )
error: Program failed with an unhandled exception:
Copy code
File "/Users/bmeehan/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi/output.py", line 384, in gather_futures
        return await asyncio.gather(*value_futures_list)
      File "/Users/bmeehan/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi/output.py", line 116, in get_value
        val = await self._future
      File "/Users/bmeehan/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi/output.py", line 157, in run
        value = await self._future
      File "/Users/bmeehan/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi/output.py", line 178, in run
        transformed: Input[U] = func(value)
      File "/Users/bmeehan/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi_kubernetes/yaml.py", line 519, in <lambda>
        CustomResourceDefinition(f"{x}", opts, **obj)))]
      File "/Users/bmeehan/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi_kubernetes/apiextensions/v1/CustomResourceDefinition.py", line 121, in __init__
        __self__._internal_init(resource_name, *args, **kwargs)
    TypeError: _internal_init() got an unexpected keyword argument 'status'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1
there is no ref to “status” in my code, but i do see it in the crds.yaml in aws helm stuff
trying
Copy code
# for <https://github.com/pulumi/pulumi-kubernetes/issues/800>
    def remove_status(obj, opts):
        if obj["kind"] == "CustomResourceDefinition":
            del obj["status"]

    # setup aws-load-balancer-controller (ALB) via helm
    k8s_h_alb_controller = k8s.helm.v3.Chart(
        "itplat-helm-alb-controller",
        k8s.helm.v3.ChartOpts(
            chart="aws-load-balancer-controller",
            fetch_opts=k8s.helm.v3.FetchOpts(
                repo="<https://aws.github.io/eks-charts>",
            ),
            namespace='kube-system',
            transformations=[remove_status],
            values={
                "clusterName": "itplat-eks-cluster"
            },
        ),
        opts=pulumi.ResourceOptions(depends_on=[eks_cluster], provider=k8s_use1_provider),
    )
gets me
Copy code
AssertionError: Unexpected type. Expected 'dict' got 'typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any], typing.Awaitable[typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any]]], pulumi.output.Output[~T], NoneType]'
anyone got a pythonic example of remote chart transformations ?
we also have a native Pulumi package for this now: https://github.com/jaxxstorm/pulumi-awsloadbalancercontroller
p

purple-plumber-90981

06/02/2021, 3:38 AM
is there some benefit to this over the aws supplied helm chart ?
and thanks @billowy-army-68599 for the example
b

billowy-army-68599

06/02/2021, 3:39 AM
you may run into some problems with the helm chart because hooks don't work, but it's just another option
p

purple-plumber-90981

06/02/2021, 3:41 AM
i used the example which wasnt that different from my code except a try/except block
but still
Copy code
AssertionError: Unexpected type. Expected 'dict' got 'typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any], typing.Awaitable[typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any]]], pulumi.output.Output[~T], NoneType]'
the weird thing is i printed out the type of obj each time remove_status was called and it was always dict
but then i get a type mismatch
confused
my output actually looks like
Copy code
AssertionError: Unexpected type. Expected 'dict' got 'typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any], typing.Awaitable[typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any]]], pulumi.output.Output[~T], NoneType]'
    error: an unhandled error occurred: Program exited with non-zero exit code: 1

     for obj type <class 'dict'> with kind CustomResourceDefinition
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind CustomResourceDefinition
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind ServiceAccount
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind Secret
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind ClusterRole
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind ClusterRoleBinding
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind Role
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind RoleBinding
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind Service
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind Deployment
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind MutatingWebhookConfiguration
    -================-
          -===-
    -================-
     for obj type <class 'dict'> with kind ValidatingWebhookConfiguration
    -================-
          -===-
    -================-
maybe its coming from something else in my chart definition, and im just assuming the transform
the only other change i added apart from transformations was values
Copy code
values={
                "clusterName": "itplat-eks-cluster"
            },
b

billowy-army-68599

06/02/2021, 3:50 AM
wait, which version of the pulumi provider are you using? I'm looking through my commit history and I fixed it here: https://github.com/jaxxstorm/pulumi-nginx-demo/commit/672640952aca9aa01dce424dc7c4d6f92b131b6b#diff-f75c53cb2df03b7e6f91ab0787a57b8ef956b2a6a09483546e53acbe4d88251cR10
p

purple-plumber-90981

06/02/2021, 3:55 AM
you mean the pulumi k8s provider ?
b

billowy-army-68599

06/02/2021, 3:56 AM
no, the pulumi sdk
can you share your
pip list
inside your virtualenv
p

purple-plumber-90981

06/02/2021, 3:57 AM
Copy code
_eks$ ls -lad ~/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi_kubernetes-*
drwxr-xr-x  7 bmeehan  staff  224 22 Apr 14:18 /Users/bmeehan/repos/itplat-pulumi-infrastructure/.venv/lib/python3.8/site-packages/pulumi_kubernetes-3.0.0.dist-info
Copy code
pulumi                       3.3.1
pulumi-aws                   4.6.0
pulumi-eks                   0.30.0
pulumi-kubernetes            3.0.0
updating
hmm i get 3.0.0 as latest
is that incorrect ?
b

billowy-army-68599

06/02/2021, 4:03 AM
can you update to pulumi-kubernetes 3.1.0
p

purple-plumber-90981

06/02/2021, 4:05 AM
done - Successfully installed pulumi-kubernetes-3.1.0
trying
pulumi up
sigh, i forgot to put clusterName value back in
doing it now
same error
Copy code
AssertionError: Unexpected type. Expected 'dict' got 'typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any], typing.Awaitable[typing.Union[pulumi_kubernetes.apiextensions.v1._inputs.JSONSchemaPropsArgs, typing.Sequence[typing.Any]]], pulumi.output.Output[~T], NoneType]'
Copy code
pulumi                       3.3.1
pulumi-aws                   4.6.0
pulumi-eks                   0.30.0
pulumi-kubernetes            3.1.0
b

billowy-army-68599

06/02/2021, 4:13 AM
can you share your
Pulumi.yaml
?
p

purple-plumber-90981

06/02/2021, 4:14 AM
Copy code
14:11:06 bmeehan@_C02WD05DHTDG:~/repos/itplat-pulumi-infrastructure/src/aws_eks$ cat ../../Pulumi.yaml
name: itplat-pulumi-infrastructure
runtime:
  name: python
  options:
    virtualenv: .venv
description: IT Platform Engineering Infrastructure_as_code
14:14:34 bmeehan@_C02WD05DHTDG:~/repos/itplat-pulumi-infrastructure/src/aws_eks$
oh wait
thats the top level one in the repo
i have one just for the eks stuff
Copy code
14:14:34 bmeehan@_C02WD05DHTDG:~/repos/itplat-pulumi-infrastructure/src/aws_eks$ cat Pulumi.yaml
name: aws_eks
runtime:
  name: python
  options:
    virtualenv: ../../.venv
description: ITPlat AWS EKS infrastructure
14:15:19 bmeehan@_C02WD05DHTDG:~/repos/itplat-pulumi-infrastructure/src/aws_eks$
b

billowy-army-68599

06/02/2021, 4:16 AM
and if you do:
Copy code
source ../../.venv/bin/activate
pip3 list
it has the correct deps?
p

purple-plumber-90981

06/02/2021, 4:17 AM
bah
so i use direnv which is supposed to update it from requirements
Copy code
pulumi            3.0.0
pulumi-aws        4.0.0
pulumi-eks        0.30.0
pulumi-kubernetes 3.0.0
looks like its updating global not in my direnv
moment
updated properly now.. trying again pulummi up
looks better, got past preview this time
b

billowy-army-68599

06/02/2021, 4:22 AM
\o/
p

purple-plumber-90981

06/02/2021, 4:26 AM
worked.. awesome thanks @billowy-army-68599…. i will continue along the path towards eks cluster glory now
expect more annoying chatter 😉
🎉 1
4 Views