-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle when particular resource does not exists on cluster #6369
Comments
/assign @OchiengEd |
@jberkhahn: GitHub didn't allow me to assign the following users: OchiengEd. Note that only operator-framework members with read permissions, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I will take a look at this. |
Hi @josericardomcastro , to answer your specific question you might need to add a helper function. For example we can call it has
To implement the above function, you will need to to import the following golang modules:
On a sidenote, looking at the code snippet you shared, I am inclined to ask if Ingress and Routes are primary resources managed by your operator. For example, a MySQL resource would be the primary resource managed by a mysql-operator whereas statefulsets, secrets, configmaps, etc would be secondary resources. If This is in reference to the following code block:
Lastly, the code section in the |
Hey @OchiengEd, Thanks a lot for you help, your solution worked as expected for me. And regarding your question, yes, the ingress/router are primary resources in my operator. |
Type of question
How to implement a specific feature
Question
What did you do?
I am creating an operator to watch and reconcile many resources, deployment, ingress and routes (Openshift). I plan to use and test the same version of this operator in many diffferent clusters (EKS, AKS, GKE and OCP-Openshift Cluster).
in the
main.go
file im adding the resourcesBut in some cases i will use this operator on cluster that does not have/know the resource Route.
So, is there a way to check if the resource exists first and handle the error?
What did you expect to see?
No errors when i run the operator on any cluster.
What did you see instead? Under which circumstances?
Any cluster, except and Openshift cluster.
Environment
Operator type:
/language go
Kubernetes cluster type:
Minukube, EKS and OpenShift
$ operator-sdk version
$ go version
$ kubectl version
The text was updated successfully, but these errors were encountered: