-
Notifications
You must be signed in to change notification settings - Fork 66
🌱 Add test-operator with custom controller #2070
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2070 +/- ##
==========================================
+ Coverage 73.33% 73.38% +0.05%
==========================================
Files 77 77
Lines 7076 7076
==========================================
+ Hits 5189 5193 +4
+ Misses 1545 1542 -3
+ Partials 342 341 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3fb8ef7
to
693a355
Compare
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
@@ -246,11 +246,18 @@ test-unit: $(SETUP_ENVTEST) envtest-k8s-bins #HELP Run the unit tests | |||
$(UNIT_TEST_DIRS) \ | |||
-test.gocoverdir=$(COVERAGE_UNIT_DIR) | |||
|
|||
TEST_OPERATOR_CONTROLLERS_HOME=./testdata/images/controllers | |||
TEST_OPERATOR_CONTROLLERS=v1.0.0 v2.0.0 |
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.
Is this missing v1.3.0
? Or is it not needed because it's not actually built?
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.
Are these tests even run?
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.
Are these tests even run?
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.
Same here. Are these tests even run?
if _, err := w.Write(fileBytes); err != nil { | ||
return nil, err | ||
} |
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.
Are we concerned about filesize here? In that we only read/write once per file?
Depends on #2080
Description
Adds the scaffolding for the test-operator in versions v1 and v2 using operator-sdk. The test-operator is a basic echo service.
The test-operator supports AllNamespaces, SingleNamespace, and OwnNamespace install modes.
v1.0.0: is just the crd and the existing configmap resource
v1.3.0: has the same crd as v1.0.0 and the updated configmap previously part of v2.0.0
v2.0.0: has validating, mutating and conversion webhooks
I've had to modify an e2e that expected v2.0.0 of the test operator to be installed since v2 now includes webhooks and support is not enabled by default (yet). I've added a v1.3.0 as a stand-in for the previous v2 and updated the catalogs accordingly.
Because the test-operator now has its own controller, I've also had to update testdata/push to handle the controller image building/pushing
As it is, the test-operator should make a good fixture for testing the Single/OwnNamespace and Webhook support features.
Thing we should feel confident in doing in the future
Risks
v1
A reconciled test-operator v1 resource would look like this:
The v1 operator also includes a validating and mutating webhook. The validating webhook validates
.spec.message
against a keyword and rejects admission if its found. The mutating webhook is used as a "defaulting" webhook that sets.spec.message
to the default message ofEcho
.v2
A reconciled test-operator v2 resource would look like this:
The same webhooks are available for v2 apis + a conversion webhook to support the CRD upgrade.
Reviewer Checklist