Skip to content

Commit 52c4020

Browse files
authored
add new value no-op in installmode replace supportStatus (#909)
* add new value no-op in installmode Signed-off-by: YuChen <[email protected]> * add preserve unknown field Signed-off-by: YuChen <[email protected]> * move preserve unknown field position Signed-off-by: YuChen <[email protected]> * update golangci-lint-version Signed-off-by: YuChen <[email protected]> --------- Signed-off-by: YuChen <[email protected]>
1 parent fc2994c commit 52c4020

File tree

6 files changed

+18
-42
lines changed

6 files changed

+18
-42
lines changed

api/v1alpha1/operandregistry_types.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
2828

2929
// Operator defines the desired state of Operators.
30+
// +kubebuilder:pruning:PreserveUnknownFields
3031
type Operator struct {
3132
// A unique name for the operator whose operand may be deployed.
3233
Name string `json:"name"`
@@ -40,6 +41,7 @@ type Operator struct {
4041
// Valid values are:
4142
// - "namespace" (default): operator is deployed in namespace of OperandRegistry;
4243
// - "cluster": operator is deployed in "openshift-operators" namespace;
44+
// - "no-op": operator is not supported to be fresh deployed;
4345
// +optional
4446
InstallMode string `json:"installMode,omitempty"`
4547
// The namespace in which operator should be deployed when InstallMode is empty or set to "namespace".
@@ -71,12 +73,6 @@ type Operator struct {
7173
// SubscriptionConfig is used to override operator configuration.
7274
// +optional
7375
SubscriptionConfig *olmv1alpha1.SubscriptionConfig `json:"subscriptionConfig,omitempty"`
74-
// SupportStatus is used to indicate the support status for services.
75-
// Valid values are:
76-
// - "continuous" (default): operator is supported to be fresh deployed via OperandRequest from scratch
77-
// - "maintained" operator is not supported to be fresh deployed via OperandRequest, only upgrade and deletion are allowed
78-
// +optional
79-
SupportStatus string `json:"supportStatus,omitempty"`
8076
}
8177

8278
// +kubebuilder:validation:Enum=public;private
@@ -96,13 +92,8 @@ const (
9692
InstallModeCluster string = "cluster"
9793
// InstallModeNamespace means install the operator in one namespace mode.
9894
InstallModeNamespace string = "namespace"
99-
)
100-
101-
const (
102-
// MaintainedSupportStatus means NOT supporting fresh deployment for the operator
103-
MaintainedSupportStatus string = "maintained"
104-
// ContinuousSupportStatus means supporting fresh deployment for the operator
105-
ContinuousSupportStatus string = "continuous"
95+
// InstallModeNoop means not create the subscription for the operator
96+
InstallModeNoop string = "no-op"
10697
)
10798

10899
// OperandRegistrySpec defines the desired state of OperandRegistry.

bundle/manifests/operator.ibm.com_operandregistries.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ spec:
6363
description: Description of a common service.
6464
type: string
6565
installMode:
66-
description: 'The install mode of an operator, either namespace
67-
or cluster. Valid values are: - "namespace" (default): operator
66+
description: 'The install mode of an operator, could be namespace,
67+
cluster or no-op. Valid values are: - "namespace" (default): operator
6868
is deployed in namespace of OperandRegistry; - "cluster":
69-
operator is deployed in "openshift-operators" namespace;'
69+
operator is deployed in "openshift-operators" namespace; - "no-op":
70+
operator is not supported to be fresh deployed via OperandRequest,
71+
only upgrade and deletion are allowed;'
7072
type: string
7173
installPlanApproval:
7274
description: 'Approval mode for emitted InstallPlans. Valid
@@ -2026,14 +2028,6 @@ spec:
20262028
type: object
20272029
type: array
20282030
type: object
2029-
supportStatus:
2030-
description: 'SupportStatus is used to indicate the support
2031-
status for services. Valid values are: - "continuous" (default):
2032-
operator is supported to be fresh deployed via OperandRequest
2033-
from scratch - "maintained" operator is not supported to be
2034-
fresh deployed via OperandRequest, only upgrade and deletion
2035-
are allowed'
2036-
type: string
20372031
targetNamespaces:
20382032
description: The target namespace of the OperatorGroups.
20392033
items:
@@ -2044,6 +2038,7 @@ spec:
20442038
- name
20452039
- packageName
20462040
type: object
2041+
x-kubernetes-preserve-unknown-fields: true
20472042
type: array
20482043
type: object
20492044
x-kubernetes-preserve-unknown-fields: true

config/crd/bases/operator.ibm.com_operandregistries.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ spec:
6161
description: Description of a common service.
6262
type: string
6363
installMode:
64-
description: 'The install mode of an operator, either namespace
65-
or cluster. Valid values are: - "namespace" (default): operator
64+
description: 'The install mode of an operator, could be namespace
65+
cluster, or no-op. Valid values are: - "namespace" (default): operator
6666
is deployed in namespace of OperandRegistry; - "cluster":
67-
operator is deployed in "openshift-operators" namespace;'
67+
operator is deployed in "openshift-operators" namespace; - "no-op":
68+
operator is not supported to be fresh deployed via OperandRequest,
69+
only upgrade and deletion are allowed;'
6870
type: string
6971
installPlanApproval:
7072
description: 'Approval mode for emitted InstallPlans. Valid
@@ -2024,14 +2026,6 @@ spec:
20242026
type: object
20252027
type: array
20262028
type: object
2027-
supportStatus:
2028-
description: 'SupportStatus is used to indicate the support
2029-
status for services. Valid values are: - "continuous" (default):
2030-
operator is supported to be fresh deployed via OperandRequest
2031-
from scratch - "maintained" operator is not supported to be
2032-
fresh deployed via OperandRequest, only upgrade and deletion
2033-
are allowed'
2034-
type: string
20352029
targetNamespaces:
20362030
description: The target namespace of the OperatorGroups.
20372031
items:
@@ -2042,6 +2036,7 @@ spec:
20422036
- name
20432037
- packageName
20442038
type: object
2039+
x-kubernetes-preserve-unknown-fields: true
20452040
type: array
20462041
type: object
20472042
x-kubernetes-preserve-unknown-fields: true

controllers/operandrequest/reconcile_operator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func (r *Reconciler) reconcileSubscription(ctx context.Context, requestInstance
168168

169169
if err != nil {
170170
if apierrors.IsNotFound(err) {
171-
if opt.SupportStatus == operatorv1alpha1.MaintainedSupportStatus {
171+
if opt.InstallMode == operatorv1alpha1.InstallModeNoop {
172172
requestInstance.SetNoSuitableRegistryCondition(registryKey.String(), opt.Name+" is in maintenance status", operatorv1alpha1.ResourceTypeOperandRegistry, corev1.ConditionTrue, &r.Mutex)
173173
requestInstance.SetMemberStatus(operand.Name, operatorv1alpha1.OperatorRunning, operatorv1alpha1.ServiceRunning, mu)
174174
} else {

controllers/operator/manager.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ func (m *ODLMOperator) GetOperandRegistry(ctx context.Context, key types.Namespa
8686
if o.Namespace == "" {
8787
reg.Spec.Operators[i].Namespace = key.Namespace
8888
}
89-
if o.SupportStatus == "" {
90-
reg.Spec.Operators[i].SupportStatus = apiv1alpha1.ContinuousSupportStatus
91-
}
9289
if o.SourceName == "" || o.SourceNamespace == "" {
9390
catalogSourceName, catalogSourceNs, err := m.GetCatalogSourceFromPackage(ctx, o.PackageName, o.Namespace, o.Channel, key.Namespace, excludedCatalogSources)
9491
if err != nil {

docs/design/operand-deployment-lifecycle-manager.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ spec:
7373
sourceNamespace: openshift-marketplace [9]
7474
installMode: cluster [10]
7575
installPlanApproval: Manual [11]
76-
supportStatus: continuous [12]
7776
```
7877
7978
The OperandRegistry Custom Resource (CR) lists OLM Operator information for operands that may be requested for installation and/or access by an application that runs in a namespace. The registry CR specifies:
@@ -87,9 +86,8 @@ The OperandRegistry Custom Resource (CR) lists OLM Operator information for oper
8786
7. (optional) `scope` is an indicator, either public or private, that dictates whether deployment can be requested from other namespaces (public) or only from the namespace of this OperandRegistry (private). The default value is private.
8887
8. `sourceName` is the name of the CatalogSource.
8988
9. `sourceNamespace` is the namespace of the CatalogSource.
90-
10. (optional) `installMode` is the install mode of the operator, can be either `namespace` (OLM one namespace) or `cluster` (OLM all namespaces). The default value is `namespace`. Operator is deployed in `openshift-operators` namespace when InstallMode is set to `cluster`.
89+
10. (optional) `installMode` is the install mode of the operator, can be `namespace` (OLM one namespace), `cluster` (OLM all namespaces) or `no-op` (discontinued service). The default value is `namespace`. Operator is deployed in `openshift-operators` namespace when InstallMode is set to `cluster`.
9190
11. (optional) `installPlanApproval` is the approval mode for emitted installplan. The default value is `Automatic`.
92-
12. (optional) `supportStatus` is the support status for services. (1) When SupportStatus is `continous`, operator is supported to be fresh deployed via OperandRequest from scratch. (2) When SupportStatus is `maintained`, operator is not supported to be fresh deployed via OperandRequest, only upgrade and deletion are allowed. The default value is `continous`
9391

9492
## OperandConfig Spec
9593

0 commit comments

Comments
 (0)