Uploaded image for project: 'OpenShift GitOps'
  1. OpenShift GitOps
  2. GITOPS-1672

Possible bug when pruning templates

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • 1.7.0
    • None
    • ArgoCD
    • None
    • 5
    • False
    • False
    • GITOPS Sprint 216, GITOPS Sprint 217, GITOPS Sprint 218, GITOPS Sprint 219, GITOPS Sprint 220, GITOPS Sprint 221

      Environment:

      OCP: 4.8.9
      GitOps: 1.3.2

      Trying to delete the resources "kind: Template" it gives a "the server could not find the requested resource" even when marking "Prune" when syncing manually. I tried removing other resources like namespaces without issues. Here are the steps to reproduce the behaviour:

      Creating a template.yaml with the following(Already tried with namespace on the yaml too since I thought the problem could be due to that but not.. ):

      ~~~
      apiVersion: template.openshift.io/v1
      kind: Template
      metadata:
      name: redis-template-gitops
      annotations:
      description: "Description"
      iconClass: "icon-redis"
      tags: "database,nosql"
      objects:

      • apiVersion: v1
        kind: Pod
        metadata:
        name: redis-master
        spec:
        containers:
      • env:
      • name: REDIS_PASSWORD
        value: ${REDIS_PASSWORD}
        image: dockerfile/redis
        name: master
        ports:
      • containerPort: 6379
        protocol: TCP
        parameters:
      • description: Password used for Redis authentication
        from: '[A-Z0-9] {8}

        '
        generate: expression
        name: REDIS_PASSWORD
        labels:
        redis: master
        ~~~

      Creating an App on ArgoCD:

      ~~~
      project: default
      source:
      repoURL: 'https://github.com/NelsonLomboPaez/testnamespace'
      path: test
      targetRevision: HEAD
      destination:
      server: 'https://kubernetes.default.svc'
      namespace: testdos
      syncPolicy:
      syncOptions:

      • PruneLast=true
        ~~~

      Click on Sync and the template is created on the "testdos" namespace:

      ~~~
      $ oc get template -n testdos
      NAME DESCRIPTION PARAMETERS OBJECTS
      redis-template-gitops-testdos Description 1 (1 generated) 1
      ~~~

      Then modify the repository removing the yaml and creating a new one or updating the content, in this case it was modify to add a label to a namespace:

      ~~~
      apiVersion: v1
      kind: Namespace
      metadata:
      name: test
      labels:
      argocd.argoproj.io/managed-by: openshift-gitops
      ~~~

      After marking the sync button with "Prune" and "Prune Last" the error is the following:

      ~~~
      the server could not find the requested resource
      ~~~

      But the resource is still present on the cluster:

      ~~~
      $ oc get template -n testdos
      NAME DESCRIPTION PARAMETERS OBJECTS
      redis-template-gitops-testdos Description 1 (1 generated) 1
      ~~~

      So it's not able to delete the kind:template. The same mechanism works when deleting a Namespace for example. At first, I thought it could be because of the template.yaml didn't have the namespace on the yaml but I tried and the behaviour is the same, not sure if there is any limitation on Templates or if I'm doing something wrong, If its needed any clarification, please, feel free to ping me.

      Thank you very much!

      Regards,

              jfischer@redhat.com Jann Fischer
              rhn-support-npaez Nelson Paez
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: