-
Notifications
You must be signed in to change notification settings - Fork 66
🌱 Add test-operator with custom controller #2085
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
Draft
perdasilva
wants to merge
5
commits into
operator-framework:main
Choose a base branch
from
perdasilva:test-operator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,426
−367
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT | ||
|
||
go 1.24.3 | ||
|
||
require helm.sh/helm/v3 v3.18.4 // cmd/helm |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: testdata | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
merge_group: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
|
||
- name: Run test-operator unit tests | ||
run: | | ||
make test-operator-test-unit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
push/bin | ||
images/controllers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
controllers/* |
28 changes: 0 additions & 28 deletions
28
...a/images/bundles/test-operator/v1.0.0/manifests/olm.operatorframework.com_olme2etest.yaml
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
...or/v1.0.0/manifests/bundle.configmap.yaml → ...anifests/test-configmap_v1_configmap.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
apiVersion: v1 | ||
data: | ||
name: test-configmap | ||
version: v1.0.0 | ||
kind: ConfigMap | ||
metadata: | ||
name: test-configmap | ||
data: | ||
version: "v1.0.0" | ||
name: "test-configmap" |
141 changes: 141 additions & 0 deletions
141
testdata/images/bundles/test-operator/v1.0.0/manifests/test.clusterserviceversion.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: ClusterServiceVersion | ||
metadata: | ||
annotations: | ||
alm-examples: '[]' | ||
capabilities: Basic Install | ||
operators.operatorframework.io/builder: operator-sdk-v1.34.1 | ||
operators.operatorframework.io/project_layout: unknown | ||
name: test.v1.0.0 | ||
namespace: placeholder | ||
spec: | ||
apiservicedefinitions: {} | ||
customresourcedefinitions: | ||
owned: | ||
- description: TestOperator is the Schema for the testoperators API. | ||
displayName: Test Operator | ||
kind: TestOperator | ||
name: testoperators.testolm.operatorframework.io | ||
version: v1 | ||
description: Test OLM Operator | ||
displayName: OLM Test Operator | ||
icon: | ||
- base64data: "" | ||
mediatype: "" | ||
install: | ||
spec: | ||
clusterPermissions: | ||
- rules: | ||
- apiGroups: | ||
- testolm.operatorframework.io | ||
resources: | ||
- testoperators | ||
verbs: | ||
- create | ||
- delete | ||
- get | ||
- list | ||
- patch | ||
- update | ||
- watch | ||
- apiGroups: | ||
- testolm.operatorframework.io | ||
resources: | ||
- testoperators/finalizers | ||
verbs: | ||
- update | ||
- apiGroups: | ||
- testolm.operatorframework.io | ||
resources: | ||
- testoperators/status | ||
verbs: | ||
- get | ||
- patch | ||
- update | ||
serviceAccountName: test-operator-manager | ||
deployments: | ||
- label: | ||
app.kubernetes.io/name: test-operator | ||
control-plane: controller-manager | ||
name: controller-manager | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: test-operator | ||
control-plane: controller-manager | ||
strategy: {} | ||
template: | ||
metadata: | ||
annotations: | ||
kubectl.kubernetes.io/default-container: manager | ||
labels: | ||
app.kubernetes.io/name: test-operator | ||
control-plane: controller-manager | ||
spec: | ||
containers: | ||
- args: | ||
- --health-probe-bind-address=:8081 | ||
command: | ||
- /manager | ||
env: | ||
- name: WATCH_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.annotations['olm.targetNamespaces'] | ||
image: docker-registry.operator-controller-e2e.svc.cluster.local:5000/controllers/test-operator:v1.0.0 | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: 8081 | ||
initialDelaySeconds: 15 | ||
periodSeconds: 20 | ||
name: manager | ||
readinessProbe: | ||
httpGet: | ||
path: /readyz | ||
port: 8081 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 10 | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 128Mi | ||
requests: | ||
cpu: 10m | ||
memory: 64Mi | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
drop: | ||
- ALL | ||
securityContext: | ||
runAsNonRoot: true | ||
seccompProfile: | ||
type: RuntimeDefault | ||
serviceAccountName: test-operator-manager | ||
terminationGracePeriodSeconds: 10 | ||
strategy: deployment | ||
installModes: | ||
- supported: true | ||
type: OwnNamespace | ||
- supported: true | ||
type: SingleNamespace | ||
- supported: false | ||
type: MultiNamespace | ||
- supported: true | ||
type: AllNamespaces | ||
keywords: | ||
- test | ||
- operator | ||
links: | ||
- name: V1 | ||
url: https://github.com/operator-framework/operator-controller | ||
maintainers: | ||
- email: [email protected] | ||
name: community | ||
maturity: alpha | ||
provider: | ||
name: operator-framework | ||
url: https://github.com/operator-framework/operator-controller | ||
version: 1.0.0 |
61 changes: 61 additions & 0 deletions
61
...es/bundles/test-operator/v1.0.0/manifests/testolm.operatorframework.io_testoperators.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.18.0 | ||
creationTimestamp: null | ||
name: testoperators.testolm.operatorframework.io | ||
spec: | ||
group: testolm.operatorframework.io | ||
names: | ||
kind: TestOperator | ||
listKind: TestOperatorList | ||
plural: testoperators | ||
singular: testoperator | ||
scope: Namespaced | ||
versions: | ||
- name: v1 | ||
schema: | ||
openAPIV3Schema: | ||
description: TestOperator is the Schema for the testoperators API. | ||
properties: | ||
apiVersion: | ||
description: |- | ||
APIVersion defines the versioned schema of this representation of an object. | ||
Servers should convert recognized schemas to the latest internal value, and | ||
may reject unrecognized values. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | ||
type: string | ||
kind: | ||
description: |- | ||
Kind is a string value representing the REST resource this object represents. | ||
Servers may infer this from the endpoint the client submits requests to. | ||
Cannot be updated. | ||
In CamelCase. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: TestOperatorSpec defines the desired state of TestOperator. | ||
properties: | ||
message: | ||
type: string | ||
type: object | ||
status: | ||
description: TestOperatorStatus defines the observed state of TestOperator. | ||
properties: | ||
echo: | ||
type: string | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} | ||
status: | ||
acceptedNames: | ||
kind: "" | ||
plural: "" | ||
conditions: null | ||
storedVersions: null |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Can we discuss the case scenarios:
The test-operator supports AllNamespaces, SingleNamespace, and OwnNamespace install modes.
The DELTA between v1.0.0 and v2.0.0 is clear
V2.0.0 should introduce webhooks
But what is the DELTA between v1.0.0 and v1.3.0
What do we want to cover with v1.3.0?
Do we want to add any changes that would not be a breaking change?
What scenarios do we need to cover?
IHMO it should be:
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.
1.3.0 is just to harmonize with what's already there. It's something that can definitely be revisited. Right now, 2.0.0 includes this configmap. We can probably just collapse it to 1.0.0 and do the check. I think it's just a sanity check to make sure that annotations that include template syntax don't get affected.
Uh oh!
There was an error while loading. Please reload this page.
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.
I think the list you put there is fine. I don't even think we need the 1.1.0 version. We only care about what is in the payload insofar as it interacts with OLM features/behavior. I.e. whether it has network policies, exposes metrics, uses HA, etc. isn't important if it doesn't matter to OLM. We don't need to add the complexity.
When we get to things like probing the state of the installation, or want to test some boxcutter features etc, then I think this will become more necessary. For now, if it stamps out a configmap (or any other resource) just to say it stamped out a resource from the bundle, that's enough imo. I think v1.0.0 and v2.0.0 give us what we need for now.
Uh oh!
There was an error while loading. Please reload this page.
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.
IHMO: It is metter because we must support those configs
We must ensure that OLM works well with NP, and etc