Skip to content

Commit

Permalink
Add Console as subchart in Redpanda chart
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalKorepta committed Oct 10, 2024
1 parent 6f567fc commit f33094a
Show file tree
Hide file tree
Showing 13 changed files with 10,110 additions and 7,534 deletions.
2 changes: 1 addition & 1 deletion charts/console/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func Deployment(dot *helmette.Dot) *appsv1.Deployment {
replicas = ptr.To(values.ReplicaCount)
}

var initContainers []corev1.Container
initContainers := []corev1.Container{}
if !helmette.Empty(values.InitContainers.ExtraInitContainers) {
initContainers = helmette.UnmarshalYamlArray[corev1.Container](helmette.Tpl(*values.InitContainers.ExtraInitContainers, dot))
}
Expand Down
2 changes: 1 addition & 1 deletion charts/console/templates/_deployment.go.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{{- if (not $values.autoscaling.enabled) -}}
{{- $replicas = ($values.replicaCount | int) -}}
{{- end -}}
{{- $initContainers := (coalesce nil) -}}
{{- $initContainers := (list ) -}}
{{- if (not (empty $values.initContainers.extraInitContainers)) -}}
{{- $initContainers = (fromYamlArray (tpl $values.initContainers.extraInitContainers $dot)) -}}
{{- end -}}
Expand Down
50 changes: 25 additions & 25 deletions charts/console/testdata/template-cases.golden.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -424,7 +424,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -667,7 +667,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -924,7 +924,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: vQhDS
securityContext:
Expand Down Expand Up @@ -1430,7 +1430,7 @@ spec:
imagePullSecrets:
- {}
- name: YPVBzxvx
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: TeCy
securityContext:
Expand Down Expand Up @@ -1819,7 +1819,7 @@ spec:
name: QmzFlXE
subPath: ""
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: JT0MK
securityContext:
Expand Down Expand Up @@ -2759,7 +2759,7 @@ spec:
name: configs
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: 0fXQqWA96
securityContext:
Expand Down Expand Up @@ -2999,7 +2999,7 @@ spec:
subPath: ""
imagePullSecrets:
- name: x42RbB4KLm
initContainers: null
initContainers: []
nodeSelector:
OBRBvRK: hMXDLGN5
ky: sv
Expand Down Expand Up @@ -3334,7 +3334,7 @@ spec:
terminationMessagePolicy: Ƒh庛ʘ$8L藑奾ń4說
workingDir: rgrA
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: x0ISc2
securityContext:
Expand Down Expand Up @@ -5282,7 +5282,7 @@ spec:
stdinOnce: true
terminationMessagePath: c0e
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: XtKq
securityContext:
Expand Down Expand Up @@ -5860,7 +5860,7 @@ spec:
name: TB
workingDir: iKksE1
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: qcIlT
securityContext:
Expand Down Expand Up @@ -6273,7 +6273,7 @@ spec:
workingDir: Mh
imagePullSecrets:
- name: vlnGQbo3y
initContainers: null
initContainers: []
nodeSelector:
Vckw: ifBZ9p7
priorityClassName: 6jxv
Expand Down Expand Up @@ -6552,7 +6552,7 @@ spec:
subPath: qdDtjk
subPathExpr: Ew
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: FERw
securityContext:
Expand Down Expand Up @@ -22204,7 +22204,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -22421,7 +22421,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -22656,7 +22656,7 @@ spec:
name: oidc-issuer-tls
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -22884,7 +22884,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -23120,7 +23120,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -23347,7 +23347,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -23563,7 +23563,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -23779,7 +23779,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -24220,7 +24220,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -24468,7 +24468,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -24684,7 +24684,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down Expand Up @@ -24902,7 +24902,7 @@ spec:
name: secrets
readOnly: true
imagePullSecrets: []
initContainers: null
initContainers: []
nodeSelector: {}
priorityClassName: ""
securityContext:
Expand Down
2 changes: 1 addition & 1 deletion charts/redpanda/Chart.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ dependencies:
repository: https://charts.redpanda.com
version: 0.1.13
digest: sha256:3023f8ca61cf80050d0f0e73f9e86b73ae796717c651be8765c9db90996e5462
generated: "2024-09-26T22:13:55.854012+02:00"
generated: "2024-10-10T16:19:23.795965+02:00"
5 changes: 4 additions & 1 deletion charts/redpanda/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

certmanagerv1 "github.com/cert-manager/cert-manager/pkg/apis/certmanager/v1"
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
"github.com/redpanda-data/helm-charts/charts/console"
"github.com/redpanda-data/helm-charts/pkg/gotohelm"
"github.com/redpanda-data/helm-charts/pkg/gotohelm/helmette"
"github.com/redpanda-data/helm-charts/pkg/kube"
Expand All @@ -40,7 +41,7 @@ var (
defaultValuesYAML []byte

// Chart is the go version of the redpanda helm chart.
Chart = gotohelm.MustLoad(chartYAML, defaultValuesYAML, render)
Chart = gotohelm.MustLoad(chartYAML, defaultValuesYAML, render, console.Chart)
)

// +gotohelm:ignore=true
Expand Down Expand Up @@ -114,6 +115,8 @@ func render(dot *helmette.Dot) []kube.Object {
manifests = append(manifests, obj)
}

manifests = append(manifests, renderConsole(dot)...)

// NB: This slice may contain nil interfaces!
// Filtering happens elsewhere, don't call this function directly if you
// can avoid it.
Expand Down
16 changes: 13 additions & 3 deletions charts/redpanda/chart_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"time"

"github.com/pkg/errors"
"github.com/redpanda-data/helm-charts/charts/console"
"github.com/redpanda-data/helm-charts/charts/redpanda"
"github.com/redpanda-data/helm-charts/pkg/gotohelm/helmette"
"github.com/redpanda-data/helm-charts/pkg/helm"
Expand Down Expand Up @@ -685,7 +686,7 @@ func TestLabels(t *testing.T) {
values := &redpanda.PartialValues{
CommonLabels: labels,
// This guarantee does not currently extend to console.
Console: &redpanda.PartialConsole{Enabled: ptr.To(false)},
Console: &console.PartialValues{Enabled: ptr.To(false)},
// Nor connectors.
Connectors: &redpanda.PartialConnectors{Enabled: ptr.To(false)},
}
Expand Down Expand Up @@ -748,7 +749,16 @@ func TestGoHelmEquivalence(t *testing.T) {
Enabled: ptr.To(false),
}

values.Console = &redpanda.PartialConsole{Enabled: ptr.To(false)}
values.Console = &console.PartialValues{
Enabled: ptr.To(true),
Secret: &console.PartialSecretConfig{
Login: &console.PartialLoginSecrets{JWTSecret: ptr.To("SECRET")},
},
Ingress: &console.PartialIngressConfig{
Enabled: ptr.To(true),
},
Tests: &console.PartialEnableable{Enabled: ptr.To(false)},
}
values.Connectors = &redpanda.PartialConnectors{Enabled: ptr.To(false)}

goObjs, err := redpanda.Chart.Render(kube.Config{}, helmette.Release{
Expand Down Expand Up @@ -780,7 +790,7 @@ func TestGoHelmEquivalence(t *testing.T) {
return strings.Compare(aStr, bStr)
})

const stsIdx = 7
const stsIdx = 12

// resource.Quantity is a special object. To Ensure they compare correctly,
// we'll round trip it through JSON so the internal representations will
Expand Down
Loading

0 comments on commit f33094a

Please sign in to comment.