Skip to content

Commit 6a84a2e

Browse files
committed
[OTA-1545] Extend ClusterVersion for accepted risks
- Add a new field 'clusterversion.spec.desiredUpdate.accept': It contains the names of conditional update risks that are considered acceptable. - Move `clusterversion.status.conditionalUpdates.risks` two levels up as `clusterversion.status.conditionalUpdateRisks`. It contains all the risks for `clusterversion.status.conditionalUpdates`. - Add a new field 'clusterversion.status.conditionalUpdates.riskNames': It contains the names of risk for the conditional update. It deprecates `clusterversion.status.conditionalUpdates.risks`. - Adds a new field 'clusterversion.status.conditionalUpdateRisks.conditions': It contains the observations of the conditional update risk's current status.
1 parent a0fb5f4 commit 6a84a2e

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

config/v1/types_cluster_version.go

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,18 @@ type ClusterVersionStatus struct {
199199
// +listType=atomic
200200
// +optional
201201
ConditionalUpdates []ConditionalUpdate `json:"conditionalUpdates,omitempty"`
202+
203+
// conditionalUpdateRisks represents issues for ConditionalUpdates.
204+
// The cluster-version operator will evaluate all risks associated to a conditional
205+
// update when it is the desired update and only accept it if all its associated
206+
// risks are in "spec.desiredUpdate.accept".
207+
// +kubebuilder:validation:MaxItems=1000
208+
// +patchMergeKey=name
209+
// +patchStrategy=merge
210+
// +listType=map
211+
// +listMapKey=name
212+
// +optional
213+
ConditionalUpdateRisks []ConditionalUpdateRisk `json:"conditionalUpdateRisks,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
202214
}
203215

204216
// UpdateState is a constant representing whether an update was successfully
@@ -255,10 +267,11 @@ type UpdateHistory struct {
255267
Verified bool `json:"verified"`
256268

257269
// acceptedRisks records risks which were accepted to initiate the update.
258-
// For example, it may menition an Upgradeable=False or missing signature
259-
// that was overriden via desiredUpdate.force, or an update that was
270+
// For example, it may mention an Upgradeable=False or missing signature
271+
// that was overridden via desiredUpdate.force, or an update that was
260272
// initiated despite not being in the availableUpdates set of recommended
261-
// update targets.
273+
// update targets, or in the conditionUpdates set and all associated risks
274+
// are specified in "spec.desiredUpdate.accept".
262275
// +optional
263276
AcceptedRisks string `json:"acceptedRisks,omitempty"`
264277
}
@@ -725,6 +738,15 @@ type Update struct {
725738
//
726739
// +optional
727740
Force bool `json:"force"`
741+
742+
// accept allows an administrator to specify the names of ConditionalUpdateRisk
743+
// those are considered acceptable. A conditional update is accepted by Cluster-Version
744+
// operator only if all of its risks are acceptable.
745+
//
746+
// +kubebuilder:validation:items:MaxLength=256
747+
// +kubebuilder:validation:MaxItems=1000
748+
// +optional
749+
Accept []string `json:"accept"`
728750
}
729751

730752
// Release represents an OpenShift release image and associated metadata.
@@ -780,11 +802,25 @@ type ConditionalUpdate struct {
780802
// +required
781803
Release Release `json:"release"`
782804

805+
// riskNames represents names of status.conditionalUpdateRisks
806+
// that are associated with the release in a ConditionalUpdate.
807+
// The cluster-version operator will evaluate these risks and only
808+
// accept the update if there is at least one risk and for every risk
809+
// it is either not applied to the cluster or considered acceptable
810+
// by the cluster administrator.
811+
// +kubebuilder:validation:items:MaxLength=256
812+
// +kubebuilder:validation:MaxItems=100
813+
// +kubebuilder:validation:MinItems=1
814+
// +listType=set
815+
// +required
816+
RiskNames []string `json:"riskNames"`
817+
783818
// risks represents the range of issues associated with
784819
// updating to the target release. The cluster-version
785820
// operator will evaluate all entries, and only recommend the
786821
// update if there is at least one entry and all entries
787822
// recommend the update.
823+
// DEPRECATED: the risks has been deprecated by riskNames and will be removed in a future release.
788824
// +kubebuilder:validation:MinItems=1
789825
// +patchMergeKey=name
790826
// +patchStrategy=merge
@@ -806,6 +842,15 @@ type ConditionalUpdate struct {
806842
// for not recommending a conditional update.
807843
// +k8s:deepcopy-gen=true
808844
type ConditionalUpdateRisk struct {
845+
// conditions represents the observations of the conditional update
846+
// risk's current status. Known types are:
847+
// * Apply, for whether the risk is applied to the current cluster.
848+
// +kubebuilder:validation:MaxItems=16
849+
// +listType=map
850+
// +listMapKey=type
851+
// +optional
852+
Conditions []metav1.Condition `json:"conditions,omitempty"`
853+
809854
// url contains information about this risk.
810855
// +kubebuilder:validation:Format=uri
811856
// +kubebuilder:validation:MinLength=1

0 commit comments

Comments
 (0)