Skip to content

Commit

Permalink
minor updates to GoDoc+API, docs, dependent label selector removed
Browse files Browse the repository at this point in the history
Signed-off-by: everettraven <everettraven@gmail.com>
  • Loading branch information
everettraven committed Oct 4, 2024
1 parent 7d9f296 commit 63e6e73
Show file tree
Hide file tree
Showing 13 changed files with 176 additions and 158 deletions.
19 changes: 8 additions & 11 deletions api/v1alpha1/clusterextension_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,12 @@ const (
TypeChannelDeprecated = "ChannelDeprecated"
TypeBundleDeprecated = "BundleDeprecated"

ReasonSuccess = "Succeeded"
ReasonSucceeded = "Succeeded"
ReasonDeprecated = "Deprecated"
ReasonFailed = "Failed"
ReasonBlocked = "Blocked"
ReasonRetrying = "Retrying"

ReasonErrorGettingClient = "ErrorGettingClient"
ReasonErrorGettingReleaseState = "ErrorGettingReleaseState"

CRDUpgradeSafetyPolicyEnabled CRDUpgradeSafetyPolicy = "Enabled"
CRDUpgradeSafetyPolicyDisabled CRDUpgradeSafetyPolicy = "Disabled"
)
Expand All @@ -447,11 +444,9 @@ func init() {
)
// TODO(user): add Reasons from above
conditionsets.ConditionReasons = append(conditionsets.ConditionReasons,
ReasonSuccess,
ReasonSucceeded,
ReasonDeprecated,
ReasonFailed,
ReasonErrorGettingClient,
ReasonErrorGettingReleaseState,
ReasonBlocked,
ReasonRetrying,
)
Expand Down Expand Up @@ -481,8 +476,7 @@ type ClusterExtensionStatus struct {
//
// The global set of condition types are:
// - "Installed", represents whether or not the a bundle has been installed for this ClusterExtension
// - "Resolved", represents whether or not a bundle was found that satisfies the selection criteria outlined in the spec
// - "Unpacked", represents whether or not the bundle contents have been successfully unpacked
// - "Progressing", represents whether or not the ClusterExtension is progressing towards a new state
//
// When the ClusterExtension is sourced from a catalog, the following conditions are also possible:
// - "Deprecated", represents an aggregation of the PackageDeprecated, ChannelDeprecated, and BundleDeprecated condition types
Expand All @@ -491,8 +485,11 @@ type ClusterExtensionStatus struct {
// - "BundleDeprecated", represents whether or not the installed bundle is deprecated
//
// The current set of reasons are:
// - "Success", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when unpacking a bundle's content, resolution and installation/upgrading is successful
// - "Failed", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when an error has occurred while unpacking the contents of a bundle, during resolution or installation.
// - "Succeeded", this reason is set on the "Installed" and "Progressing" conditions when initial installation and progressing to a new state is successful
// - "Failed", this reason is set on the "Installed" condition when an error has occurred while performing the initial installation.
// - "Blocked", this reason is set on the "Progressing" condition when the ClusterExtension controller has encountered an error that requires manual intervention for recovery
// - "Retrying", this reason is set on the "Progressing" condition when the ClusterExtension controller has encountered an error that could be resolved on subsequent reconciliation attempts
// - "Deprecated", this reason is set on the "Deprecated", "PackageDeprecated", "ChannelDeprecated", and "BundleDeprecated" conditions to signal that the installed package has been deprecated at the particular scope
//
//
// +patchMergeKey=type
Expand Down
11 changes: 1 addition & 10 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
"github.com/spf13/pflag"
apiextensionsv1client "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
k8slabels "k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection"
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
_ "k8s.io/client-go/plugin/pkg/client/auth"
"k8s.io/klog/v2"
Expand All @@ -56,7 +55,6 @@ import (
"github.com/operator-framework/operator-controller/internal/features"
"github.com/operator-framework/operator-controller/internal/finalizers"
"github.com/operator-framework/operator-controller/internal/httputil"
"github.com/operator-framework/operator-controller/internal/labels"
"github.com/operator-framework/operator-controller/internal/resolve"
"github.com/operator-framework/operator-controller/internal/rukpak/preflights/crdupgradesafety"
"github.com/operator-framework/operator-controller/internal/rukpak/source"
Expand Down Expand Up @@ -122,13 +120,6 @@ func main() {
systemNamespace = podNamespace()
}

dependentRequirement, err := k8slabels.NewRequirement(labels.OwnerKindKey, selection.In, []string{ocv1alpha1.ClusterExtensionKind})
if err != nil {
setupLog.Error(err, "unable to create dependent label selector for cache")
os.Exit(1)
}
dependentSelector := k8slabels.NewSelector().Add(*dependentRequirement)

setupLog.Info("set up manager")
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme.Scheme,
Expand All @@ -144,7 +135,7 @@ func main() {
DefaultNamespaces: map[string]crcache.Config{
systemNamespace: {LabelSelector: k8slabels.Everything()},
},
DefaultLabelSelector: dependentSelector,
DefaultLabelSelector: k8slabels.Nothing(),
},
// LeaderElectionReleaseOnCancel defines if the leader should step down voluntarily
// when the Manager ends. This requires the binary to immediately end when the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,7 @@ spec:
The global set of condition types are:
- "Installed", represents whether or not the a bundle has been installed for this ClusterExtension
- "Resolved", represents whether or not a bundle was found that satisfies the selection criteria outlined in the spec
- "Unpacked", represents whether or not the bundle contents have been successfully unpacked
- "Progressing", represents whether or not the ClusterExtension is progressing towards a new state
When the ClusterExtension is sourced from a catalog, the following conditions are also possible:
- "Deprecated", represents an aggregation of the PackageDeprecated, ChannelDeprecated, and BundleDeprecated condition types
Expand All @@ -486,8 +485,11 @@ spec:
- "BundleDeprecated", represents whether or not the installed bundle is deprecated
The current set of reasons are:
- "Success", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when unpacking a bundle's content, resolution and installation/upgrading is successful
- "Failed", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when an error has occurred while unpacking the contents of a bundle, during resolution or installation.
- "Succeeded", this reason is set on the "Installed" and "Progressing" conditions when initial installation and progressing to a new state is successful
- "Failed", this reason is set on the "Installed" condition when an error has occurred while performing the initial installation.
- "Blocked", this reason is set on the "Progressing" condition when the ClusterExtension controller has encountered an error that requires manual intervention for recovery
- "Retrying", this reason is set on the "Progressing" condition when the ClusterExtension controller has encountered an error that could be resolved on subsequent reconciliation attempts
- "Deprecated", this reason is set on the "Deprecated", "PackageDeprecated", "ChannelDeprecated", and "BundleDeprecated" conditions to signal that the installed package has been deprecated at the particular scope
items:
description: Condition contains details for one aspect of the current
state of this API Resource.
Expand Down
2 changes: 1 addition & 1 deletion docs/api-reference/operator-controller-api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ _Appears in:_
| Field | Description | Default | Validation |
| --- | --- | --- | --- |
| `install` _[ClusterExtensionInstallStatus](#clusterextensioninstallstatus)_ | | | |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | conditions is a representation of the current state for this ClusterExtension.<br />The status is represented by a set of "conditions".<br /><br />Each condition is generally structured in the following format:<br /> - Type: a string representation of the condition type. More or less the condition "name".<br /> - Status: a string representation of the state of the condition. Can be one of ["True", "False", "Unknown"].<br /> - Reason: a string representation of the reason for the current state of the condition. Typically useful for building automation around particular Type+Reason combinations.<br /> - Message: a human readable message that further elaborates on the state of the condition<br /><br />The global set of condition types are:<br /> - "Installed", represents whether or not the a bundle has been installed for this ClusterExtension<br /> - "Resolved", represents whether or not a bundle was found that satisfies the selection criteria outlined in the spec<br /> - "Unpacked", represents whether or not the bundle contents have been successfully unpacked<br /><br />When the ClusterExtension is sourced from a catalog, the following conditions are also possible:<br /> - "Deprecated", represents an aggregation of the PackageDeprecated, ChannelDeprecated, and BundleDeprecated condition types<br /> - "PackageDeprecated", represents whether or not the package specified in the spec.source.catalog.packageName field has been deprecated<br /> - "ChannelDeprecated", represents whether or not any channel specified in spec.source.catalog.channels has been deprecated<br /> - "BundleDeprecated", represents whether or not the installed bundle is deprecated<br /><br />The current set of reasons are:<br /> - "Success", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when unpacking a bundle's content, resolution and installation/upgrading is successful<br /> - "Failed", this reason is set on the "Unpacked", "Resolved" and "Installed" conditions when an error has occurred while unpacking the contents of a bundle, during resolution or installation. | | |
| `conditions` _[Condition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#condition-v1-meta) array_ | conditions is a representation of the current state for this ClusterExtension.<br />The status is represented by a set of "conditions".<br /><br />Each condition is generally structured in the following format:<br /> - Type: a string representation of the condition type. More or less the condition "name".<br /> - Status: a string representation of the state of the condition. Can be one of ["True", "False", "Unknown"].<br /> - Reason: a string representation of the reason for the current state of the condition. Typically useful for building automation around particular Type+Reason combinations.<br /> - Message: a human readable message that further elaborates on the state of the condition<br /><br />The global set of condition types are:<br /> - "Installed", represents whether or not the a bundle has been installed for this ClusterExtension<br /> - "Progressing", represents whether or not the ClusterExtension is progressing towards a new state<br /><br />When the ClusterExtension is sourced from a catalog, the following conditions are also possible:<br /> - "Deprecated", represents an aggregation of the PackageDeprecated, ChannelDeprecated, and BundleDeprecated condition types<br /> - "PackageDeprecated", represents whether or not the package specified in the spec.source.catalog.packageName field has been deprecated<br /> - "ChannelDeprecated", represents whether or not any channel specified in spec.source.catalog.channels has been deprecated<br /> - "BundleDeprecated", represents whether or not the installed bundle is deprecated<br /><br />The current set of reasons are:<br /> - "Succeeded", this reason is set on the "Installed" and "Progressing" conditions when initial installation and progressing to a new state is successful<br /> - "Failed", this reason is set on the "Installed" condition when an error has occurred while performing the initial installation.<br /> - "Blocked", this reason is set on the "Progressing" condition when the ClusterExtension controller has encountered an error that requires manual intervention for recovery<br /> - "Retrying", this reason is set on the "Progressing" condition when the ClusterExtension controller has encountered an error that could be resolved on subsequent reconciliation attempts<br /> - "Deprecated", this reason is set on the "Deprecated", "PackageDeprecated", "ChannelDeprecated", and "BundleDeprecated" conditions to signal that the installed package has been deprecated at the particular scope | | |


#### PreflightConfig
Expand Down
10 changes: 5 additions & 5 deletions docs/tutorials/add-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ This catalog is distributed as an image [quay.io/operatorhubio/catalog](https://
API Version: olm.operatorframework.io/v1alpha1
Kind: ClusterCatalog
Metadata:
Creation Timestamp: 2024-03-12T19:34:50Z
Finalizers:
Creation Timestamp: 2024-10-02T19:51:24Z
Finalizers:
olm.operatorframework.io/delete-server-cache
Generation: 2
Resource Version: 6469
UID: 2e2778cb-dda6-4645-96b7-992e8dd37503
Generation: 1
Resource Version: 33321
UID: 52894532-0646-41a5-8285-c7f48bba49e4
Spec:
Priority: 0
Source:
Expand Down
84 changes: 61 additions & 23 deletions docs/tutorials/install-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,35 +103,73 @@ For information on determining the ServiceAccount's permission, please see [Deri

??? success
``` text title="Example output"
Name: my-camel-k
Name: argocd
Namespace:
Labels: <none>
Annotations: <none>
API Version: olm.operatorframework.io/v1alpha1
Kind: ClusterExtension
Metadata:
Creation Timestamp: 2024-03-15T15:03:47Z
Generation: 1
Resource Version: 7691
UID: d756879f-217d-4ebe-85b1-8427bbb2f1df
Creation Timestamp: 2024-10-03T16:02:40Z
Finalizers:
olm.operatorframework.io/cleanup-unpack-cache
olm.operatorframework.io/cleanup-contentmanager-cache
Generation: 2
Resource Version: 1174
UID: 0fcaf3f5-d142-4c7e-8d88-c88a549f7764
Spec:
Package Name: camel-k
Upgrade Constraint Policy: Enforce
Install:
Namespace: argocd
Service Account:
Name: argocd-installer
Source:
Catalog:
Package Name: argocd-operator
Selector:
Upgrade Constraint Policy: CatalogProvided
Version: 0.6.0
Source Type: Catalog
Status:
Conditions:
Last Transition Time: 2024-03-15T15:03:50Z
Message: resolved to "quay.io/operatorhubio/camel-k@sha256:d2b74c43ec8f9294450c9dcf2057be328d0998bb924ad036db489af79d1b39c3"
Observed Generation: 1
Reason: Success
Status: True
Type: Resolved
Last Transition Time: 2024-03-15T15:04:13Z
Message: installed from "quay.io/operatorhubio/camel-k@sha256:d2b74c43ec8f9294450c9dcf2057be328d0998bb924ad036db489af79d1b39c3"
Observed Generation: 1
Reason: Success
Status: True
Type: Installed
Installed Bundle Resource: quay.io/operatorhubio/camel-k@sha256:d2b74c43ec8f9294450c9dcf2057be328d0998bb924ad036db489af79d1b39c3
Resolved Bundle Resource: quay.io/operatorhubio/camel-k@sha256:d2b74c43ec8f9294450c9dcf2057be328d0998bb924ad036db489af79d1b39c3
Events: <none>
Conditions:
Last Transition Time: 2024-10-03T16:02:41Z
Message:
Observed Generation: 2
Reason: Deprecated
Status: False
Type: Deprecated
Last Transition Time: 2024-10-03T16:02:41Z
Message:
Observed Generation: 2
Reason: Deprecated
Status: False
Type: PackageDeprecated
Last Transition Time: 2024-10-03T16:02:41Z
Message:
Observed Generation: 2
Reason: Deprecated
Status: False
Type: ChannelDeprecated
Last Transition Time: 2024-10-03T16:02:41Z
Message:
Observed Generation: 2
Reason: Deprecated
Status: False
Type: BundleDeprecated
Last Transition Time: 2024-10-03T16:02:43Z
Message: Installed bundle quay.io/operatorhubio/argocd-operator@sha256:d538c45a813b38ef0e44f40d279dc2653f97ca901fb660da5d7fe499d51ad3b3 successfully
Observed Generation: 2
Reason: Succeeded
Status: True
Type: Installed
Last Transition Time: 2024-10-03T16:02:43Z
Message: desired state reached
Observed Generation: 2
Reason: Succeeded
Status: False
Type: Progressing
Install:
Bundle:
Name: argocd-operator.v0.6.0
Version: 0.6.0
Events: <none>
```
Loading

0 comments on commit 63e6e73

Please sign in to comment.