argoproj-labs / argocd-image-updater

Automatic container image update for Argo CD
https://argocd-image-updater.readthedocs.io/en/stable/
Apache License 2.0
1.24k stars 256 forks source link

Image updater recognise single app as Directory #460

Open ievgen-golubiev opened 2 years ago

ievgen-golubiev commented 2 years ago

same problem like here https://github.com/argoproj-labs/argocd-image-updater/issues/294 and here https://github.com/argoproj-labs/argocd-image-updater/issues/458 I have only one single app in ArgoCD and image updater recognise it like Directory level=warning msg="skipping app 'XXXXX-backend' of type 'Directory' because it's not of supported source type" application=XXXXX-backend

fdallaca commented 2 years ago

My case was a single app with a helm repo source. I use app of apps only to address the problem of git write back method used in conjunction with a source of kind helm repo (We point to a nexus with packaged charts, not source with Chart code).

Golgautier commented 2 years ago

In my case, I have few ArgoCD apps defined in git repo. Image updated does not want to consider them because of the type 'Directory'

rtrompier commented 2 years ago

Same problem for me. Anyone found a solution ?

Golgautier commented 2 years ago

There are some limitations, and image-updater works only with helm and kustomize apps

Argo CD Image Updater can only update container images for applications whose manifests are rendered using either Kustomize or Helm and - especially in the case of Helm - the templates need to support specifying the image's tag (and possibly name) using a parameter (i.e. image.tag).

I think we can close this case.

rucciva commented 1 year ago

In my case, the folders watched (single application) by argocd application controller contains the results of running kustomize build. The purpose was to have a better visibility (in git history) of what manifests or the changes that will be applied to cluster.

though i have a workaround, creating a fake kustomization.yaml on the watched directories

cat >$targetdir/kustomization.yaml <<-EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
$(find "$targetdir" -type f \( ! -name '.argocd-*' -and ! -name kustomization.yaml \) | xargs basename | xargs -I {} echo "- {}")
2start commented 1 year ago

There is one more use case where it would be really helpful: We switched to cdk8s which is great but we generate the manifests first as yaml files. Now, to keep using the image updater we gotta create a fake kustomization.yaml too because type "Directory" is supported by Argo CD but not the image updater.

VinayTalla20 commented 8 months ago

@2start , what is solution is image-update only works with helm or kustomize. in either case then atleast we should see logs that new images as been updated to registry when image-update runs its scan.

my image-update logs:

errors=0" time="2024-01-21T13:52:50Z" level=warning msg="skipping app 'sample-service' of type 'Directory' because it's not of supported source type" application=xxxx-service

i am using ACR(azure container registry) and not using any helm or kustomize

my application yaml:

apiVersion: argoproj.io/v1alpha1 kind: Application metadata: annotations: argocd-image-updater.argoproj.io/image-list: dev.azurecr.io/dev/xxxservice name: xxxx-service namespace: argocd spec: destination: namespace: default server: https://kubernetes.default.svc project: default source: path: kubernetes-manifests/ repoURL: git@bitbucket.org:xxxx/infra-repo.git targetRevision: devops

virtualb0x commented 8 months ago

Will this plugin work for manifests-only? Not only for helm and kustomize? Some day in future?

VinayTalla20 commented 8 months ago

As fas as i know present it supports only helm and kustomize

cgawron commented 6 months ago

I don't actually understand why applications of type Directory are not supported.

We are using a 'plain' git repo with a set of yaml files to define the application. I would expect that the image updater is able to pull the latest image in case it changes (e.g. via a GitHub action).

In our case, a Directory is not a collection and we specify the images to pull via argocd-image-updater.argoproj.io/image-list:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: openai-proxy
  namespace: argocd
  annotations:
    argocd-image-updater.argoproj.io/image-list: ghcr.io/fhswf/openai-proxy
spec:
  destination:
    namespace: openai-proxy
    server: https://kubernetes.default.svc
  project: default
  source:
    path: k8s
    repoURL: https://github.com/fhswf/openai-proxy.git
    targetRevision: HEAD
szbenceg commented 5 months ago

Is there any workaround? I use ApplicationSet and I see the same warning in the logs and the the images are not updated.

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: apps
spec:
  generators:
    - git:
        repoURL: 
        revision: HEAD
        directories:
          - path: apps/*
  template:
    metadata:
      annotations:
        argocd-image-updater.argoproj.io/image-list: image
        argocd-image-updater.argoproj.io/update-strategy: digest
      name: '{{path.basename}}'
    spec:
      project: default
      source:
        repoURL: 
        targetRevision: HEAD
        path: '{{path}}'
      destination:
        server: https://kubernetes.default.svc
        namespace: '{{path.basename}}'
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true

In the log i see all my apps are skipping:

time="2024-04-09T10:51:32Z" level=warning msg="skipping app 'argocd' of type 'Directory' because it's not of supported source type" application=argocd
time="2024-04-09T10:51:32Z" level=warning msg="skipping app '' of type 'Directory' because it's not of supported source type" application=
time="2024-04-09T10:51:32Z" level=warning msg="skipping app '' of type 'Directory' because it's not of supported source type" application=
time="2024-04-09T10:51:32Z" level=warning msg="skipping app 'monitoring' of type 'Directory' because it's not of supported source type" application=monitoring
time="2024-04-09T10:51:32Z" level=warning msg="skipping app 'postgres' of type 'Directory' because it's not of supported source type" application=postgres
time="2024-04-09T10:51:32Z" level=warning msg="skipping app 'rabbitmq' of type 'Directory' because it's not of supported source type" application=rabbitmq
time="2024-04-09T10:51:32Z" level=warning msg="skipping app 'redis' of type 'Directory' because it's not of supported source type" application=redis
time="2024-04-09T10:51:32Z" level=warning msg="skipping app '' of type 'Directory' because it's not of supported source type" application=
time="2024-04-09T10:51:32Z" level=warning msg="skipping app 'test-ingress' of type 'Directory' because it's not of supported source type" application=test-ingress
cgawron commented 5 months ago

We are currently updating the yaml files in the GitHub worklow like this:

      - name: Update yaml
        uses: fjogeleit/yaml-update-action@main
        with:
          token: ${{ steps.cicd.outputs.token }}
          valueFile: 'k8s/deployment-dev.yaml'
          propertyPath: 'spec.template.spec.containers[0].image'
          value: ghcr.io/fhswf/openai-ui:${{ env.DOCKER_METADATA_OUTPUT_VERSION }}
          branch: main
          message: 'Update image to ${{ env.DOCKER_METADATA_OUTPUT_VERSION }} [skip ci]'
mmelyp commented 1 week ago

would be nice to have a workaround for this