Skip to content
Draft
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
16 changes: 15 additions & 1 deletion api/v1/clusterextension_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,14 @@ type BundleMetadata struct {
Version string `json:"version"`
}

type RevisionStatus struct {
Name string `json:"name"`
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// ClusterExtensionStatus defines the observed state of a ClusterExtension.
type ClusterExtensionStatus struct {
// The set of condition types which apply to all spec.source variations are Installed and Progressing.
Expand Down Expand Up @@ -498,6 +506,12 @@ type ClusterExtensionStatus struct {
//
// +optional
Install *ClusterExtensionInstallStatus `json:"install,omitempty"`

// +listType=map
// +listMapKey=name
// +optional
// <opcon:experimental>
ActiveRevisions []RevisionStatus `json:"activeRevisions,omitempty"`
}

// ClusterExtensionInstallStatus is a representation of the status of the identified bundle.
Expand All @@ -516,7 +530,7 @@ type ClusterExtensionInstallStatus struct {
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Installed Bundle",type=string,JSONPath=`.status.install.bundle.name`
// +kubebuilder:printcolumn:name=Version,type=string,JSONPath=`.status.install.bundle.version`
// +kubebuilder:printcolumn:name="Installed",type=string,JSONPath=`.status.conditions[?(@.type=='Installed')].status`
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.conditions[?(@.type=='Available')].status`
// +kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=`.status.conditions[?(@.type=='Progressing')].status`
// +kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`

Expand Down
51 changes: 49 additions & 2 deletions api/v1/clusterextensionrevision_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1

import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/types"
Expand All @@ -26,8 +27,9 @@ const (
ClusterExtensionRevisionKind = "ClusterExtensionRevision"

// Condition Types
ClusterExtensionRevisionTypeAvailable = "Available"
ClusterExtensionRevisionTypeSucceeded = "Succeeded"
ClusterExtensionRevisionTypeAvailable = "Available"
ClusterExtensionRevisionTypeSucceeded = "Succeeded"
ClusterExtensionRevisionTypeProgressing = "Progressing"

// Condition Reasons
ClusterExtensionRevisionReasonAvailable = "Available"
Expand All @@ -37,9 +39,13 @@ const (
ClusterExtensionRevisionReasonObjectCollisions = "ObjectCollisions"
ClusterExtensionRevisionReasonRolloutSuccess = "RolloutSuccess"
ClusterExtensionRevisionReasonProbeFailure = "ProbeFailure"
ClusterExtensionRevisionReasonProbesSucceeded = "ProbesSucceeded"
ClusterExtensionRevisionReasonIncomplete = "Incomplete"
ClusterExtensionRevisionReasonProgressing = "Progressing"
ClusterExtensionRevisionReasonArchived = "Archived"
ClusterExtensionRevisionReasonRolloutInProgress = "RollingOut"
ClusterExtensionRevisionReasonRolloutError = "RolloutError"
ClusterExtensionRevisionReasonRolledOut = "RolledOut"
)

// ClusterExtensionRevisionSpec defines the desired state of ClusterExtensionRevision.
Expand Down Expand Up @@ -150,6 +156,7 @@ type ClusterExtensionRevisionStatus struct {

// ClusterExtensionRevision is the Schema for the clusterextensionrevisions API
// +kubebuilder:printcolumn:name="Available",type=string,JSONPath=`.status.conditions[?(@.type=='Available')].status`
// +kubebuilder:printcolumn:name="Progressing",type=string,JSONPath=`.status.conditions[?(@.type=='Progressing')].status`
// +kubebuilder:printcolumn:name=Age,type=date,JSONPath=`.metadata.creationTimestamp`
type ClusterExtensionRevision struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -164,6 +171,46 @@ type ClusterExtensionRevision struct {
Status ClusterExtensionRevisionStatus `json:"status,omitempty"`
}

func (cer *ClusterExtensionRevision) MarkAsProgressing(reason, message string) {
meta.SetStatusCondition(&cer.Status.Conditions, metav1.Condition{
Type: ClusterExtensionRevisionTypeProgressing,
Status: metav1.ConditionTrue,
Reason: reason,
Message: message,
ObservedGeneration: cer.Generation,
})
}

func (cer *ClusterExtensionRevision) MarkAsNotProgressing(reason, message string) {
meta.SetStatusCondition(&cer.Status.Conditions, metav1.Condition{
Type: ClusterExtensionRevisionTypeProgressing,
Status: metav1.ConditionFalse,
Reason: reason,
Message: message,
ObservedGeneration: cer.Generation,
})
}

func (cer *ClusterExtensionRevision) MarkAsAvailable(reason, message string) {
meta.SetStatusCondition(&cer.Status.Conditions, metav1.Condition{
Type: ClusterExtensionRevisionTypeAvailable,
Status: metav1.ConditionTrue,
Reason: reason,
Message: message,
ObservedGeneration: cer.Generation,
})
}

func (cer *ClusterExtensionRevision) MarkAsUnavailable(reason, message string) {
meta.SetStatusCondition(&cer.Status.Conditions, metav1.Condition{
Type: ClusterExtensionRevisionTypeAvailable,
Status: metav1.ConditionFalse,
Reason: reason,
Message: message,
ObservedGeneration: cer.Generation,
})
}

// +kubebuilder:object:root=true

// ClusterExtensionRevisionList contains a list of ClusterExtensionRevision
Expand Down
29 changes: 29 additions & 0 deletions api/v1/zz_generated.deepcopy.go

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

16 changes: 16 additions & 0 deletions cmd/operator-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,14 @@ func setupBoxcutter(
ActionClientGetter: acg,
RevisionGenerator: rg,
}
ceReconciler.ReconcileSteps = []controllers.ReconcileStepFunc{
controllers.HandleFinalizers(ceReconciler.Finalizers),
controllers.MigrateStorage(ceReconciler.StorageMigrator),
controllers.RetrieveRevisionStates(ceReconciler.RevisionStatesGetter),
controllers.RetrieveRevisionMetadata(ceReconciler.Resolver),
controllers.UnpackBundle(ceReconciler.ImagePuller, ceReconciler.ImageCache),
controllers.ApplyBundleWithBoxcutter(ceReconciler.Applier),
}

discoveryClient, err := discovery.NewDiscoveryClientForConfig(mgr.GetConfig())
if err != nil {
Expand Down Expand Up @@ -679,6 +687,14 @@ func setupHelm(
Manager: cm,
}
ceReconciler.RevisionStatesGetter = &controllers.HelmRevisionStatesGetter{ActionClientGetter: acg}
ceReconciler.ReconcileSteps = []controllers.ReconcileStepFunc{
controllers.HandleFinalizers(ceReconciler.Finalizers),
controllers.RetrieveRevisionStates(ceReconciler.RevisionStatesGetter),
controllers.RetrieveRevisionMetadata(ceReconciler.Resolver),
controllers.UnpackBundle(ceReconciler.ImagePuller, ceReconciler.ImageCache),
controllers.ApplyBundle(ceReconciler.Applier),
}

return nil
}

Expand Down
18 changes: 18 additions & 0 deletions docs/api-reference/olmv1-api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ _Appears in:_
| --- | --- | --- | --- |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | The set of condition types which apply to all spec.source variations are Installed and Progressing.<br /><br />The Installed condition represents whether or not the bundle has been installed for this ClusterExtension.<br />When Installed is True and the Reason is Succeeded, the bundle has been successfully installed.<br />When Installed is False and the Reason is Failed, the bundle has failed to install.<br /><br />The Progressing condition represents whether or not the ClusterExtension is advancing towards a new state.<br />When Progressing is True and the Reason is Succeeded, the ClusterExtension is making progress towards a new state.<br />When Progressing is True and the Reason is Retrying, the ClusterExtension has encountered an error that could be resolved on subsequent reconciliation attempts.<br />When Progressing is False and the Reason is Blocked, the ClusterExtension has encountered an error that requires manual intervention for recovery.<br /><br />When the ClusterExtension is sourced from a catalog, if may also communicate a deprecation condition.<br />These are indications from a package owner to guide users away from a particular package, channel, or bundle.<br />BundleDeprecated is set if the requested bundle version is marked deprecated in the catalog.<br />ChannelDeprecated is set if the requested channel is marked deprecated in the catalog.<br />PackageDeprecated is set if the requested package is marked deprecated in the catalog.<br />Deprecated is a rollup condition that is present when any of the deprecated conditions are present. | | |
| `install` _[ClusterExtensionInstallStatus](#clusterextensioninstallstatus)_ | install is a representation of the current installation status for this ClusterExtension. | | |
| `activeRevisions` _[RevisionStatus](#revisionstatus) array_ | <opcon:experimental> | | |



Expand Down Expand Up @@ -436,6 +437,23 @@ _Appears in:_
| `ref` _string_ | ref contains the resolved image digest-based reference.<br />The digest format is used so users can use other tooling to fetch the exact<br />OCI manifests that were used to extract the catalog contents. | | MaxLength: 1000 <br />Required: \{\} <br /> |


#### RevisionStatus







_Appears in:_
- [ClusterExtensionStatus](#clusterextensionstatus)

| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `name` _string_ | | | |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | | | |


#### ServiceAccountReference


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ spec:
- jsonPath: .status.conditions[?(@.type=='Available')].status
name: Available
type: string
- jsonPath: .status.conditions[?(@.type=='Progressing')].status
name: Progressing
type: string
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ spec:
- jsonPath: .status.install.bundle.version
name: Version
type: string
- jsonPath: .status.conditions[?(@.type=='Installed')].status
name: Installed
- jsonPath: .status.conditions[?(@.type=='Available')].status
name: Available
type: string
- jsonPath: .status.conditions[?(@.type=='Progressing')].status
name: Progressing
Expand Down Expand Up @@ -505,6 +505,78 @@ spec:
description: status is an optional field that defines the observed state
of the ClusterExtension.
properties:
activeRevisions:
items:
properties:
conditions:
items:
description: Condition contains details for one aspect of
the current state of this API Resource.
properties:
lastTransitionTime:
description: |-
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: |-
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: |-
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: |-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False,
Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
x-kubernetes-list-map-keys:
- type
x-kubernetes-list-type: map
name:
type: string
required:
- name
type: object
type: array
x-kubernetes-list-map-keys:
- name
x-kubernetes-list-type: map
conditions:
description: |-
The set of condition types which apply to all spec.source variations are Installed and Progressing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ spec:
- jsonPath: .status.install.bundle.version
name: Version
type: string
- jsonPath: .status.conditions[?(@.type=='Installed')].status
name: Installed
- jsonPath: .status.conditions[?(@.type=='Available')].status
name: Available
type: string
- jsonPath: .status.conditions[?(@.type=='Progressing')].status
name: Progressing
Expand Down
2 changes: 0 additions & 2 deletions internal/operator-controller/applier/boxcutter.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,6 @@ func (bc *Boxcutter) apply(ctx context.Context, contentFS fs.FS, ext *ocv1.Clust
return false, "New revision created", nil
} else if progressingCondition != nil && progressingCondition.Status == metav1.ConditionTrue {
return false, progressingCondition.Message, nil
} else if availableCondition != nil && availableCondition.Status != metav1.ConditionTrue {
return false, "", errors.New(availableCondition.Message)
} else if succeededCondition != nil && succeededCondition.Status != metav1.ConditionTrue {
return false, succeededCondition.Message, nil
}
Expand Down
Loading
Loading