I'm trying to use the kubectl pipe to deploy to kubernets but I'm getting the error:
Traceback (most recent call last):
File "/pipe.py", line 165, in <module>
pipe.run()
File "/pipe.py", line 156, in run
self.handle_apply()
File "/pipe.py", line 113, in handle_apply
self.update_labels_in_metadata(template_file, labels)
File "/pipe.py", line 36, in update_labels_in_metadata
yaml_doc['metadata'].setdefault('labels', {}).update(labels)
KeyError: 'metadata'
I assume that this is because my yml doesn't have a root element "metadata". The yml was generated using the fabric8 maven plugin, and looks similar to the below (I've removed large chunks of it, but this should be enough to go on:
---
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Service
metadata:
annotations:
labels:
name:
spec:
ports:
type: NodePort
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
labels:
name:
spec:
replicas: 1
revisionHistoryLimit: 2
selector:
template:
metadata:
annotations:
labels:
spec:
containers:
Hi @Martin Cassidy ,
The new version with fix released:
script: - pipe: atlassian/kubectl-run:3.0.1 variables: KUBE_CONFIG: $KUBE_CONFIG KUBECTL_COMMAND: 'apply' RESOURCE_PATH: 'nginx.yml'
It would be great if you provide us with your feedback about the pipe.
Cheers,
Oleksandr Kyrdan
Thank you for your question!
We'll investigate this issue and notify you.
Cheers,
Oleksandr Kyrdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.