operator-sdk: Adding third party types.go to current scheme is not working

Bug Report

What did you do? 1: I have external types.go and hence CR : https://github.com/noironetworks/aci-containers/blob/snat-jayaram/pkg/nodeinfo/apis/aci.nodeinfo/v1/types.go

2: my operator code : https://github.com/gaurav-dalvi/snat-operator/tree/sdk-bug I am trying to use Nodeinfo object in my operator code. I added AddToScheme call in main.go but my client is not able to get those objects for me.

What did you expect to see? https://github.com/gaurav-dalvi/snat-operator/blob/sdk-bug/cmd/manager/utils/k8sutils.go#L79 This line should get printed

What did you see instead? Under which circumstances? Line did not get print in the logs. Object came as nil . There was not even error.

Environment

  • operator-sdk version:

operator-sdk version: v0.8.1, commit: 33b3bfe10176f8647f5354516fff29dea42b6342

  • go version:

go version go1.12.5 darwin/amd64

  • Kubernetes version information:
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.1", GitCommit:"b7394102d6ef778017f2ca4046abbaa23b88c290", GitTreeState:"clean", BuildDate:"2019-04-08T17:11:31Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean", BuildDate:"2019-05-16T16:14:56Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
  • Kubernetes cluster kind:
 minikube version
minikube version: v1.1.0
  • Are you writing your operator in ansible, helm, or go? Go

Possible Solution NA

Additional context Based on this help : https://github.com/operator-framework/operator-sdk/blob/master/doc/user-guide.md#register-with-the-managers-scheme When external type exposes AddToScheme, you should be registering that in main.go of your operator code. I did the same. But my client is not able to get the object from apiserver.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@gaurav-dalvi can you please fill in the fields in the bug report above so we can help solve the problem faster, thanks!