Skip to content

Commit a3ed1db

Browse files
committed
Several changes
* Support for rollout when a secret is updated * Upgrades vals backend libs * Upgrades common golang libs and kubebuilder tools
1 parent abac1df commit a3ed1db

File tree

16 files changed

+259
-132
lines changed

16 files changed

+259
-132
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.22 as builder
1+
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:1.23 as builder
22

33
ARG TARGETPLATFORM
44
ARG BUILDPLATFORM

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ ENVTEST ?= $(LOCALBIN)/setup-envtest
133133

134134
## Tool Versions
135135
KUSTOMIZE_VERSION ?= v3.8.7
136-
CONTROLLER_TOOLS_VERSION ?= v0.10.0
136+
CONTROLLER_TOOLS_VERSION ?= v0.16.5
137137

138138
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
139139
.PHONY: kustomize

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ metadata:
9393
owner: digitalis.io
9494
spec:
9595
name: my-secret # Optional, default is the resource name
96-
ttl: 3600 # Optional, default is 0. The secret will be checked at every "reconcile period". See below.
96+
ttl: 3600 # Optional, default is 5 minutes. The secret will be checked at every "reconcile period". See below.
9797
type: Opaque # Default type, others supported
9898
data:
9999
username:
@@ -121,6 +121,9 @@ spec:
121121
{{- if .url }}
122122
url: {{ .url | lower }}
123123
{{ end }}
124+
rollout: # optional: run a `rollout` to make the pods use new secret
125+
- kind: Deployment
126+
name: myapp
124127
```
125128
126129
The example above will create a secret named `my-secret` and get the values from the different sources. The secret will be kept in sync against the backed secrets store.

apis/digitalis.io/v1/valssecret_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ type ValsSecretSpec struct {
7070
Type string `json:"type,omitempty"`
7171
Databases []Database `json:"databases,omitempty"`
7272
Template map[string]string `json:"template,omitempty"`
73+
Rollout []RolloutTarget `json:"rollout,omitempty"`
74+
}
75+
76+
// RolloutTarget sets up what deployment or sts to restart
77+
type RolloutTarget struct {
78+
// Kind is either Deployment, Pod or StatefulSet
79+
Kind string `json:"kind"`
80+
// Name is the object name
81+
Name string `json:"name"`
7382
}
7483

7584
// ValsSecretStatus defines the observed state of ValsSecret

apis/digitalis.io/v1/zz_generated.deepcopy.go

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

apis/digitalis.io/v1beta1/zz_generated.deepcopy.go

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

charts/vals-operator/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ kubeVersion: ">= 1.19.0-0"
1616
type: application
1717

1818
# Chart version
19-
version: 0.7.10
19+
version: 0.7.11
2020

2121
# Latest container tag
22-
appVersion: v0.7.10
22+
appVersion: v0.7.11-beta1
2323

2424
maintainers:
2525
- email: info@digitalis.io

charts/vals-operator/crds/dbsecrets.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.10.0
6+
controller-gen.kubebuilder.io/version: v0.16.5
77
"helm.sh/hook": crd-install
88
"helm.sh/hook-delete-policy": "before-hook-creation"
9-
creationTimestamp: null
109
name: dbsecrets.digitalis.io
1110
spec:
1211
group: digitalis.io
@@ -23,14 +22,19 @@ spec:
2322
description: DbSecret is the Schema for the dbsecrets API
2423
properties:
2524
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'
25+
description: |-
26+
APIVersion defines the versioned schema of this representation of an object.
27+
Servers should convert recognized schemas to the latest internal value, and
28+
may reject unrecognized values.
29+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2930
type: string
3031
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'
32+
description: |-
33+
Kind is a string value representing the REST resource this object represents.
34+
Servers may infer this from the endpoint the client submits requests to.
35+
Cannot be updated.
36+
In CamelCase.
37+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3438
type: string
3539
metadata:
3640
type: object

charts/vals-operator/crds/valssecrets.yaml

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
21
---
32
apiVersion: apiextensions.k8s.io/v1
43
kind: CustomResourceDefinition
54
metadata:
65
annotations:
7-
controller-gen.kubebuilder.io/version: v0.4.1
6+
controller-gen.kubebuilder.io/version: v0.16.5
87
"helm.sh/hook": crd-install
98
"helm.sh/hook-delete-policy": "before-hook-creation"
10-
creationTimestamp: null
119
name: valssecrets.digitalis.io
1210
spec:
1311
group: digitalis.io
@@ -24,14 +22,19 @@ spec:
2422
description: ValsSecret is the Schema for the valssecrets API
2523
properties:
2624
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'
25+
description: |-
26+
APIVersion defines the versioned schema of this representation of an object.
27+
Servers should convert recognized schemas to the latest internal value, and
28+
may reject unrecognized values.
29+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
3030
type: string
3131
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'
32+
description: |-
33+
Kind is a string value representing the REST resource this object represents.
34+
Servers may infer this from the endpoint the client submits requests to.
35+
Cannot be updated.
36+
In CamelCase.
37+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3538
type: string
3639
metadata:
3740
type: object
@@ -40,13 +43,15 @@ spec:
4043
properties:
4144
data:
4245
additionalProperties:
46+
description: DataSource defines a secret
4347
properties:
4448
encoding:
4549
description: Encoding type for the secret. Only base64 supported.
4650
Optional
4751
type: string
4852
ref:
49-
description: Ref value to the secret in the format ref+backend://path
53+
description: |-
54+
Ref value to the secret in the format ref+backend://path
5055
https://github.com/helmfile/vals
5156
type: string
5257
required:
@@ -55,6 +60,7 @@ spec:
5560
type: object
5661
databases:
5762
items:
63+
description: Database defines a DB connection
5864
properties:
5965
driver:
6066
description: Defines the database type
@@ -106,10 +112,25 @@ spec:
106112
type: array
107113
name:
108114
type: string
115+
rollout:
116+
items:
117+
description: RolloutTarget sets up what deployment or sts to restart
118+
properties:
119+
kind:
120+
description: Kind is either Deployment, Pod or StatefulSet
121+
type: string
122+
name:
123+
description: Name is the object name
124+
type: string
125+
required:
126+
- kind
127+
- name
128+
type: object
129+
type: array
109130
template:
110-
type: object
111131
additionalProperties:
112132
type: string
133+
type: object
113134
ttl:
114135
format: int64
115136
type: integer
@@ -126,9 +147,3 @@ spec:
126147
storage: true
127148
subresources:
128149
status: {}
129-
status:
130-
acceptedNames:
131-
kind: ""
132-
plural: ""
133-
conditions: []
134-
storedVersions: []

config/crd/bases/digitalis.io_dbsecrets.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.10.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.16.5
87
name: dbsecrets.digitalis.io
98
spec:
109
group: digitalis.io
@@ -21,14 +20,19 @@ spec:
2120
description: DbSecret is the Schema for the dbsecrets API
2221
properties:
2322
apiVersion:
24-
description: 'APIVersion defines the versioned schema of this representation
25-
of an object. Servers should convert recognized schemas to the latest
26-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2728
type: string
2829
kind:
29-
description: 'Kind is a string value representing the REST resource this
30-
object represents. Servers may infer this from the endpoint the client
31-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3236
type: string
3337
metadata:
3438
type: object

config/crd/bases/digitalis.io_valssecrets.yaml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.10.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.16.5
87
name: valssecrets.digitalis.io
98
spec:
109
group: digitalis.io
@@ -21,14 +20,19 @@ spec:
2120
description: ValsSecret is the Schema for the valssecrets API
2221
properties:
2322
apiVersion:
24-
description: 'APIVersion defines the versioned schema of this representation
25-
of an object. Servers should convert recognized schemas to the latest
26-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2728
type: string
2829
kind:
29-
description: 'Kind is a string value representing the REST resource this
30-
object represents. Servers may infer this from the endpoint the client
31-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3236
type: string
3337
metadata:
3438
type: object
@@ -44,7 +48,8 @@ spec:
4448
Optional
4549
type: string
4650
ref:
47-
description: Ref value to the secret in the format ref+backend://path
51+
description: |-
52+
Ref value to the secret in the format ref+backend://path
4853
https://github.com/helmfile/vals
4954
type: string
5055
required:
@@ -105,6 +110,21 @@ spec:
105110
type: array
106111
name:
107112
type: string
113+
rollout:
114+
items:
115+
description: RolloutTarget sets up what deployment or sts to restart
116+
properties:
117+
kind:
118+
description: Kind is either Deployment, Pod or StatefulSet
119+
type: string
120+
name:
121+
description: Name is the object name
122+
type: string
123+
required:
124+
- kind
125+
- name
126+
type: object
127+
type: array
108128
template:
109129
additionalProperties:
110130
type: string

0 commit comments

Comments
 (0)