Search code examples
istiokustomize

Kustomize doesn't adapt workloadSelector label of sidecar when using nameSuffix?


I have a sidecar like this:

apiVersion: networking.istio.io/v1alpha3
kind: Sidecar
metadata:
  name: test
  namespace: testns
spec:
  workloadSelector:
    labels:
      app: test
...

and a kustomization like:

resources:
  - ../../base

nameSuffix: -dev

But kustomize doesn't adapt the workloadSelector label app to test-dev as I would expect it to do. The name suffix is only appended to the name of the sidecar. Any ideas why?


Solution

  • By default kustomize namePrefix and nameSuffix only apply to metadata/name for all resources.

    There are a set of configured nameReferences that will also be transformed with the appropriate name, but they are limited to resource names.

    See here for more info: https://github.com/kubernetes-sigs/kustomize/blob/master/examples/transformerconfigs/README.md#prefixsuffix-transformer