operator-controller icon indicating copy to clipboard operation
operator-controller copied to clipboard

`installedBundleResource` and `resolvedBundleResource` are being removed from `Operator`'s status

Open m1kola opened this issue 2 years ago • 0 comments

It seems like we remove installedBundleResource and resolvedBundleResource from Operator's status in case of errors.

Steps to reproduce

  1. Run the operators from master:
    make run
    
  2. Create a catalog:
    kubectl apply -f config/samples/catalogd_operatorcatalog.yaml
    
  3. Create an operator
    kubectl apply -f - <<EOF
    apiVersion: operators.operatorframework.io/v1alpha1
    kind: Operator
    metadata:
      labels:
        app.kubernetes.io/name: operator
        app.kubernetes.io/instance: operator-sample
        app.kubernetes.io/part-of: operator-controller
        app.kubernetes.io/managed-by: kustomize
        app.kubernetes.io/created-by: operator-controller
      name: operator-sample
    spec:
      packageName: project-quay
      channel: stable-3.8
      version: 3.8.1
    EOF
    
  4. Wait for the operator to be installed:
    kubectl wait operators operator-sample --for condition=Installed
    
  5. Observe presense of .status.installedBundleResource and .status.resolvedBundleResource
    kubectl get operator operator-sample -o json | jq ".status | {installedBundleResource, resolvedBundleResource}"
    
    Output:
    {
      "installedBundleResource": "quay.io/operatorhubio/project-quay@sha256:acc366f665ee728e18941e55d28d2c70f1a8848e183abc1ca3202cb00a75370f",
      "resolvedBundleResource": "quay.io/operatorhubio/project-quay@sha256:acc366f665ee728e18941e55d28d2c70f1a8848e183abc1ca3202cb00a75370f"
    }
    
  6. Edit operator to have invalid version:
    kubectl patch operator operator-sample --type json -p '[{"op": "replace", "path": "/spec/version", "value": "123123.0.0"}]'
    
  7. Observe that these fields are now gone:
    kubectl get operator operator-sample -o json | jq "{installedBundleResource: .status.installedBundleResource, resolvedBundleResource: .status.resolvedBundleResource}"
    
    Output:
    {
      "installedBundleResource": null,
      "resolvedBundleResource": null
    }
    

Expected result

Not sure about resolvedBundleResource, but I think installedBundleResource should still be present becuase it indicates what is currently installed.

m1kola avatar Aug 04 '23 14:08 m1kola