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

Repository - Reports as Ready even though the status.atProvider.Status == Failed #214

Open
patpicos opened this issue Nov 14, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@patpicos
Copy link

What happened?

Deployed a resource of kind Repository and the resource status is showing as Ready even though there was a failure. As a result, we cannot properly report the health of the resource in the ArgoCD application that created it. While i understand the repo name is URL is incorrect, the managed resource should not show as Ready = True when the external resource is failed

Relevant details from the resource status and conditions:

status:
  atProvider:
    connectionState:
      attemptedAt: '2024-11-13T21:45:06Z'
      message: >-
        Unable to connect to repository: rpc error: code = Unknown desc = error
        testing repository connectivity: Get
        "None/packages/helm/stable/index.yaml": unsupported protocol scheme ""
      status: Failed
  conditions:
    - lastTransitionTime: '2024-11-13T17:45:01Z'
      reason: Available
      status: 'True'
      type: Ready
    - lastTransitionTime: '2024-11-13T17:45:00Z'
      reason: ReconcileSuccess
      status: 'True'
      type: Synced

How can we reproduce it?

See the Managed Resource below

apiVersion: repositories.argocd.crossplane.io/v1alpha1
kind: Repository
metadata:
  annotations:
    crossplane.io/composition-resource-name: nk-ndc-rtwdt-argocd-repo-helm-us-east-1
    crossplane.io/external-create-pending: '2024-11-13T17:45:00Z'
    crossplane.io/external-create-succeeded: '2024-11-13T17:45:00Z'
    crossplane.io/external-name: None/packages/helm/stable/
  creationTimestamp: '2024-11-13T17:45:00Z'
  finalizers:
    - finalizer.managedresource.crossplane.io
  generateName: nk-ndc-rtwdt-
  generation: 3
  labels:
    crossplane.io/claim-name: nk-ndc
    crossplane.io/claim-namespace: isv-onboarding-continuous-deployment
    crossplane.io/composite: nk-ndc-rtwdt
  name: nk-ndc-rtwdt-argocd-repo-helm-us-east-1
  ownerReferences:
    - apiVersion: onboarding.gitops.k8s.dish.io/v1beta1
      blockOwnerDeletion: true
      controller: true
      kind: XIsvContinuousDeployment
      name: nk-ndc-rtwdt
      uid: b4c64557-bf0d-494c-ad9c-5054eb3e3773
  resourceVersion: '21208721'
  uid: c3683a41-d6c2-442b-b364-d0a1f8ef5dae
spec:
  deletionPolicy: Orphan
  forProvider:
    enableLfs: false
    enableOCI: false
    inheritedCreds: false
    insecure: true
    name: nk-ndc-argocd-prj-dev-helm-repo
    project: nk-ndc-us-east-1-argocd-prj-dev
    repo: >-
      https://portal.cicd.gitlab.int.aws.sourced.io/api/v4/projects/558/packages/helm/stable/
    type: helm
  managementPolicies:
    - Create
    - Delete
    - LateInitialize
    - Observe
    - Update
  providerConfigRef:
    name: rmc-us-east-1-dev-argocd-provider-config
status:
  atProvider:
    connectionState:
      attemptedAt: '2024-11-13T21:45:06Z'
      message: >-
        Unable to connect to repository: rpc error: code = Unknown desc = error
        testing repository connectivity: Get
        "None/packages/helm/stable/index.yaml": unsupported protocol scheme ""
      status: Failed
  conditions:
    - lastTransitionTime: '2024-11-13T17:45:01Z'
      reason: Available
      status: 'True'
      type: Ready
    - lastTransitionTime: '2024-11-13T17:45:00Z'
      reason: ReconcileSuccess
      status: 'True'
      type: Synced

What environment did it happen in?

Crossplane version: 1.16
Crossplane Provider argocd version: 0.9.0

@patpicos patpicos added the bug Something isn't working label Nov 14, 2024
@patpicos
Copy link
Author

Note for anyone interested, the ArgoCD Health-check can be adapted by including this kind of check. However, I still believe having reliable conditions is the way to go

        -- Shortcut for resources with atProvider state such as repositories.argocd.crossplane.io
        if obj.status.atProvider then
          if obj.status.atProvider.connectionState then
            if obj.status.atProvider.connectionState.status == "Failed" then
              health_status.status = "Degraded"
              health_status.message = obj.status.atProvider.connectionState.message
              return health_status
            end
          end
        end

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