Skip to content

Commit 782aaae

Browse files
Merge pull request #1694 from njhale/v1-default
Enable the Operator API by default
2 parents 55aa8dd + 033d08f commit 782aaae

File tree

123 files changed

+1403
-6975
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+1403
-6975
lines changed

cmd/olm/manager.go

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@ package main
22

33
import (
44
"context"
5-
"fmt"
65

7-
"github.com/operator-framework/api/crds"
8-
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1"
9-
apierrors "k8s.io/apimachinery/pkg/api/errors"
10-
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
116
ctrl "sigs.k8s.io/controller-runtime"
127
"sigs.k8s.io/controller-runtime/pkg/log/zap"
138

@@ -30,14 +25,7 @@ func Manager(ctx context.Context) (ctrl.Manager, error) {
3025

3126
// Setup a new controller to reconcile Operators
3227
setupLog.Info("configuring controller")
33-
client, err := apiextensionsv1.NewForConfig(mgr.GetConfig())
34-
if err != nil {
35-
return nil, err
36-
}
37-
38-
if feature.Gate.Enabled(feature.OperatorLifecycleManagerV2) {
39-
setupLog.Info(fmt.Sprintf("feature enabled: %v", feature.OperatorLifecycleManagerV2))
40-
28+
if feature.Gate.Enabled(feature.OperatorLifecycleManagerV1) {
4129
operatorReconciler, err := operators.NewOperatorReconciler(
4230
mgr.GetClient(),
4331
ctrl.Log.WithName("controllers").WithName("operator"),
@@ -47,24 +35,6 @@ func Manager(ctx context.Context) (ctrl.Manager, error) {
4735
return nil, err
4836
}
4937

50-
crd, err := client.CustomResourceDefinitions().Create(ctx, crds.Operator(), metav1.CreateOptions{})
51-
if err != nil {
52-
if !apierrors.IsAlreadyExists(err) {
53-
return nil, err
54-
}
55-
56-
// Already exists, try to update
57-
if crd, err = client.CustomResourceDefinitions().Get(ctx, crds.Operator().GetName(), metav1.GetOptions{}); err != nil {
58-
return nil, err
59-
}
60-
61-
crd.Spec = crds.Operator().Spec
62-
if _, err = client.CustomResourceDefinitions().Update(ctx, crd, metav1.UpdateOptions{}); err != nil {
63-
return nil, err
64-
}
65-
}
66-
setupLog.Info("v2alpha1 CRDs installed")
67-
6838
if err = operatorReconciler.SetupWithManager(mgr); err != nil {
6939
return nil, err
7040
}

deploy/chart/crds/0000_50_olm_00-catalogsources.crd.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ spec:
9090
a registry-server with. Only used when SourceType = SourceTypeGrpc.
9191
If present, the address field is ignored.
9292
type: string
93+
priority:
94+
description: 'Priority field assigns a weight to the catalog source
95+
to prioritize them so that it can be consumed by the dependency
96+
resolver. Usage: Higher weight indicates that this catalog source
97+
is preferred over lower weighted catalog sources during dependency
98+
resolution. The range of the priority value can go from positive
99+
to negative in the range of int32. The default value to a catalog
100+
source with unassigned priority would be 0. The catalog source with
101+
the same priority values will be ranked lexicographically based
102+
on its name.'
103+
type: integer
93104
publisher:
94105
type: string
95106
secrets:

deploy/chart/crds/0000_50_olm_00-clusterserviceversions.crd.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,13 +662,19 @@ spec:
662662
deployments:
663663
type: array
664664
items:
665-
description: StrategyDeploymentSpec contains the name and
666-
spec for the deployment ALM should create
665+
description: StrategyDeploymentSpec contains the name, spec
666+
and labels for the deployment ALM should create
667667
type: object
668668
required:
669669
- name
670670
- spec
671671
properties:
672+
label:
673+
description: Set is a map of label:value. It implements
674+
Labels.
675+
type: object
676+
additionalProperties:
677+
type: string
672678
name:
673679
type: string
674680
spec:
@@ -8698,6 +8704,10 @@ spec:
86988704
containerPort:
86998705
type: integer
87008706
format: int32
8707+
conversionCRDs:
8708+
type: array
8709+
items:
8710+
type: string
87018711
deploymentName:
87028712
type: string
87038713
failurePolicy:
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
apiVersion: apiextensions.k8s.io/v1
2+
kind: CustomResourceDefinition
3+
metadata:
4+
annotations:
5+
controller-gen.kubebuilder.io/version: v0.3.0
6+
creationTimestamp: null
7+
name: operators.operators.coreos.com
8+
spec:
9+
group: operators.coreos.com
10+
names:
11+
categories:
12+
- olm
13+
kind: Operator
14+
listKind: OperatorList
15+
plural: operators
16+
singular: operator
17+
scope: Cluster
18+
versions:
19+
- name: v1
20+
schema:
21+
openAPIV3Schema:
22+
description: Operator represents a cluster operator.
23+
type: object
24+
properties:
25+
apiVersion:
26+
description: 'APIVersion defines the versioned schema of this representation
27+
of an object. Servers should convert recognized schemas to the latest
28+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
29+
type: string
30+
kind:
31+
description: 'Kind is a string value representing the REST resource this
32+
object represents. Servers may infer this from the endpoint the client
33+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
34+
type: string
35+
metadata:
36+
type: object
37+
spec:
38+
description: OperatorSpec defines the desired state of Operator
39+
type: object
40+
status:
41+
description: OperatorStatus describes the observed state of an operator
42+
and its components.
43+
type: object
44+
properties:
45+
components:
46+
description: Components describes resources that compose the operator.
47+
type: object
48+
required:
49+
- labelSelector
50+
properties:
51+
labelSelector:
52+
description: LabelSelector is a label query over a set of resources
53+
used to select the operator's components
54+
type: object
55+
properties:
56+
matchExpressions:
57+
description: matchExpressions is a list of label selector
58+
requirements. The requirements are ANDed.
59+
type: array
60+
items:
61+
description: A label selector requirement is a selector
62+
that contains values, a key, and an operator that relates
63+
the key and values.
64+
type: object
65+
required:
66+
- key
67+
- operator
68+
properties:
69+
key:
70+
description: key is the label key that the selector
71+
applies to.
72+
type: string
73+
operator:
74+
description: operator represents a key's relationship
75+
to a set of values. Valid operators are In, NotIn,
76+
Exists and DoesNotExist.
77+
type: string
78+
values:
79+
description: values is an array of string values. If
80+
the operator is In or NotIn, the values array must
81+
be non-empty. If the operator is Exists or DoesNotExist,
82+
the values array must be empty. This array is replaced
83+
during a strategic merge patch.
84+
type: array
85+
items:
86+
type: string
87+
matchLabels:
88+
description: matchLabels is a map of {key,value} pairs. A
89+
single {key,value} in the matchLabels map is equivalent
90+
to an element of matchExpressions, whose key field is "key",
91+
the operator is "In", and the values array contains only
92+
"value". The requirements are ANDed.
93+
type: object
94+
additionalProperties:
95+
type: string
96+
refs:
97+
description: Refs are a set of references to the operator's component
98+
resources, selected with LabelSelector.
99+
type: array
100+
items:
101+
description: RichReference is a reference to a resource, enriched
102+
with its status conditions.
103+
type: object
104+
properties:
105+
apiVersion:
106+
description: API version of the referent.
107+
type: string
108+
conditions:
109+
description: Conditions represents the latest state of the
110+
component.
111+
type: array
112+
items:
113+
description: Condition represent the latest available
114+
observations of an component's state.
115+
type: object
116+
required:
117+
- status
118+
- type
119+
properties:
120+
lastTransitionTime:
121+
description: Last time the condition transitioned
122+
from one status to another.
123+
type: string
124+
format: date-time
125+
lastUpdateTime:
126+
description: Last time the condition was probed
127+
type: string
128+
format: date-time
129+
message:
130+
description: A human readable message indicating details
131+
about the transition.
132+
type: string
133+
reason:
134+
description: The reason for the condition's last transition.
135+
type: string
136+
status:
137+
description: Status of the condition, one of True,
138+
False, Unknown.
139+
type: string
140+
type:
141+
description: Type of condition.
142+
type: string
143+
fieldPath:
144+
description: 'If referring to a piece of an object instead
145+
of an entire object, this string should contain a valid
146+
JSON/Go field access statement, such as desiredState.manifest.containers[2].
147+
For example, if the object reference is to a container
148+
within a pod, this would take on a value like: "spec.containers{name}"
149+
(where "name" refers to the name of the container that
150+
triggered the event) or if no container name is specified
151+
"spec.containers[2]" (container with index 2 in this pod).
152+
This syntax is chosen only to have some well-defined way
153+
of referencing a part of an object. TODO: this design
154+
is not final and this field is subject to change in the
155+
future.'
156+
type: string
157+
kind:
158+
description: 'Kind of the referent. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
159+
type: string
160+
name:
161+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names'
162+
type: string
163+
namespace:
164+
description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/'
165+
type: string
166+
resourceVersion:
167+
description: 'Specific resourceVersion to which this reference
168+
is made, if any. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#concurrency-control-and-consistency'
169+
type: string
170+
uid:
171+
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids'
172+
type: string
173+
served: true
174+
storage: true
175+
subresources:
176+
status: {}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ require (
2222
github.com/onsi/gomega v1.9.0
2323
github.com/openshift/api v0.0.0-20200331152225-585af27e34fd
2424
github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0
25-
github.com/operator-framework/api v0.3.7
25+
github.com/operator-framework/api v0.3.11
2626
github.com/operator-framework/operator-registry v1.13.3
2727
github.com/otiai10/copy v1.2.0
2828
github.com/pkg/errors v0.9.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,8 @@ github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0 h1:kMiuiZXH1Gd
585585
github.com/openshift/client-go v0.0.0-20200326155132-2a6cd50aedd0/go.mod h1:uUQ4LClRO+fg5MF/P6QxjMCb1C9f7Oh4RKepftDnEJE=
586586
github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
587587
github.com/operator-framework/api v0.3.7-0.20200602203552-431198de9fc2/go.mod h1:Xbje9x0SHmh0nihE21kpesB38vk3cyxnE6JdDS8Jo1Q=
588-
github.com/operator-framework/api v0.3.7 h1:gTER+WQdjRAegxKdcoylNqHVGGnBRAAgC2zS3CZL78g=
589-
github.com/operator-framework/api v0.3.7/go.mod h1:Xbje9x0SHmh0nihE21kpesB38vk3cyxnE6JdDS8Jo1Q=
588+
github.com/operator-framework/api v0.3.11 h1:+fyck2pcr+vVGnVxM4UNoi7qOSMVCTQOWW2xsJtLSq0=
589+
github.com/operator-framework/api v0.3.11/go.mod h1:Xbje9x0SHmh0nihE21kpesB38vk3cyxnE6JdDS8Jo1Q=
590590
github.com/operator-framework/operator-registry v1.13.3 h1:SaZ1IKLKGizVgTtT8AlDgaMXFYOiIPxRf8KLve0/DXM=
591591
github.com/operator-framework/operator-registry v1.13.3/go.mod h1:YhnIzOVjRU2ZwZtzt+fjcjW8ujJaSFynBEu7QVKaSdU=
592592
github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k=

manifests/0000_50_olm_00-catalogsources.crd.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,17 @@ spec:
9090
a registry-server with. Only used when SourceType = SourceTypeGrpc.
9191
If present, the address field is ignored.
9292
type: string
93+
priority:
94+
description: 'Priority field assigns a weight to the catalog source
95+
to prioritize them so that it can be consumed by the dependency
96+
resolver. Usage: Higher weight indicates that this catalog source
97+
is preferred over lower weighted catalog sources during dependency
98+
resolution. The range of the priority value can go from positive
99+
to negative in the range of int32. The default value to a catalog
100+
source with unassigned priority would be 0. The catalog source with
101+
the same priority values will be ranked lexicographically based
102+
on its name.'
103+
type: integer
93104
publisher:
94105
type: string
95106
secrets:

manifests/0000_50_olm_00-clusterserviceversions.crd.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -662,13 +662,19 @@ spec:
662662
deployments:
663663
type: array
664664
items:
665-
description: StrategyDeploymentSpec contains the name and
666-
spec for the deployment ALM should create
665+
description: StrategyDeploymentSpec contains the name, spec
666+
and labels for the deployment ALM should create
667667
type: object
668668
required:
669669
- name
670670
- spec
671671
properties:
672+
label:
673+
description: Set is a map of label:value. It implements
674+
Labels.
675+
type: object
676+
additionalProperties:
677+
type: string
672678
name:
673679
type: string
674680
spec:
@@ -8698,6 +8704,10 @@ spec:
86988704
containerPort:
86998705
type: integer
87008706
format: int32
8707+
conversionCRDs:
8708+
type: array
8709+
items:
8710+
type: string
87018711
deploymentName:
87028712
type: string
87038713
failurePolicy:

0 commit comments

Comments
 (0)