I have a deployment script that tries to push to AWS EKS. All the variables are provisioned and the build and push to ECS container repository works fine.
I use the following step in the pipeline:
```yaml
#[...]
- step:
name: Deploy to staging area (AWS Production cluster)
deployment: staging
trigger: manual # Uncomment to make this a manual deployment.
script:
- pipe: atlassian/aws-eks-kubectl-run:1.3.1
variables:
AWS_ACCESS_KEY_ID: "$AWS_PROD_ACCESS_KEY_ID"
AWS_SECRET_ACCESS_KEY: "$AWS_PROD_SECRET_ACCESS_KEY"
AWS_DEFAULT_REGION: "$AWS_PROD_DEFAULT_REGION"
CLUSTER_NAME: "prod"
KUBECTL_COMMAND: "apply"
KUBECTL_ARGS:
- "-k"
RESOURCE_PATH: "k8s/deploy/staging"
WITH_DEFAULT_LABELS: "False" # Optional
```
The script fails with the errors below.
```
✔ 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)
KeyError: 'metadata'
```