anax icon indicating copy to clipboard operation
anax copied to clipboard

Bug: kube_operator/client.go should support newer operator-sdk scheme

Open johnwalicki opened this issue 3 years ago • 5 comments

Describe the bug.

Submit an operator.tar.gz to set up a edge cluster service. It fails at kube_operator/client.go Line 377 with this error:

I0701 04:19:59.785906     105 kubeworker.go:142] Kubernetes Worker: begin install of Kube Deployment ff2ebcb2789dda95d489cf68d7df78728e2c6053efd37dcf0f53bd405c96ecb9
E0701 04:19:59.808601     105 kubeworker.go:95] Kubernetes Worker: failed to process kube package after agreement negotiation: Kubernetes Worker: Error: kubernetes object not in recognized scheme.

https://github.com/open-horizon/anax/blame/master/kube_operator/client.go#L377

The getK8sObjectFromYaml function is choking on some part of the scheme that I'm passing it. Possibly we need to add v1alpha1 to the parsable schemes?

	// This is required to allow the schema to recognize custom resource definition types
	_ = v1beta1scheme.AddToScheme(sch)

My operator uses operators.coreos.com/v1alpha1 scheme.

$ grep apiVersion deploy/operator.yaml 
apiVersion: operators.coreos.com/v1alpha1
          apiVersion: v1
apiVersion: operators.coreos.com/v1alpha1
apiVersion: operators.coreos.com/v1
apiVersion: operators.coreos.com/v1alpha1
apiVersion: v1
apiVersion: apps/v1

See the docs: https://docs.openshift.com/container-platform/4.8/rest_api/operatorhub_apis/clusterserviceversion-operators-coreos-com-v1alpha1.html

Describe the steps to reproduce the behavior.

No response

Expected behavior.

No response

Screenshots.

No response

Operating Environment

Linux

Additional Information

No response

johnwalicki avatar Jul 01 '22 13:07 johnwalicki

I provided @MaxMcAdam with an operator.tar.gz that uses the operators.coreos.com/v1alpha1 scheme (which I think was generated from an operator-sdk 1.4 build)

johnwalicki avatar Jul 01 '22 18:07 johnwalicki

kind: Subscription is one of the features used in recent operators (included in my example operator.tar.gz). https://docs.openshift.com/container-platform/4.8/rest_api/operatorhub_apis/subscription-operators-coreos-com-v1alpha1.html

johnwalicki avatar Jul 01 '22 18:07 johnwalicki

Additional operator framework / OLM links:

  • https://sdk.operatorframework.io/docs/installation/
  • https://sdk.operatorframework.io/docs/upgrading-sdk-version/v1.4.0/
  • https://sdk.operatorframework.io/docs/olm-integration/cli-overview/
  • https://sdk.operatorframework.io/docs/olm-integration/tutorial-bundle/

johnwalicki avatar Jul 01 '22 18:07 johnwalicki

ClusterServiceVersion scheme used by newer operators:

  • https://docs.openshift.com/container-platform/4.8/rest_api/operatorhub_apis/clusterserviceversion-operators-coreos-com-v1alpha1.html

johnwalicki avatar Jul 01 '22 18:07 johnwalicki

Also note, issue #3445 when solving this issue. They may or may not be related. Both need to be solved one way or another.

dabooz avatar Aug 31 '22 12:08 dabooz

@MaxMcAdam Does https://github.com/open-horizon/anax/commit/a37e9539602117e8654593cc785c6dcdea3d5527 solve this Operator SDK requirement?

We have another use case that requires operator-sdk v1.x schema support.

johnwalicki avatar Jan 17 '23 14:01 johnwalicki

Cannot close this issue yet. Still need a bug fixed from the operator-framework group

linggao avatar Feb 27 '23 15:02 linggao

@linggao Will the approach be directly supporting the operator 1.x generated skeleton files OR restructuring the files into 0.x format and then working with existing edge cluster operator deployment techniques?

SanjeevKGupta avatar Feb 27 '23 15:02 SanjeevKGupta

@SanjeevKGupta the agent supports deploying a 1.x operator, just not one deployed with the olm mechanism

MaxMcAdam avatar Mar 01 '23 15:03 MaxMcAdam