Skip to content

Commit 271771d

Browse files
Merge pull request #1875 from awgreene/create-operatorconditions-for-operator
Create operatorcondition for operator
2 parents d701e9a + f571cd8 commit 271771d

38 files changed

+6380
-784
lines changed

cmd/olm/manager.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,32 @@ func Manager(ctx context.Context) (ctrl.Manager, error) {
2323
return nil, err
2424
}
2525

26+
operatorConditionReconciler, err := operators.NewOperatorConditionReconciler(
27+
mgr.GetClient(),
28+
ctrl.Log.WithName("controllers").WithName("operatorcondition"),
29+
mgr.GetScheme(),
30+
)
31+
if err != nil {
32+
return nil, err
33+
}
34+
35+
if err = operatorConditionReconciler.SetupWithManager(mgr); err != nil {
36+
return nil, err
37+
}
38+
39+
operatorConditionGeneratorReconciler, err := operators.NewOperatorConditionGeneratorReconciler(
40+
mgr.GetClient(),
41+
ctrl.Log.WithName("controllers").WithName("operatorcondition-generator"),
42+
mgr.GetScheme(),
43+
)
44+
if err != nil {
45+
return nil, err
46+
}
47+
48+
if err = operatorConditionGeneratorReconciler.SetupWithManager(mgr); err != nil {
49+
return nil, err
50+
}
51+
2652
// Setup a new controller to reconcile Operators
2753
setupLog.Info("configuring controller")
2854
if feature.Gate.Enabled(feature.OperatorLifecycleManagerV1) {

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

Lines changed: 687 additions & 140 deletions
Large diffs are not rendered by default.
Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
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: operatorconditions.operators.coreos.com
8+
spec:
9+
group: operators.coreos.com
10+
names:
11+
kind: OperatorCondition
12+
listKind: OperatorConditionList
13+
plural: operatorconditions
14+
singular: operatorcondition
15+
scope: Namespaced
16+
versions:
17+
- name: v1
18+
schema:
19+
openAPIV3Schema:
20+
description: OperatorCondition is a Custom Resource of type `OperatorCondition`
21+
which is used to convey information to OLM about the state of an operator.
22+
type: object
23+
required:
24+
- metadata
25+
properties:
26+
apiVersion:
27+
description: 'APIVersion defines the versioned schema of this representation
28+
of an object. Servers should convert recognized schemas to the latest
29+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
30+
type: string
31+
kind:
32+
description: 'Kind is a string value representing the REST resource this
33+
object represents. Servers may infer this from the endpoint the client
34+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
35+
type: string
36+
metadata:
37+
type: object
38+
spec:
39+
description: OperatorConditionSpec allows a cluster admin to convey information
40+
about the state of an operator to OLM, potentially overriding state
41+
reported by the operator.
42+
type: object
43+
properties:
44+
deployments:
45+
type: array
46+
items:
47+
type: string
48+
overrides:
49+
type: array
50+
items:
51+
description: "Condition contains details for one aspect of the current
52+
state of this API Resource. --- This struct is intended for direct
53+
use as an array at the field path .status.conditions. For example,
54+
type FooStatus struct{ // Represents the observations of a
55+
foo's current state. // Known .status.conditions.type are:
56+
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
57+
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
58+
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
59+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
60+
\n // other fields }"
61+
type: object
62+
required:
63+
- lastTransitionTime
64+
- message
65+
- reason
66+
- status
67+
- type
68+
properties:
69+
lastTransitionTime:
70+
description: lastTransitionTime is the last time the condition
71+
transitioned from one status to another. This should be when
72+
the underlying condition changed. If that is not known, then
73+
using the time when the API field changed is acceptable.
74+
type: string
75+
format: date-time
76+
message:
77+
description: message is a human readable message indicating
78+
details about the transition. This may be an empty string.
79+
type: string
80+
maxLength: 32768
81+
observedGeneration:
82+
description: observedGeneration represents the .metadata.generation
83+
that the condition was set based upon. For instance, if .metadata.generation
84+
is currently 12, but the .status.conditions[x].observedGeneration
85+
is 9, the condition is out of date with respect to the current
86+
state of the instance.
87+
type: integer
88+
format: int64
89+
minimum: 0
90+
reason:
91+
description: reason contains a programmatic identifier indicating
92+
the reason for the condition's last transition. Producers
93+
of specific condition types may define expected values and
94+
meanings for this field, and whether the values are considered
95+
a guaranteed API. The value should be a CamelCase string.
96+
This field may not be empty.
97+
type: string
98+
maxLength: 1024
99+
minLength: 1
100+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
101+
status:
102+
description: status of the condition, one of True, False, Unknown.
103+
type: string
104+
enum:
105+
- "True"
106+
- "False"
107+
- Unknown
108+
type:
109+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
110+
--- Many .condition.type values are consistent across resources
111+
like Available, but because arbitrary conditions can be useful
112+
(see .node.status.conditions), the ability to deconflict is
113+
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
114+
type: string
115+
maxLength: 316
116+
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])$
117+
serviceAccounts:
118+
type: array
119+
items:
120+
type: string
121+
status:
122+
description: OperatorConditionStatus allows an operator to convey information
123+
its state to OLM. The status may trail the actual state of a system.
124+
type: object
125+
properties:
126+
conditions:
127+
type: array
128+
items:
129+
description: "Condition contains details for one aspect of the current
130+
state of this API Resource. --- This struct is intended for direct
131+
use as an array at the field path .status.conditions. For example,
132+
type FooStatus struct{ // Represents the observations of a
133+
foo's current state. // Known .status.conditions.type are:
134+
\"Available\", \"Progressing\", and \"Degraded\" // +patchMergeKey=type
135+
\ // +patchStrategy=merge // +listType=map // +listMapKey=type
136+
\ Conditions []metav1.Condition `json:\"conditions,omitempty\"
137+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`
138+
\n // other fields }"
139+
type: object
140+
required:
141+
- lastTransitionTime
142+
- message
143+
- reason
144+
- status
145+
- type
146+
properties:
147+
lastTransitionTime:
148+
description: lastTransitionTime is the last time the condition
149+
transitioned from one status to another. This should be when
150+
the underlying condition changed. If that is not known, then
151+
using the time when the API field changed is acceptable.
152+
type: string
153+
format: date-time
154+
message:
155+
description: message is a human readable message indicating
156+
details about the transition. This may be an empty string.
157+
type: string
158+
maxLength: 32768
159+
observedGeneration:
160+
description: observedGeneration represents the .metadata.generation
161+
that the condition was set based upon. For instance, if .metadata.generation
162+
is currently 12, but the .status.conditions[x].observedGeneration
163+
is 9, the condition is out of date with respect to the current
164+
state of the instance.
165+
type: integer
166+
format: int64
167+
minimum: 0
168+
reason:
169+
description: reason contains a programmatic identifier indicating
170+
the reason for the condition's last transition. Producers
171+
of specific condition types may define expected values and
172+
meanings for this field, and whether the values are considered
173+
a guaranteed API. The value should be a CamelCase string.
174+
This field may not be empty.
175+
type: string
176+
maxLength: 1024
177+
minLength: 1
178+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
179+
status:
180+
description: status of the condition, one of True, False, Unknown.
181+
type: string
182+
enum:
183+
- "True"
184+
- "False"
185+
- Unknown
186+
type:
187+
description: type of condition in CamelCase or in foo.example.com/CamelCase.
188+
--- Many .condition.type values are consistent across resources
189+
like Available, but because arbitrary conditions can be useful
190+
(see .node.status.conditions), the ability to deconflict is
191+
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
192+
type: string
193+
maxLength: 316
194+
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])$
195+
served: true
196+
storage: true
197+
subresources:
198+
status: {}

0 commit comments

Comments
 (0)