Skip to content

Commit a9ccfc7

Browse files
Merge pull request #25 from bharath-b-rh/eso-53
ESO-53: Adds a controller to manage ExternalSecretsManager API
2 parents 6572dfb + db06bbc commit a9ccfc7

File tree

19 files changed

+916
-170
lines changed

19 files changed

+916
-170
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
# Output of the go coverage tool, specifically when used with LiteIDE
1515
*.out
16+
cover.html
1617

1718
# Dependency directories (remove the comment below to include it)
1819
# vendor/

api/v1alpha1/external_secrets_manager_types.go

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,45 @@ type Feature struct {
116116

117117
// ExternalSecretsManagerStatus is the most recently observed status of the ExternalSecretsManager.
118118
type ExternalSecretsManagerStatus struct {
119+
// controllerStatuses holds the observed conditions of the controllers part of the operator.
120+
// +patchMergeKey=type
121+
// +patchStrategy=merge
122+
// +listType=map
123+
// +listMapKey=name
124+
ControllerStatuses []ControllerStatus `json:"controllerStatuses,omitempty"`
125+
126+
// lastTransitionTime is the last time the condition transitioned from one status to another.
127+
// +kubebuilder:validation:Type=string
128+
// +kubebuilder:validation:Format=date-time
129+
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
130+
}
131+
132+
// ControllerStatus holds the observed conditions of the controllers part of the operator.
133+
type ControllerStatus struct {
134+
// name of the controller for which the observed condition is recorded.
135+
// +kubebuilder:validation:Required
136+
Name string `json:"name,omitempty"`
137+
119138
// conditions holds information of the current state of the external-secrets-operator controllers.
120-
ConditionalStatus `json:",inline,omitempty"`
139+
// +patchMergeKey=type
140+
// +patchStrategy=merge
141+
// +listType=map
142+
// +listMapKey=type
143+
Conditions []Condition `json:"conditions,omitempty"`
144+
145+
// observedGeneration represents the .metadata.generation on the observed resource.
146+
// +kubebuilder:validation:Minimum=0
147+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
148+
}
149+
150+
type Condition struct {
151+
// type of the condition
152+
// +kubebuilder:validation:Required
153+
Type string `json:"type"`
154+
155+
// status of the condition
156+
Status metav1.ConditionStatus `json:"status" `
157+
158+
// message provides details about the state.
159+
Message string `json:"message"`
121160
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 43 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/external-secrets-operator.clusterserviceversion.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ metadata:
3333
categories: Security
3434
console.openshift.io/disable-operand-delete: "true"
3535
containerImage: ""
36-
createdAt: "2025-06-04T18:31:43Z"
36+
createdAt: "2025-06-13T05:51:30Z"
3737
features.operators.openshift.io/cnf: "false"
3838
features.operators.openshift.io/cni: "false"
3939
features.operators.openshift.io/csi: "false"
@@ -343,12 +343,14 @@ spec:
343343
- operator.openshift.io
344344
resources:
345345
- externalsecrets/finalizers
346+
- externalsecretsmanagers/finalizers
346347
verbs:
347348
- update
348349
- apiGroups:
349350
- operator.openshift.io
350351
resources:
351352
- externalsecrets/status
353+
- externalsecretsmanagers/status
352354
verbs:
353355
- get
354356
- patch

bundle/manifests/operator.openshift.io_externalsecretsmanagers.yaml

Lines changed: 40 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,67 +1133,58 @@ spec:
11331133
status is the most recently observed status of controllers used by
11341134
External Secrets Operator.
11351135
properties:
1136-
conditions:
1137-
description: conditions holds information of the current state of
1138-
deployment.
1136+
controllerStatuses:
1137+
description: controllerStatuses holds the observed conditions of the
1138+
controllers part of the operator.
11391139
items:
1140-
description: Condition contains details for one aspect of the current
1141-
state of this API Resource.
1140+
description: ControllerStatus holds the observed conditions of the
1141+
controllers part of the operator.
11421142
properties:
1143-
lastTransitionTime:
1144-
description: |-
1145-
lastTransitionTime is the last time the condition transitioned from one status to another.
1146-
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
1147-
format: date-time
1148-
type: string
1149-
message:
1150-
description: |-
1151-
message is a human readable message indicating details about the transition.
1152-
This may be an empty string.
1153-
maxLength: 32768
1143+
conditions:
1144+
description: conditions holds information of the current state
1145+
of the external-secrets-operator controllers.
1146+
items:
1147+
properties:
1148+
message:
1149+
description: message provides details about the state.
1150+
type: string
1151+
status:
1152+
description: status of the condition
1153+
type: string
1154+
type:
1155+
description: type of the condition
1156+
type: string
1157+
required:
1158+
- message
1159+
- status
1160+
- type
1161+
type: object
1162+
type: array
1163+
x-kubernetes-list-map-keys:
1164+
- type
1165+
x-kubernetes-list-type: map
1166+
name:
1167+
description: name of the controller for which the observed condition
1168+
is recorded.
11541169
type: string
11551170
observedGeneration:
1156-
description: |-
1157-
observedGeneration represents the .metadata.generation that the condition was set based upon.
1158-
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
1159-
with respect to the current state of the instance.
1171+
description: observedGeneration represents the .metadata.generation
1172+
on the observed resource.
11601173
format: int64
11611174
minimum: 0
11621175
type: integer
1163-
reason:
1164-
description: |-
1165-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
1166-
Producers of specific condition types may define expected values and meanings for this field,
1167-
and whether the values are considered a guaranteed API.
1168-
The value should be a CamelCase string.
1169-
This field may not be empty.
1170-
maxLength: 1024
1171-
minLength: 1
1172-
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
1173-
type: string
1174-
status:
1175-
description: status of the condition, one of True, False, Unknown.
1176-
enum:
1177-
- "True"
1178-
- "False"
1179-
- Unknown
1180-
type: string
1181-
type:
1182-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
1183-
maxLength: 316
1184-
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])$
1185-
type: string
11861176
required:
1187-
- lastTransitionTime
1188-
- message
1189-
- reason
1190-
- status
1191-
- type
1177+
- name
11921178
type: object
11931179
type: array
11941180
x-kubernetes-list-map-keys:
1195-
- type
1181+
- name
11961182
x-kubernetes-list-type: map
1183+
lastTransitionTime:
1184+
description: lastTransitionTime is the last time the condition transitioned
1185+
from one status to another.
1186+
format: date-time
1187+
type: string
11971188
type: object
11981189
type: object
11991190
x-kubernetes-validations:

cmd/external-secrets-operator/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ limitations under the License.
1717
package main
1818

1919
import (
20+
"context"
2021
"crypto/tls"
2122
"flag"
2223
"os"
@@ -43,6 +44,7 @@ import (
4344
)
4445

4546
var (
47+
ctx = context.Background()
4648
scheme = runtime.NewScheme()
4749
setupLog = ctrl.Log.WithName("setup")
4850
)
@@ -139,7 +141,7 @@ func main() {
139141
os.Exit(1)
140142
}
141143

142-
if err := operator.StartControllers(mgr); err != nil {
144+
if err := operator.StartControllers(ctx, mgr); err != nil {
143145
setupLog.Error(err, "failed to start controllers")
144146
os.Exit(1)
145147
}

config/crd/bases/operator.openshift.io_externalsecretsmanagers.yaml

Lines changed: 40 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,67 +1133,58 @@ spec:
11331133
status is the most recently observed status of controllers used by
11341134
External Secrets Operator.
11351135
properties:
1136-
conditions:
1137-
description: conditions holds information of the current state of
1138-
deployment.
1136+
controllerStatuses:
1137+
description: controllerStatuses holds the observed conditions of the
1138+
controllers part of the operator.
11391139
items:
1140-
description: Condition contains details for one aspect of the current
1141-
state of this API Resource.
1140+
description: ControllerStatus holds the observed conditions of the
1141+
controllers part of the operator.
11421142
properties:
1143-
lastTransitionTime:
1144-
description: |-
1145-
lastTransitionTime is the last time the condition transitioned from one status to another.
1146-
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
1147-
format: date-time
1148-
type: string
1149-
message:
1150-
description: |-
1151-
message is a human readable message indicating details about the transition.
1152-
This may be an empty string.
1153-
maxLength: 32768
1143+
conditions:
1144+
description: conditions holds information of the current state
1145+
of the external-secrets-operator controllers.
1146+
items:
1147+
properties:
1148+
message:
1149+
description: message provides details about the state.
1150+
type: string
1151+
status:
1152+
description: status of the condition
1153+
type: string
1154+
type:
1155+
description: type of the condition
1156+
type: string
1157+
required:
1158+
- message
1159+
- status
1160+
- type
1161+
type: object
1162+
type: array
1163+
x-kubernetes-list-map-keys:
1164+
- type
1165+
x-kubernetes-list-type: map
1166+
name:
1167+
description: name of the controller for which the observed condition
1168+
is recorded.
11541169
type: string
11551170
observedGeneration:
1156-
description: |-
1157-
observedGeneration represents the .metadata.generation that the condition was set based upon.
1158-
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
1159-
with respect to the current state of the instance.
1171+
description: observedGeneration represents the .metadata.generation
1172+
on the observed resource.
11601173
format: int64
11611174
minimum: 0
11621175
type: integer
1163-
reason:
1164-
description: |-
1165-
reason contains a programmatic identifier indicating the reason for the condition's last transition.
1166-
Producers of specific condition types may define expected values and meanings for this field,
1167-
and whether the values are considered a guaranteed API.
1168-
The value should be a CamelCase string.
1169-
This field may not be empty.
1170-
maxLength: 1024
1171-
minLength: 1
1172-
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
1173-
type: string
1174-
status:
1175-
description: status of the condition, one of True, False, Unknown.
1176-
enum:
1177-
- "True"
1178-
- "False"
1179-
- Unknown
1180-
type: string
1181-
type:
1182-
description: type of condition in CamelCase or in foo.example.com/CamelCase.
1183-
maxLength: 316
1184-
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])$
1185-
type: string
11861176
required:
1187-
- lastTransitionTime
1188-
- message
1189-
- reason
1190-
- status
1191-
- type
1177+
- name
11921178
type: object
11931179
type: array
11941180
x-kubernetes-list-map-keys:
1195-
- type
1181+
- name
11961182
x-kubernetes-list-type: map
1183+
lastTransitionTime:
1184+
description: lastTransitionTime is the last time the condition transitioned
1185+
from one status to another.
1186+
format: date-time
1187+
type: string
11971188
type: object
11981189
type: object
11991190
x-kubernetes-validations:

config/rbac/role.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,14 @@ rules:
175175
- operator.openshift.io
176176
resources:
177177
- externalsecrets/finalizers
178+
- externalsecretsmanagers/finalizers
178179
verbs:
179180
- update
180181
- apiGroups:
181182
- operator.openshift.io
182183
resources:
183184
- externalsecrets/status
185+
- externalsecretsmanagers/status
184186
verbs:
185187
- get
186188
- patch

0 commit comments

Comments
 (0)