operator-framework / operator-sdk

SDK for building Kubernetes applications. Provides high level APIs, useful abstractions, and project scaffolding.
https://sdk.operatorframework.io
Apache License 2.0
7.25k stars 1.75k forks source link

How to generate k8s resource manifest? #5831

Closed zc2638 closed 2 years ago

zc2638 commented 2 years ago

Question

How should I operate to generate k8s resource manifests ? I don't want to use operator-sdk custom resource ClusterServiceVersion. I hope the whole process is completed through pure k8s resources, controllable.

$ operator-sdk version operator-sdk version: "v1.21.0-6-g28033559", commit: "280335593c76c1fb14ce96100938f140ddb42659", kubernetes version: "v1.23", go version: "go1.18", GOOS: "darwin", GOARCH: "amd64"

varshaprasad96 commented 2 years ago

@zc2638 Could you please elaborate the question. Do you mean adding generic K8s resources as a part of Custom Resource Definition? Or do you mean that the controller not reconciling the Custom resource and instead just a k8s object?In second case, we don't need to generate/apply manifests of k8s resources since the api-server will already know about it.

zc2638 commented 2 years ago

Hi @varshaprasad96 , I run make bundle to get the ClusterServiceVersion resource. I hope that I can get the generated Deployment resource by command to deploy the operator, which will be very useful for my business.

zc2638 commented 2 years ago

/help

openshift-ci[bot] commented 2 years ago

@zc2638: This request has been marked as needing help from a contributor.

Please ensure the request meets the requirements listed here.

If this request no longer meets these requirements, the label can be removed by commenting with the /remove-help command.

In response to [this](https://github.com/operator-framework/operator-sdk/issues/5831): >/help Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
camilamacedo86 commented 2 years ago

Hi @zc2638,

The make bundle creates the bundle.

The bundles are required for you to integrate your solution with OLM.

That means distributing your solution via https://operatorhub.io/ or for example via the RedHat community (https://github.com/redhat-openshift-ecosystem/community-operators-prod/) to add your Project on Openshift/OKD catalogs by default.

The CSV contains only the pods/conatiner which will be used to install the Operator/manager itself. Therefore, your Operator/magaer will reconcile Kinds ( GKV/CRDs ) with the goal to ensure a desired state on the cluster. In this way, if you have your Operand (app/service) managed by our Operator and configured accordingly on the cluster you need to create a Deployment that MUST be done via the reconciliation. (you can check under the testdata/samples how it is done, see: https://github.com/operator-framework/operator-sdk/blob/master/testdata/go/v3/memcached-operator/controllers/memcached_controller.go#L139-L174 )

For Golang projects, you will implement the code, see the Memcached tutorial: https://sdk.operatorframework.io/docs/building-operators/golang/tutorial/

I'd like to suggest to you before beginning to create your project check the following docs which will not be too much effort/time spent and will give to you a better idea:

For Ansible/Helm the deployments are created in the playbooks and charts, then check in its respective tutorials and the rest of the docs are still valid.

In this way, I think we can close this one as sorted out. However, please feel free to re-open if you see that still need some help or create new issues (ps. please ensure that each issue has one question/1 topic and etc)