Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,11 @@ spec:
type: string
minLength: 1
name:
description: name is the CamelCase reason for not recommending a conditional update, in the event that matchingRules match the cluster state.
description: name is the CamelCase reason for not recommending a conditional update, in the event that matchingRules match the cluster state. Can be used as a reason in a Condition.
type: string
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
url:
description: url contains information about this risk.
type: string
Expand Down
4 changes: 3 additions & 1 deletion config/v1/types_cluster_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,9 +644,11 @@ type ConditionalUpdateRisk struct {

// name is the CamelCase reason for not recommending a
// conditional update, in the event that matchingRules match the
// cluster state.
// cluster state. Can be used as a reason in a Condition.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MaxLength=1024
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:Pattern=`^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm conflicted about this. If we accept that the update service can serve risks with non-compliant names, then we can:

a. Land this regexp. Drop the risk (silently for now, eventually triggering CannotEvaluateConditionalUpdates to warn the admin). You'd have to do this for all clusters, not just clusters where the risk applied.
b. Land this regexp. Squash any non-compliant names into compliant names before writing the risk.
c. Drop this API change. Accept the risk with the non-compliant name, and squash it into something compliant when we translate to the Recommended reason (if we end up wanting to involve the risk's name because we assess it as the only valid risk).

I'm personally leaning towards (c), because fewer clusters are impacted (only clusters where the non-compliant risk is the only risk assessed to apply), and because I like complaining in status instead of relying on alerts alone. But this pull request's current (a) is more aligned with our existing status enum precedent, where the Kube API server doesn't trust the CVO to write solid data. And (b) hides the "hey, we wish the update service was using a better name for this risk" condition while (c) makes that more obvious just from status.

I'm not terribly committed though, so I'm ok with what you have here if my cost/benefit breakdown isn't convincing ;)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I currently like (c) the best too. I filed openshift/cluster-version-operator#962 that follows that path (including some refactors so that the change is easier to test). That PR just operates in the same area like openshift/cluster-version-operator#964 which is more important to merge and I will need to rebase #962 on top of it.

// +required
Name string `json:"name"`

Expand Down
2 changes: 1 addition & 1 deletion config/v1/zz_generated.swagger_doc_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion openapi/generated_openapi/zz_generated.openapi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -5498,7 +5498,7 @@
"default": ""
},
"name": {
"description": "name is the CamelCase reason for not recommending a conditional update, in the event that matchingRules match the cluster state.",
"description": "name is the CamelCase reason for not recommending a conditional update, in the event that matchingRules match the cluster state. Can be used as a reason in a Condition.",
"type": "string",
"default": ""
},
Expand Down