-
Notifications
You must be signed in to change notification settings - Fork 61
Conversion webhooks in main #474
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. Minor comments are left, some of them are even not really related to the current PR)
Update operator-sdk version in makefile to 1.8.0 to support generating webhooks in OPM bundle. Note: this commit has a large number of line changes, but all of them are formatting due to operator-sdk 1.8.0 hard-wrapping long strings. Signed-off-by: Angel Misevski <[email protected]>
Use yq to make long strings in bundle manifests stay on a single line. As of operator-sdk v1.8.0, long strings are hard-wrapped, and this appears to cause issues when installing the operator. See operator-framework/operator-sdk#5033 for more details Signed-off-by: Angel Misevski <[email protected]>
Move conversion webhooks from the standalone webhooks server into the main controller deployment. This helps in using automatic configuration from OLM in creating webhooks, as this is unavailable for deployments not in the CSV. Using OLM to create the webhook configs and inject service name/namespace into the CRDs enables deploying the DevWorkspace controller to any namespace instead of restricting it to openshift-operators. Signed-off-by: Angel Misevski <[email protected]>
Update templates to * Create a service for webhooks pointing at the controller dpeloyment * Update the certs issued by cert-manager to match the controller's service name * Expose a conversion port in the main controller deployment Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Rename the service associated with the controller deployment to 'devworkspace-controller-manager-service' to match what appears to be expected by OLM. Otherwise, a duplicate service named such is created when the operator is installed via OLM. Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Add workaround for issue [1] when generating webhookdefinitions in the ClusterServiceVersion by using yq to directly sort the array. Also add documentation explaining current workarounds, since they're strange at first glance. [1] - operator-framework/operator-sdk#5022 Signed-off-by: Angel Misevski <[email protected]>
4fac554
to
7b9e0a3
Compare
Define webhooks server secret name to deployment templates when running in OpenShift and use similar functionality for getting this name in both Kubernetes and OpenShift. Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
76ac02c
to
6248389
Compare
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, JPinkney, sleshchenko The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path |
/test v7-devworkspace-happy-path |
|
@amisevsk: The following test failed, say
Full PR test history. Your PR dashboard. 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 understand the commands that are listed here. |
Happy path tests are failing because they use Tested latest changes manually on OpenShift and the happy path test failure does not reproduce. |
+1 to merge without waiting for happy path fix, but I remember we already faced the same and Serhii faced it. |
OK, it seems that it's not possible to use the latest deployment files since Che Operator image embeds them on container image build, unless we build Che operator image with custom templates... Or we may install devworkspace operator with |
Forgot to mention on closing -- created a dedicated issue: #484 |
Will Che overwrite existing devworkspace resources on install, or will it detect that DevWorkspace is already present? A relatively simple fix would be to |
What does this PR do?
Moves the conversion webhooks used for DevWorkspaces and DevWorkspaceTemplates into the main controller deployment rather than the webhooks server. This allows OLM to generate appropriate CRD fields when an operator is installed, and so enables installing the operator to any namespace on the cluster with the appropriate OperatorGroup configuration.
As part of this process, the Operator SDK dependency is updated to v1.8.0, as conversion webhooks support was added after v1.7.2. This change is done in the first commit of this PR and results in a seemingly large line diff, but semantically the files are identical and all line changes are due to line wrapping long strings. This can be tested using e.g.
Known issues
--output-dir
when generating bundle.Dockerfile (Operator SDK v1.9.0 seems to ignore--output-dir
when generating bundle.Dockerfile operator-framework/operator-sdk#5021), see also: PR fix: specify the right path of metadata in bundle.Dockerfile operator-framework/operator-sdk#5030yq
to restore files to long lines (see the second commit in this PR)operator-sdk generate bundle
. I will likely create a workaround commit for this soon, but hopefully it's not a huge issue for now. See issue Order of generated webhooks is not stable operator-framework/operator-sdk#5022 for details.What issues does this PR fix or reference?
Closes #470
Is it tested? How?
For each of
make install
)openshift-operators
namespacedevworkspace-operator
)test that
get crd devworkspaces.workspace.devfile.io -o yaml | yq '.spec.conversion'
)kc get devworkspaces.v1alpha1.workspace.devfile.io -o yaml
kc get devworkspaces.v1alpha2.workspace.devfile.io -o yaml
.components.plugins[].plugin.name
and on v1alpha2 it's.components.plugins[].name
.PR Checklist
/test v7-devworkspaces-operator-e2e, v7-devworkspace-happy-path
to trigger)v7-devworkspaces-operator-e2e
: DevWorkspace e2e testv7-devworkspace-happy-path
: DevWorkspace e2e test