-
Notifications
You must be signed in to change notification settings - Fork 544
add .status.relatedObjects to clusterversion to get CVO references #2339
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: master
Are you sure you want to change the base?
Changes from all commits
1cd8717
aaf5b96
0ce563c
7943458
23e47a4
5933f49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if we don't have this | ||
name: "ClusterVersion" | ||
crdName: clusterversions.config.openshift.io | ||
featureGates: | ||
- CVORelatedObjects | ||
tests: | ||
onCreate: | ||
- name: Should be able to create a minimal ClusterVersion | ||
initial: | | ||
apiVersion: config.openshift.io/v1 | ||
kind: ClusterVersion | ||
spec: | ||
clusterID: foo | ||
expected: | | ||
apiVersion: config.openshift.io/v1 | ||
kind: ClusterVersion | ||
spec: | ||
clusterID: foo | ||
onUpdate: | ||
- name: .status.relatedObjects namespace default should be empty | ||
initial: | | ||
apiVersion: config.openshift.io/v1 | ||
kind: ClusterVersion | ||
spec: | ||
clusterID: foo | ||
status: | ||
desired: | ||
version: foo | ||
image: foo | ||
architecture: Multi | ||
observedGeneration: 1 | ||
versionHash: foo | ||
availableUpdates: | ||
- version: foo | ||
image: foo | ||
updated: | | ||
apiVersion: config.openshift.io/v1 | ||
kind: ClusterVersion | ||
spec: | ||
clusterID: foo | ||
status: | ||
desired: | ||
version: foo | ||
image: foo | ||
architecture: Multi | ||
observedGeneration: 1 | ||
versionHash: foo | ||
availableUpdates: | ||
- version: foo | ||
image: foo | ||
relatedObjects: | ||
- group: g1 | ||
resource: r1 | ||
name: n1 | ||
expected: | | ||
apiVersion: config.openshift.io/v1 | ||
kind: ClusterVersion | ||
spec: | ||
clusterID: foo | ||
status: | ||
desired: | ||
version: foo | ||
image: foo | ||
architecture: Multi | ||
observedGeneration: 1 | ||
versionHash: foo | ||
availableUpdates: | ||
- version: foo | ||
image: foo | ||
relatedObjects: | ||
- group: g1 | ||
resource: r1 | ||
namespace: ns1 | ||
name: n1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,6 +199,21 @@ type ClusterVersionStatus struct { | |
// +listType=atomic | ||
// +optional | ||
ConditionalUpdates []ConditionalUpdate `json:"conditionalUpdates,omitempty"` | ||
|
||
// relatedObjects is a list of objects that are "interesting" or related to this operator. | ||
// `oc adm inspect` honors this field in any type to navigate and collect related data. | ||
// Common uses are: | ||
// 1. operator namespaces | ||
// 2. operand namespaces | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We obviously want to include the |
||
// +optional | ||
// +openshift:enable:FeatureGate=CVORelatedObjects | ||
// +kubebuilder:validation:MaxItems=100 | ||
// +listType=map | ||
// +listMapKey=group | ||
// +listMapKey=resource | ||
// +listMapKey=namespace | ||
// +listMapKey=name | ||
RelatedObjects []ObjectReference `json:"relatedObjects,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Will do. Consideration for our future, will we fix the existing usages too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If they're in status, I would expect we are already doing the right thing and so should be fine to fix it I also assume these would ratchet 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh very neat. I think you can only make map keys on required fields and not all the fields are logically required. I might go with atomic (single writer of this thing anyway) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes I agree, the required ones are If you don't have the listType enforcing the uniqueness, how about CEL? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For reference, the incantation is
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. List should set a sensible maximum length, given intended use case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm so glad I insisted on these linters :) |
||
} | ||
|
||
// UpdateState is a constant representing whether an update was successfully | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
Should be the empty string?