apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

transformers:
  - |-
    apiVersion: builtin
    kind: NamespaceTransformer
    metadata:
      name: notImportantHere
      namespace: core
    unsetOnly: true

namePrefix: gotenburg-
resources:
  - ../../../kustomize/bases/deployservice/

replacements:
  - source:
      kind: Deployment
      name: app
      fieldPath: metadata.labels.[app.kubernetes.io/appName]
    targets:
      - select:
          kind: Service
        fieldPaths:
          - spec.ports.0.name
          - spec.ports.0.targetPort
  - source:
      kind: Deployment
      name: app
      fieldPath: spec.template.spec.containers.0.ports.0.containerPort
    targets:
      - select:
          kind: Service
        fieldPaths:
          - spec.ports.0.port

patches:
  - path: patches/deployment.yaml
    target:
      kind: Deployment

labels:
  - includeSelectors: true
    pairs:
      app.kubernetes.io/appName: gotenburg
  - pairs:
      app.kubernetes.io/appNamespace: core