Skip to content

Commit 76c9227

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 new field 'clusterversion.status.conditionalUpdates.riskNames': It contains the names of risk for the conditional update. It deprecates `clusterversion.status.conditionalUpdates.risks`. - Add a new field 'clusterversion.status.conditionalUpdateRisks.conditions': It contains the observations of the conditional update risk's current status.
1 parent a0fb5f4 commit 76c9227

File tree

1 file changed

+49
-4
lines changed

1 file changed

+49
-4
lines changed

config/v1/types_cluster_version.go

Lines changed: 49 additions & 4 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 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 desiredUpdate.accept.
262275
// +optional
263276
AcceptedRisks string `json:"acceptedRisks,omitempty"`
264277
}
@@ -725,6 +738,16 @@ 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+
// +listType=set
749+
// +optional
750+
Accept []string `json:"accept"`
728751
}
729752

730753
// Release represents an OpenShift release image and associated metadata.
@@ -780,17 +803,30 @@ type ConditionalUpdate struct {
780803
// +required
781804
Release Release `json:"release"`
782805

806+
// riskNames represents names of ClusterVersionStatus.ConditionalUpdateRisks
807+
// that are exposed to the release in a ConditionalUpdate.
808+
// The cluster-version operator will evaluate these risks and only
809+
// accept the update if there is at least one risk and for every risk
810+
// it is either not applied to the cluster or considered acceptable
811+
// by the cluster administrator.
812+
// +kubebuilder:validation:items:MaxLength=256
813+
// +kubebuilder:validation:MaxItems=100
814+
// +listType=set
815+
// +optional
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
791827
// +listType=map
792828
// +listMapKey=name
793-
// +required
829+
// +optional
794830
Risks []ConditionalUpdateRisk `json:"risks" patchStrategy:"merge" patchMergeKey:"name"`
795831

796832
// conditions represents the observations of the conditional update's
@@ -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)