Mahyar
Mahyar

Reputation: 1121

Add label to metadata

I've started to use kustomize to update the yaml files. I'm trying to add labels to Deployment object. commonLabels seems pretty good but it applies the label to selector as well (which I don't want)

Is there a way to add new label only to metadata.labels or spec.template.metadata.labels?

here's a sample deployment object :

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  labels:
    service: servieName
    owner: ownerName
  name: myName
spec:
  replicas: 1
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
         app: servieName
         owner: ownerName
         <newLableHere>: <newValueHere>
 ...

Upvotes: 0

Views: 445

Answers (1)

coderanger
coderanger

Reputation: 54181

You would need to define a patch for that object specifically.

Upvotes: 1

Related Questions