Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

NoneType' object is not subscriptable error during aws-eks-kubectl-run pipe run

Edited

 

Hi,

I'm trying to apply a yaml file using the aws-eks-kubectl-run pipe but it returns an error.

If I try to apply the yaml file manually it works without any issues

The error is:

✔ Successfully updated the kube config.
Traceback (most recent call last):
File "/pipe.py", line 42, in <module>
pipe.run()
File "/usr/local/lib/python3.7/site-packages/kubectl_run/pipe.py", line 112, in run
self.handle_apply()
File "/usr/local/lib/python3.7/site-packages/kubectl_run/pipe.py", line 77, in handle_apply
self.update_labels_in_metadata(template_file, labels)
File "/usr/local/lib/python3.7/site-packages/kubectl_run/pipe.py", line 31, in update_labels_in_metadata
yaml_doc['metadata'].setdefault('labels', {}).update(labels)
TypeError: 'NoneType' object is not subscriptable

I'm trying to apply the file https://s3.amazonaws.com/spotinst-public/integrations/kubernetes/cluster-controller/spotinst-kubernetes-cluster-controller-ga.yaml.

- wget https://s3.amazonaws.com/spotinst-public/integrations/kubernetes/cluster-controller/spotinst-kubernetes-cluster-controller-ga.yaml
- ls -latrh
- pipe: atlassian/aws-eks-kubectl-run:1.2.4
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: 'eu-west-1'
CLUSTER_NAME: "$name-$environment"
KUBECTL_COMMAND: 'apply'
# KUBECTL_ARGS: '<array>' # Optional
RESOURCE_PATH: "spotinst-kubernetes-cluster-controller-ga.yaml"
# LABELS: '<array>' # Optional
WITH_DEFAULT_LABELS: 'false'
DEBUG: 'true'

 

Changing the 'with_default_labels' to true also doesn't fix the issue.

 

Any idea how to fix this issue? for other yaml files it works without any issues

 

1 answer

1 accepted

2 votes
Answer accepted

Hi @Rutger van Bruggen ,

thank you for your question.

The problem is in "spotinst-kubernetes-cluster-controller-ga.yam" file. It ends with three dashes (---).

According to YAML specs 2.2 Structures:

YAML uses three dashes (---) to separate directives from document content. This also serves to signal the start of a document if no directives are present. Three dots ( ...) indicate the end of a document without starting a new one, for use in communication channels.

during parsing the file pipe's method `update_labels_in_metadata` tries to find all separate documents from provided file, but the latest three dashes (---) declare false start of the new document.

It'd be better add pre-processing and remove trailing three dashes (---) from the file.

- truncate -s-4 spotinst-kubernetes-cluster-controller-ga.yaml

Also, we'll think about this case to prevent breaking the pipe.

Thanks for the update. I can confirm it fixed the issue

Like ktomk likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍂📹 Apptoberfest demo contest roundup: vote for your favorite demos!

Hi Community! The submissions are in (and listed below) for the 🍻🍂Apptoberfest🍂🍻 Demo Competition and it’s time for you to place your votes for the best: Analytics & reporting app demo ...

257 views 6 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you