Skip to content

Commit e5dd284

Browse files
committed
operator: Require Redpanda license for stretch cluster
1 parent 184da18 commit e5dd284

File tree

13 files changed

+1687
-6
lines changed

13 files changed

+1687
-6
lines changed

go.work.sum

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ buf.build/gen/go/redpandadata/common/connectrpc/go v1.16.2-20240508150812-e0d0fb
2323
buf.build/gen/go/redpandadata/common/connectrpc/go v1.18.1-20240917150400-3f349e63f44a.1 h1:EPRfGAJDTnM3J3MPGMPEs+HBezpiE/8lTWB3kdlQTGI=
2424
buf.build/gen/go/redpandadata/common/connectrpc/go v1.18.1-20240917150400-3f349e63f44a.1/go.mod h1:ZNgPT3k1W0p+EkMibCzOqoHOhNDi1ym6RH7/kGEHeKE=
2525
buf.build/gen/go/redpandadata/common/protocolbuffers/go v1.34.2-20240715174743-9c0afe867874.2/go.mod h1:wThyg02xJx4K/DA5fg0QlKts8XVPyTT86JC8hPfEzno=
26-
buf.build/gen/go/redpandadata/core/protocolbuffers/go v1.36.11-20260108182238-df92733e0119.1 h1:Hpbojb8tNZa89EzngrN24YIC1cAqV6cmHfRlbvOoOGo=
27-
buf.build/gen/go/redpandadata/core/protocolbuffers/go v1.36.11-20260108182238-df92733e0119.1/go.mod h1:5sjUVquVwNxt3Q/EhE/UW0BBJ5sgPiaVTw8//wxRULI=
2826
buf.build/gen/go/redpandadata/dataplane/connectrpc/go v1.16.2-20240620104934-3415ce922cfb.1/go.mod h1:R0DNyd3sxZqaTQrcjSgGaJqHndFCf3kKHBbXgKYzKDY=
2927
buf.build/gen/go/redpandadata/dataplane/protocolbuffers/go v1.34.2-20240620104934-3415ce922cfb.2/go.mod h1:AcLjVYZHtwlZvBrjuqyjtZtHv9BbDaHD6C92lO/gJFI=
3028
buf.build/gen/go/redpandadata/dataplane/protocolbuffers/go v1.36.2-20250404200318-65f29ddd7b29.1/go.mod h1:zTNjffbkXs9K5/sbSlagide7l0hSTs+Oa1j39yENO8M=
@@ -1050,6 +1048,7 @@ github.com/Microsoft/hcsshim v0.8.21/go.mod h1:+w2gRZ5ReXQhFOrvSQeNfhrYB/dg3oDwT
10501048
github.com/Microsoft/hcsshim v0.8.23/go.mod h1:4zegtUJth7lAvFyc6cH2gGQ5B3OFQim01nnU2M8jKDg=
10511049
github.com/Microsoft/hcsshim v0.9.2/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc=
10521050
github.com/Microsoft/hcsshim v0.9.3/go.mod h1:7pLA8lDk46WKDWlVsENo92gC0XFa8rbKfyFRBqxEbCc=
1051+
github.com/Microsoft/hcsshim v0.11.7 h1:vl/nj3Bar/CvJSYo7gIQPyRWc9f3c6IeSNavBTSZNZQ=
10531052
github.com/Microsoft/hcsshim v0.11.7/go.mod h1:MV8xMfmECjl5HdO7U/3/hFVnkmSBjAjmA09d4bExKcU=
10541053
github.com/Microsoft/hcsshim v0.12.3 h1:LS9NXqXhMoqNCplK1ApmVSfB4UnVLRDWRapB6EIlxE0=
10551054
github.com/Microsoft/hcsshim v0.12.3/go.mod h1:Iyl1WVpZzr+UkzjekHZbV8o5Z9ZkxNGx6CtY2Qg/JVQ=
@@ -3586,8 +3585,6 @@ google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/
35863585
google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
35873586
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
35883587
google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
3589-
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
3590-
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
35913588
gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U=
35923589
gopkg.in/alecthomas/kingpin.v1 v1.3.7/go.mod h1:vs0oy7ub8knYaut5kITUTmx/WeE4xRuEeOR34yEAWEA=
35933590
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc=

operator/chart/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,22 @@ Specifies whether to install experimental CRDs. If this is true both experimenta
144144

145145
**Default:** `false`
146146

147+
### [enterprise](https://artifacthub.io/packages/helm/redpanda-data/operator?modal=values&path=enterprise)
148+
149+
Enterprise (optional) For details, see the [License documentation](https://docs.redpanda.com/docs/get-started/licenses/?platform=kubernetes#redpanda-enterprise-edition).
150+
151+
**Default:**
152+
153+
```
154+
{"licenseSecretRef":{"key":""}}
155+
```
156+
157+
### [enterprise.licenseSecretRef](https://artifacthub.io/packages/helm/redpanda-data/operator?modal=values&path=enterprise.licenseSecretRef)
158+
159+
Secret name and key where the license key is stored.
160+
161+
**Default:** `{"key":""}`
162+
147163
### [fullnameOverride](https://artifacthub.io/packages/helm/redpanda-data/operator?modal=values&path=fullnameOverride)
148164

149165
Overrides the `redpanda-operator.fullname` template.

operator/chart/deployment.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ const (
4242
DefaultAPITokenMountPath = "/var/run/secrets/kubernetes.io/serviceaccount"
4343

4444
webhookCertificatePath = "/tmp/k8s-webhook-server/serving-certs"
45+
46+
licenseFilePath = "/redpanda/license"
4547
)
4648

4749
func Deployment(dot *helmette.Dot) *appsv1.Deployment {
@@ -224,6 +226,19 @@ func operatorPodVolumes(dot *helmette.Dot) []corev1.Volume {
224226
serviceAccountTokenVolume(),
225227
}
226228

229+
if values.Enterprise.LicenseSecretRef != nil &&
230+
!helmette.Empty(values.Enterprise.LicenseSecretRef.Name) {
231+
vol = append(vol, corev1.Volume{
232+
Name: "license",
233+
VolumeSource: corev1.VolumeSource{
234+
Secret: &corev1.SecretVolumeSource{
235+
DefaultMode: ptr.To(int32(420)),
236+
SecretName: values.Enterprise.LicenseSecretRef.Name,
237+
},
238+
},
239+
})
240+
}
241+
227242
if !values.Webhook.Enabled {
228243
return vol
229244
}
@@ -304,6 +319,15 @@ func operatorPodVolumesMounts(dot *helmette.Dot) []corev1.VolumeMount {
304319

305320
volMount := []corev1.VolumeMount{serviceAccountTokenVolumeMount()}
306321

322+
if values.Enterprise.LicenseSecretRef != nil &&
323+
!helmette.Empty(values.Enterprise.LicenseSecretRef.Name) {
324+
volMount = append(volMount, corev1.VolumeMount{
325+
Name: "license",
326+
MountPath: licenseFilePath,
327+
ReadOnly: true,
328+
})
329+
}
330+
307331
if !values.Webhook.Enabled {
308332
return volMount
309333
}
@@ -337,6 +361,15 @@ func operatorArguments(dot *helmette.Dot) []string {
337361
"--enable-vectorized-controllers": fmt.Sprintf("%t", values.VectorizedControllers.Enabled),
338362
}
339363

364+
if values.Enterprise.LicenseSecretRef != nil &&
365+
!helmette.Empty(values.Enterprise.LicenseSecretRef.Name) {
366+
if values.Enterprise.LicenseSecretRef.Key != "" {
367+
defaults["--license-file-path"] = fmt.Sprintf("%s/%s", licenseFilePath, values.Enterprise.LicenseSecretRef.Key)
368+
} else {
369+
defaults["--license-file-path"] = fmt.Sprintf("%s/%s", licenseFilePath, values.Enterprise.LicenseSecretRef.Name)
370+
}
371+
}
372+
340373
if values.Webhook.Enabled {
341374
defaults["--webhook-cert-path"] = webhookCertificatePath
342375
}

operator/chart/templates/_deployment.go.tpl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@
112112
{{- $_is_returning := false -}}
113113
{{- $values := $dot.Values.AsMap -}}
114114
{{- $vol := (list (get (fromJson (include "operator.serviceAccountTokenVolume" (dict "a" (list)))) "r")) -}}
115+
{{- if (and (ne (toJson $values.enterprise.licenseSecretRef) "null") (not (empty $values.enterprise.licenseSecretRef.name))) -}}
116+
{{- $vol = (concat (default (list) $vol) (list (mustMergeOverwrite (dict "name" "") (mustMergeOverwrite (dict) (dict "secret" (mustMergeOverwrite (dict) (dict "defaultMode" ((420 | int) | int) "secretName" $values.enterprise.licenseSecretRef.name)))) (dict "name" "license")))) -}}
117+
{{- end -}}
115118
{{- if (not $values.webhook.enabled) -}}
116119
{{- $_is_returning = true -}}
117120
{{- (dict "r" $vol) | toJson -}}
@@ -148,6 +151,9 @@
148151
{{- $_is_returning := false -}}
149152
{{- $values := $dot.Values.AsMap -}}
150153
{{- $volMount := (list (get (fromJson (include "operator.serviceAccountTokenVolumeMount" (dict "a" (list)))) "r")) -}}
154+
{{- if (and (ne (toJson $values.enterprise.licenseSecretRef) "null") (not (empty $values.enterprise.licenseSecretRef.name))) -}}
155+
{{- $volMount = (concat (default (list) $volMount) (list (mustMergeOverwrite (dict "name" "" "mountPath" "") (dict "name" "license" "mountPath" "/redpanda/license" "readOnly" true)))) -}}
156+
{{- end -}}
151157
{{- if (not $values.webhook.enabled) -}}
152158
{{- $_is_returning = true -}}
153159
{{- (dict "r" $volMount) | toJson -}}
@@ -166,6 +172,13 @@
166172
{{- $_is_returning := false -}}
167173
{{- $values := $dot.Values.AsMap -}}
168174
{{- $defaults := (dict "--health-probe-bind-address" ":8081" "--metrics-bind-address" ":8443" "--leader-elect" "" "--enable-console" "true" "--log-level" $values.logLevel "--webhook-enabled" (printf "%t" $values.webhook.enabled) "--configurator-tag" (get (fromJson (include "operator.containerTag" (dict "a" (list $dot)))) "r") "--configurator-base-image" $values.image.repository "--enable-vectorized-controllers" (printf "%t" $values.vectorizedControllers.enabled)) -}}
175+
{{- if (and (ne (toJson $values.enterprise.licenseSecretRef) "null") (not (empty $values.enterprise.licenseSecretRef.name))) -}}
176+
{{- if (ne $values.enterprise.licenseSecretRef.key "") -}}
177+
{{- $_ := (set $defaults "--license-file-path" (printf "%s/%s" "/redpanda/license" $values.enterprise.licenseSecretRef.key)) -}}
178+
{{- else -}}
179+
{{- $_ := (set $defaults "--license-file-path" (printf "%s/%s" "/redpanda/license" $values.enterprise.licenseSecretRef.name)) -}}
180+
{{- end -}}
181+
{{- end -}}
169182
{{- if $values.webhook.enabled -}}
170183
{{- $_ := (set $defaults "--webhook-cert-path" "/tmp/k8s-webhook-server/serving-certs") -}}
171184
{{- end -}}

0 commit comments

Comments
 (0)