Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgoCD tries to delete the contents of argocd-cm.yaml with kustomize bases #2173

Closed
cullenmcdermott opened this issue Aug 20, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@cullenmcdermott
Copy link

Describe the bug
When using the provide Kustomize Manifests and configuring Argo CD to manage itself, every hard refresh will switch between In Sync and Out of Sync. It tries to delete the data block from the argo-cm.yaml configmap.

Here is a redacted version of my argocd-cm.yaml. It tries to remove everything under the data key.

apiVersion: v1
data:
  repositories: |
    - passwordSecret:
        key: password
        name: git-credentials
      url: https://gitlab.example.com/user/kubernetes
      usernameSecret:
        key: username
        name: git-credentials
  url: http://localhost:4000
kind: ConfigMap
metadata:
  name: argocd-cm
  namespace: argocd
  labels:
    app.kubernetes.io/instance: argocd
    app.kubernetes.io/name: argocd-cm
    app.kubernetes.io/part-of: argocd

To Reproduce

  1. Create an "ArgoCD" Application in ArgoCD and configure it with a kustomization.yaml similar to this:
bases:
  - github.com/argoproj/argo-cd//manifests/cluster-install?ref=v1.1.2
namespace: argocd
patchesJson6902:
  - path: container_arg_patch.yaml
    target:
      group: apps
      kind: Deployment
      name: argocd-server
      version: v1
resources:
  - ingress.yaml
  - argocd-cm.yaml
commonLabels:
  app.kubernetes.io/instance: argocd
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
  1. Make sure it is in sync with your git provider.
  2. In the UI click Hard Refresh it will go out of sync
  3. Click hard refresh again it will go out of sync

It doesn't happen every time but I'm able to replicate it about 1/4 to 2/3 of the time.

Expected behavior
It should stay In Sync

Version

$ argocd version 
argocd: v1.1.2+567fcc3.dirty
  BuildDate: 2019-07-30T17:45:54Z
  GitCommit: 567fcc33140ec93051fdf8d0af7ea404deb64f20
  GitTreeState: dirty
  GoVersion: go1.11.4
  Compiler: gc
  Platform: linux/amd64
argocd-server: v1.1.2+567fcc3.dirty
  BuildDate: 2019-07-30T17:47:02Z
  GitCommit: 567fcc33140ec93051fdf8d0af7ea404deb64f20
  GitTreeState: dirty
  GoVersion: go1.11.4
  Compiler: gc
  Platform: linux/amd64
  Ksonnet Version: 0.13.1
@cullenmcdermott cullenmcdermott added the bug Something isn't working label Aug 20, 2019
@alexec alexec self-assigned this Aug 20, 2019
@alexec alexec added this to the v1.2 milestone Aug 20, 2019
@alexec alexec added this to To do in 2019-08-14 via automation Aug 20, 2019
@alexmt
Copy link
Collaborator

alexmt commented Aug 20, 2019

Thank you for providing clear steps to reproduce, @cullenmcdermott ! Got exact same behavior using https://github.com/alexmt/argocd-example-apps/tree/2173/bug .

I believe this is kustomize 2.0.3 bug. The argocd-cm config map already defined in the remote base, so config map should be modified using patch instead of added as a new resource. E.g.

bases:
  - github.com/argoproj/argo-cd//manifests/cluster-install?ref=v1.1.2
namespace: argocd
patchesJson6902:
  - path: container_arg_patch.yaml
    target:
      group: apps
      kind: Deployment
      name: argocd-server
      version: v1
resources:
  - ingress.yaml
patchesStrategicMerge:
  - argocd-cm.yaml
commonLabels:
  app.kubernetes.io/instance: argocd
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

I think kustomize should return error in this case, but kustomize 2.0.3 just ignore conflicting resource and return unmodified version from the remote base. The kustomize 3.x returns error. It also panics but at least it is clear that kustomization.yaml has an error.

@alexec alexec removed this from To do in 2019-08-14 Aug 21, 2019
@alexec alexec removed this from the v1.2 milestone Aug 21, 2019
@alexec alexec removed their assignment Aug 21, 2019
@alexmt
Copy link
Collaborator

alexmt commented Aug 21, 2019

I guess we can close it. Please feel free to reopen if solution does not help

@alexmt alexmt closed this as completed Aug 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants