Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth enabled + parameters updated #77

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type RedisSpec struct {
Sentinel *SentinelProperties `json:"sentinel,omitempty"`
Metrics *MetricsProperties `json:"metrics,omitempty"`
TLS *TLSProperties `json:"tls,omitempty"`
Auth *AuthProperties `json:"auth,omitempty"`
Persistence *PersistenceProperties `json:"persistence,omitempty"`
Binding *BindingProperties `json:"binding,omitempty"`
}
Expand Down Expand Up @@ -69,6 +70,12 @@ type TLSProperties struct {
CertManager *CertManagerProperties `json:"certManager,omitempty"`
}

// AuthProperties models for authentication
type AuthProperties struct {
Enabled bool `json:"enabled,omitempty"`
ExistingSecret string `json:"existingSecret,omitempty"`
}

// CertManagerProperties models cert-manager related attributes
type CertManagerProperties struct {
Issuer *ObjectReference `json:"issuer,omitempty"`
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions crds/cache.cs.sap.com_redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,14 @@ spec:
type: array
type: object
type: object
auth:
description: AuthProperties models for authentication
properties:
enabled:
type: boolean
existingSecret:
type: string
type: object
binding:
description: BindingProperties models custom properties for the generated
binding secret
Expand Down
7 changes: 7 additions & 0 deletions pkg/operator/data/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ fullnameOverride: {{ $fullname }}
{{- $metricsServiceMonitorEnabled := (dig "metrics" "monitor" "enabled" false .) }}
{{- $metricsPrometheusRuleEnabled := (dig "metrics" "prometheusRule" "enabled" false .) }}
{{- $tlsEnabled := (dig "tls" "enabled" false .) }}
{{- $authEnabled := (dig "auth" "enabled" true .) }}
{{- $persistenceEnabled := (dig "persistence" "enabled" false .) }}

{{- with .Version}}
Expand Down Expand Up @@ -203,6 +204,12 @@ tls:
{{- end }}
{{- end }}

auth:
enabled: {{ $authEnabled }}
{{- if and .auth .auth.existingSecret }}
existingSecret: {{ .auth.existingSecret }}
{{- end }}

networkPolicy:
enabled: true
extraEgress:
Expand Down
17 changes: 17 additions & 0 deletions tests/e2e/operator_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,23 @@
doSomethingWithRedis(redis)
})

It("should deploy Redis with one master and zero read replicas without authentication", func() {

Check warning on line 261 in tests/e2e/operator_suite_test.go

View check run for this annotation

In Solidarity / Inclusive Language

Match Found

Please consider an alternative to `master`. Possibilities include: `primary`, `main`, `leader`, `active`, `writer`
Raw output
/\b(?!masterdata|masterdata\w+\b)master/gi
redis := &operatorv1alpha1.Redis{
ObjectMeta: metav1.ObjectMeta{
Namespace: namespace,
GenerateName: "test-",
},
Spec: operatorv1alpha1.RedisSpec{
Auth: &operatorv1alpha1.AuthProperties{
Enabled: false,
},
},
}
defer deleteRedis(redis, true, "60s")
createRedis(redis, true, "300s")
doSomethingWithRedis(redis)
})

It("should deploy Redis with sentinel (three nodes), with metrics, TLS, persistence enabled", func() {
redis := &operatorv1alpha1.Redis{
ObjectMeta: metav1.ObjectMeta{
Expand Down
Loading