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

Could not update application spec: could not get creds for repo '': credentials for '' are not configured in Argo CD settings #683

Open
clambin opened this issue Mar 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@clambin
Copy link

clambin commented Mar 4, 2024

Describe the bug
I have an Application in ArgoCD with the following configuration:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: ledswitcher
  namespace: argocd
  annotations:
    argocd-image-updater.argoproj.io/write-back-method: git
    argocd-image-updater.argoproj.io/write-back-target: kustomization
    argocd-image-updater.argoproj.io/image-list: ledswitcher=ghcr.io/clambin/ledswitcher
    argocd-image-updater.argoproj.io/ledswitcher.update-strategy: latest
spec:
  destination:
    namespace: infra
    server: https://kubernetes.default.svc
  project: default
  sources:
  - path: argocd/conf/infra/ledswitcher/resources
    repoURL: https://github.com/clambin/gitops
    targetRevision: HEAD
  syncPolicy:
    automated:
      prune: true
    syncOptions:
    - CreateNamespace=true

This leads to a DaemonSet in argocd/conf/infra/ledswitcher/resources:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: ledswitcher
  labels:
    app: ledswitcher
spec:
    spec:
      containers:
      - name: ledswitcher
        image: ghcr.io/clambin/ledswitcher
...

and the image tag is set in a kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- rbac.yaml
- daemonset.yaml
images:
- name: ghcr.io/clambin/ledswitcher
  newTag: sha-ad4c2e3-2024030411003510

Whenever argocd-image-updater tries to update the version, it reports the following error:

time="2024-03-04T19:14:14Z" level=error msg="Could not update application spec: could not get creds for repo '': credentials for '' are not configured in Argo CD settings" application=ledswitcher

Additional context
Similar setups exist in my cluster for deployments. Those work without any problem. The only difference that I found is that in this case, it's trying to update a daemonset, rather than a deployment.

Version
quay.io/argoprojlabs/argocd-image-updater:v0.12.2

Logs

time="2024-03-04T19:14:14Z" level=info msg="Setting new image to ghcr.io/clambin/ledswitcher:sha-092c297-2024030415280045" alias=ledswitcher application=ledswitcher image_name=clambin/ledswitcher image_tag=sha-ad4c2e3-2024030411003510 registry=ghcr.io
time="2024-03-04T19:14:14Z" level=info msg="Successfully updated image 'ghcr.io/clambin/ledswitcher:sha-ad4c2e3-2024030411003510' to 'ghcr.io/clambin/ledswitcher:sha-092c297-2024030415280045', but pending spec update (dry run=false)" alias=ledswitcher application=ledswitcher image_name=clambin/ledswitcher image_tag=sha-ad4c2e3-2024030411003510 registry=ghcr.io
time="2024-03-04T19:14:14Z" level=info msg="Committing 1 parameter update(s) for application ledswitcher" application=ledswitcher
time="2024-03-04T19:14:14Z" level=info msg="Starting configmap/secret informers"
time="2024-03-04T19:14:14Z" level=info msg="Configmap/secret informer synced"
time="2024-03-04T19:14:14Z" level=error msg="Could not update application spec: could not get creds for repo '': credentials for '' are not configured in Argo CD settings" application=ledswitcher
time="2024-03-04T19:14:14Z" level=info msg="secrets informer cancelled"
time="2024-03-04T19:14:14Z" level=info msg="configmap informer cancelled"
@clambin clambin added the bug Something isn't working label Mar 4, 2024
@clambin
Copy link
Author

clambin commented Mar 5, 2024

I accidentally found that this can also happen for a Deployment. The root cause seems to be related to using multiple sources in your application:

Does not work (even if there's only one source):

  sources:
  - path: argocd/conf/infra/ledswitcher/resources
    repoURL: https://github.com/clambin/gitops
    targetRevision: HEAD

Works:

  source:
    path: argocd/conf/infra/ledswitcher/resources
    repoURL: https://github.com/clambin/gitops
    targetRevision: HEAD

In the first confirmation, image updates are broken with the error in the first comment. If we change it to the 2nd version (one source, rather than multiple), then image upgrades works fine.

@clambin clambin changed the title Could not update application spec: could not get creds for repo '': credentials for '' are not configured in Argo CD settings (daemonset?) Could not update application spec: could not get creds for repo '': credentials for '' are not configured in Argo CD settings Mar 6, 2024
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

1 participant