Skip to content
Open
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
24 changes: 24 additions & 0 deletions api/.golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1964,6 +1964,30 @@ linters:
- kubeapilinter
path: hypershift/v1beta1/gcpprivateserviceconnect_types.go
text: 'optionalfields: field ForwardingRuleName should be a pointer'
- linters:
- kubeapilinter
path: hypershift/v1beta1/controlplaneversion_types.go
text: 'optionalfields: field ObservedGeneration should be a pointer'
- linters:
- kubeapilinter
path: hypershift/v1beta1/controlplaneversion_types.go
text: 'optionalfields: field CompletionTime should be a pointer'
- linters:
- kubeapilinter
path: hypershift/v1beta1/hosted_controlplane.go
text: 'optionalfields: field ControlPlaneVersion should be a pointer'
- linters:
- kubeapilinter
path: hypershift/v1beta1/hosted_controlplane.go
text: 'optionalfields: field ControlPlaneVersion should have the omitempty tag'
- linters:
- kubeapilinter
path: hypershift/v1beta1/hostedcluster_types.go
text: 'optionalfields: field ControlPlaneVersion should be a pointer'
- linters:
- kubeapilinter
path: hypershift/v1beta1/hostedcluster_types.go
text: 'optionalfields: field ControlPlaneVersion should have the omitempty tag'
- linters:
- kubeapilinter
path: hypershift/v1beta1/gcpprivateserviceconnect_types.go
Expand Down
70 changes: 70 additions & 0 deletions api/hypershift/v1beta1/controlplaneversion_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package v1beta1

import (
configv1 "github.com/openshift/api/config/v1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ControlPlaneVersionStatus tracks the rollout state of management-side control plane components.
// It records the desired release, a pruned history of version transitions (newest first), and
// the last observed generation of the HostedControlPlane spec.
// +k8s:deepcopy-gen=true
type ControlPlaneVersionStatus struct {
// desired is the release version that the control plane is reconciling towards.
// It is derived from the HostedControlPlane release image fields.
// +required
Desired configv1.Release `json:"desired,omitempty,omitzero"`

// history contains a list of versions applied to management-side control plane components. The newest entry is
// first in the list. Entries have state Completed when all ControlPlaneComponent resources report the target
// version with RolloutComplete=True. Entries have state Partial when the rollout is in progress or has failed.
// +optional
// +listType=atomic
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=100
History []ControlPlaneUpdateHistory `json:"history,omitempty"`

// observedGeneration reports which generation of the HostedControlPlane spec is being synced.
// +optional
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=9007199254740992
ObservedGeneration int64 `json:"observedGeneration,omitempty,omitzero"`
}

// ControlPlaneUpdateHistory is a record of a single version transition for management-side
// control plane components. Each entry captures the target version, its release image, when
// the rollout started, and when (or whether) it completed.
// +k8s:deepcopy-gen=true
type ControlPlaneUpdateHistory struct {
// state reflects whether the update was fully applied. The Partial state
// indicates the update is not fully applied, while the Completed state
// indicates the update was successfully rolled out.
// +required
// +kubebuilder:validation:Enum=Completed;Partial
State configv1.UpdateState `json:"state,omitempty"`

// startedTime is the time at which the update was started.
// +required
StartedTime metav1.Time `json:"startedTime,omitempty,omitzero"`

// completionTime is the time at which the update completed. It is set
// when all management-side components have reached the target version.
// It is not set while the update is in progress.
// +optional
CompletionTime metav1.Time `json:"completionTime,omitempty,omitzero"`

// version is a semantic version string identifying the update version
// (e.g. "4.20.1").
// +required
// +kubebuilder:validation:XValidation:rule=`self.matches('^\\d+\\.\\d+\\.\\d+.*')`,message="version must start with semantic version prefix x.y.z"
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=64
Version string `json:"version,omitempty"`

// image is the release image pullspec used for this update.
// +required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=447
Image string `json:"image,omitempty"`
}
6 changes: 6 additions & 0 deletions api/hypershift/v1beta1/hosted_controlplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,12 @@ type HostedControlPlaneStatus struct {
// +kubebuilder:validation:MaxLength=255
OAuthCallbackURLTemplate string `json:"oauthCallbackURLTemplate,omitempty"`

// controlPlaneVersion tracks the rollout status of the control plane
// components running on the management cluster, independently from
// the data-plane version reported in the version field.
// +optional
ControlPlaneVersion ControlPlaneVersionStatus `json:"controlPlaneVersion,omitzero"`

// versionStatus is the status of the release version applied by the
// hosted control plane operator.
// +optional
Expand Down
9 changes: 9 additions & 0 deletions api/hypershift/v1beta1/hostedcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,12 @@ type HostedClusterStatus struct {
// +kubebuilder:validation:MaxItems=100
Conditions []metav1.Condition `json:"conditions,omitempty"`

// controlPlaneVersion tracks the rollout status of the control plane
// components running on the management cluster, independently from
// the data-plane version reported in the version field.
// +optional
ControlPlaneVersion ControlPlaneVersionStatus `json:"controlPlaneVersion,omitzero"`

// version is the status of the release version applied to the
// HostedCluster.
// +optional
Expand Down Expand Up @@ -2018,11 +2024,14 @@ type OperatorConfiguration struct {
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version.history[?(@.state==\"Completed\")].version",description="Version"
// +kubebuilder:printcolumn:name="CP Version",type="string",JSONPath=".status.controlPlaneVersion.history[?(@.state==\"Completed\")].version",description="Control Plane Version"
// +kubebuilder:printcolumn:name="KubeConfig",type="string",JSONPath=".status.kubeconfig.name",description="KubeConfig Secret"
// +kubebuilder:printcolumn:name="Progress",type="string",JSONPath=".status.version.history[?(@.state!=\"\")].state",description="Progress"
// +kubebuilder:printcolumn:name="Available",type="string",JSONPath=".status.conditions[?(@.type==\"Available\")].status",description="Available"
// +kubebuilder:printcolumn:name="Progressing",type="string",JSONPath=".status.conditions[?(@.type==\"Progressing\")].status",description="Progressing"
// +kubebuilder:printcolumn:name="Message",type="string",JSONPath=".status.conditions[?(@.type==\"Available\")].message",description="Message"
// +kubebuilder:printcolumn:name="CP Progress",type="string",JSONPath=".status.controlPlaneVersion.history[0].state",description="Control Plane Progress",priority=1
// +kubebuilder:printcolumn:name="DP Progress",type="string",JSONPath=".status.version.history[0].state",description="Data Plane Progress",priority=1
type HostedCluster struct {
metav1.TypeMeta `json:",inline"`
// metadata is the metadata for the HostedCluster.
Expand Down
42 changes: 42 additions & 0 deletions api/hypershift/v1beta1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ hostedclusters.hypershift.openshift.io:
jsonPath: .status.version.history[?(@.state=="Completed")].version
name: Version
type: string
- description: Control Plane Version
jsonPath: .status.controlPlaneVersion.history[?(@.state=="Completed")].version
name: CP Version
type: string
- description: KubeConfig Secret
jsonPath: .status.kubeconfig.name
name: KubeConfig
Expand All @@ -175,6 +179,16 @@ hostedclusters.hypershift.openshift.io:
jsonPath: .status.conditions[?(@.type=="Available")].message
name: Message
type: string
- description: Control Plane Progress
jsonPath: .status.controlPlaneVersion.history[0].state
name: CP Progress
priority: 1
type: string
- description: Data Plane Progress
jsonPath: .status.version.history[0].state
name: DP Progress
priority: 1
type: string
Scope: Namespaced
ShortNames:
- hc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ spec:
jsonPath: .status.version.history[?(@.state=="Completed")].version
name: Version
type: string
- description: Control Plane Version
jsonPath: .status.controlPlaneVersion.history[?(@.state=="Completed")].version
name: CP Version
type: string
- description: KubeConfig Secret
jsonPath: .status.kubeconfig.name
name: KubeConfig
Expand All @@ -41,6 +45,16 @@ spec:
jsonPath: .status.conditions[?(@.type=="Available")].message
name: Message
type: string
- description: Control Plane Progress
jsonPath: .status.controlPlaneVersion.history[0].state
name: CP Progress
priority: 1
type: string
- description: Data Plane Progress
jsonPath: .status.version.history[0].state
name: DP Progress
priority: 1
type: string
name: v1beta1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -6146,6 +6160,117 @@ spec:
- host
- port
type: object
controlPlaneVersion:
description: |-
controlPlaneVersion tracks the rollout status of the control plane
components running on the management cluster, independently from
the data-plane version reported in the version field.
properties:
desired:
description: |-
desired is the release version that the control plane is reconciling towards.
It is derived from the HostedControlPlane release image fields.
properties:
channels:
description: |-
channels is the set of Cincinnati channels to which the release
currently belongs.
items:
type: string
type: array
x-kubernetes-list-type: set
image:
description: |-
image is a container image location that contains the update. When this
field is part of spec, image is optional if version is specified and the
availableUpdates field contains a matching version.
type: string
url:
description: |-
url contains information about this release. This URL is set by
the 'url' metadata property on a release or the metadata returned by
the update API and should be displayed as a link in user
interfaces. The URL field may not be set for test or nightly
releases.
type: string
version:
description: |-
version is a semantic version identifying the update version. When this
field is part of spec, version is optional if image is specified.
type: string
required:
- image
- version
type: object
history:
description: |-
history contains a list of versions applied to management-side control plane components. The newest entry is
first in the list. Entries have state Completed when all ControlPlaneComponent resources report the target
version with RolloutComplete=True. Entries have state Partial when the rollout is in progress or has failed.
items:
description: |-
ControlPlaneUpdateHistory is a record of a single version transition for management-side
control plane components. Each entry captures the target version, its release image, when
the rollout started, and when (or whether) it completed.
properties:
completionTime:
description: |-
completionTime is the time at which the update completed. It is set
when all management-side components have reached the target version.
It is not set while the update is in progress.
format: date-time
type: string
image:
description: image is the release image pullspec used for
this update.
maxLength: 447
minLength: 1
type: string
startedTime:
description: startedTime is the time at which the update
was started.
format: date-time
type: string
state:
description: |-
state reflects whether the update was fully applied. The Partial state
indicates the update is not fully applied, while the Completed state
indicates the update was successfully rolled out.
enum:
- Completed
- Partial
type: string
version:
description: |-
version is a semantic version string identifying the update version
(e.g. "4.20.1").
maxLength: 64
minLength: 1
type: string
x-kubernetes-validations:
- message: version must start with semantic version prefix
x.y.z
rule: self.matches('^\\d+\\.\\d+\\.\\d+.*')
required:
- image
- startedTime
- state
- version
type: object
maxItems: 100
minItems: 1
type: array
x-kubernetes-list-type: atomic
observedGeneration:
description: observedGeneration reports which generation of the
HostedControlPlane spec is being synced.
format: int64
maximum: 9007199254740992
minimum: 1
type: integer
required:
- desired
type: object
customKubeconfig:
description: |-
customKubeconfig is a local secret reference to the external custom kubeconfig.
Expand Down
Loading