Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Kustomize example isn't working properly #2533

Closed
pelissarisergioo opened this issue Oct 21, 2019 · 2 comments
Closed

Kustomize example isn't working properly #2533

pelissarisergioo opened this issue Oct 21, 2019 · 2 comments
Labels
blocked-needs-validation Issue is waiting to be validated before we can proceed bug

Comments

@pelissarisergioo
Copy link

Describe the bug
The kustomize example isn't working because kustomize isn't able to find the proper labels.

To Reproduce
Steps to reproduce the behavior:

  1. Create the kustomization.yaml file
bases:
  - github.com/fluxcd/flux//deploy
patchesStrategicMerge:
  - patch.yaml
  1. Create the patch.yaml file
apiVersion: apps/v1
kind: Deployment
metadata:
  name: flux
spec:
  template:
    spec:
      containers:
        - name: flux
          args:
            - --manifest-generation=true
            - --memcached-hostname=memcached.flux
            - --memcached-service=
            - --ssh-keygen-dir=/var/fluxd/keygen
            - --git-branch=master
            - --git-path=namespaces,workloads
            - --git-user=${GHUSER}
            - --git-email=${GHUSER}@users.noreply.github.com
            - [email protected]:${GHUSER}/flux-get-started

Expected behavior

$ kustomize build .
Error: no matches for OriginalId apps_v1_Deployment|~X|flux; no matches for CurrentId apps_v1_Deployment|~X|flux; failed to find unique target for patch apps_v1_Deployment|flux

Fix
Add the namespace in the patch file

apiVersion: apps/v1
kind: Deployment
metadata:
  name: flux
  namespace: flux
...

Test

$ kustomize build .
apiVersion: v1
kind: Namespace
metadata:
  name: flux
---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    name: flux
  name: flux
  namespace: flux
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
  labels:
    name: flux
  name: flux
rules:
- apiGroups:
  - '*'
  resources:
  - '*'
  verbs:
  - '*'
- nonResourceURLs:
  - '*'
  verbs:
  - '*'
---
.......

Additional information
If you want to deploy in a custom namespace is just a matter to use this line in your kustomization.yaml file

namespace: my-custom-namespace

kustomize info

$ kustomize version
Version: {Version:kustomize/v3.2.3 GitCommit:f8412aa3d39f32151525aff97a351288f5a7470b BuildDate:2019-10-08T23:30:25Z GoOs:darwin GoArch:amd64}
@pelissarisergioo pelissarisergioo added blocked-needs-validation Issue is waiting to be validated before we can proceed bug labels Oct 21, 2019
@nabadger
Copy link

Same for me - this is a kustomize3 update. The patchfile needs the namespace specified now.

@2opremio
Copy link
Contributor

I believe this was solved in #2732 , let me know if that wasn't the case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked-needs-validation Issue is waiting to be validated before we can proceed bug
Projects
None yet
Development

No branches or pull requests

3 participants