weaveworks / gitopssets-controller

Manages the GitOpsSet CRDs.
Apache License 2.0
9 stars 5 forks source link

Wait for Artifact before generation. #105

Closed bigkevmcd closed 1 year ago

bigkevmcd commented 1 year ago

The artifact may or may not be available, if we've already generated resources, generating no resources means that the existing resources are removed.

This changes it to return a marker error, which we can record and do nothing about.

We can do nothing, because when the Artifact is applied, this will trigger a watch notification, and we can generate.

bigkevmcd commented 1 year ago

https://github.com/weaveworks/weave-gitops-interlock/issues/479

bigkevmcd commented 1 year ago

Yeah seems to work great 👍

TIL flux doesn't seem to clear stale artifacts if you change a GitRepo.url until it successfully reconciles. Probably for a good reason.. It just means a gitopsset can reconcile a gitrepo that is not ready, as long as it has an artifact.

Is there any way we can determine this?

foot commented 1 year ago

Is there any way we can determine this?

Not sure about doing it accurately... in this case the status.artifact timestamp is before the ready, but ready could be false for other reasons..

status:
  artifact:
    digest: sha256:1c88565146a95dda6aa8ed198271816c3f609288ea5abd2a8628fc9a763e2a53
    lastUpdateTime: "2023-07-17T19:39:45Z"
    path: gitrepository/default/wge-sub-dev/40d6b21b888db0ca794876cf7bdd399e3da2137e.tar.gz
    revision: main@sha1:40d6b21b888db0ca794876cf7bdd399e3da2137e
    size: 37690
    url: http://source-controller.flux-system.svc.cluster.local./gitrepository/default/wge-sub-dev/40d6b21b888db0ca794876cf7bdd399e3da2137e.tar.gz
  conditions:
  - lastTransitionTime: "2023-07-17T19:47:37Z"
    message: 'failed to checkout and determine revision: unable to list remote for
      ''https://github.com/bigkevmcd/go-demo-2'': authentication required'
    observedGeneration: 3
    reason: GitOperationFailed
    status: "False"
    type: Ready

If we wanted to be more cautious we could stop reconciling Ready: false sources completely I guess.

bigkevmcd commented 1 year ago

I'm gonna rework this a bit, check for Artifact readiness.

Branch incoming :-)