Skip to content

Commit 2df607c

Browse files
committed
operator: add support for RedpandaCloud provider
1 parent 40abffd commit 2df607c

File tree

5 files changed

+72
-4
lines changed

5 files changed

+72
-4
lines changed

src/go/k8s/apis/redpanda/v1alpha1/console_enterprise_types.go

+16
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@ type EnterpriseLogin struct {
2626
JWTSecretRef SecretKeyRef `json:"jwtSecretRef"`
2727

2828
Google *EnterpriseLoginGoogle `json:"google,omitempty"`
29+
30+
RedpandaCloud *EnterpriseLoginRedpandaCloud `json:"redpandaCloud,omitempty"`
31+
}
32+
33+
// EnterpriseLoginRedpandaCloud defines configurable fields for RedpandaCloud SSO provider
34+
type EnterpriseLoginRedpandaCloud struct {
35+
Enabled bool `json:"enabled" yaml:"enabled"`
36+
37+
// Domain is the domain of the auth server
38+
Domain string `json:"domain" yaml:"domain"`
39+
40+
// Audience is the domain where this auth is intended for
41+
Audience string `json:"audience" yaml:"audience"`
42+
43+
// AllowedOrigins indicates if response is allowed from given origin
44+
AllowedOrigins string `json:"allowedOrigins,omitempty" yaml:"allowedOrigins,omitempty"`
2945
}
3046

3147
// IsGoogleLoginEnabled returns true if Google SSO provider is enabled

src/go/k8s/apis/redpanda/v1alpha1/zz_generated.deepcopy.go

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/go/k8s/config/crd/bases/redpanda.vectorized.io_consoles.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,28 @@ spec:
350350
- name
351351
- namespace
352352
type: object
353+
redpandaCloud:
354+
description: EnterpriseLoginRedpandaCloud defines configurable
355+
fields for RedpandaCloud provider
356+
properties:
357+
allowedOrigins:
358+
description: AllowedOrigins indicates if response is allowed
359+
from given origin
360+
type: string
361+
audience:
362+
description: Audience is the domain where this auth is intended
363+
for
364+
type: string
365+
domain:
366+
description: Domain is the domain of the auth server
367+
type: string
368+
enabled:
369+
type: boolean
370+
required:
371+
- audience
372+
- domain
373+
- enabled
374+
type: object
353375
required:
354376
- enabled
355377
- jwtSecretRef

src/go/k8s/pkg/console/configmap.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,14 @@ func (cm *ConfigMap) genLogin(ctx context.Context) (e EnterpriseLogin, err error
203203
}
204204
enterpriseLogin.JWTSecret = string(jwt)
205205

206-
switch { // nolint:gocritic // will support more providers
206+
switch {
207+
case provider.RedpandaCloud != nil:
208+
enterpriseLogin.RedpandaCloud = &redpandav1alpha1.EnterpriseLoginRedpandaCloud{
209+
Enabled: provider.RedpandaCloud.Enabled,
210+
Domain: provider.RedpandaCloud.Domain,
211+
Audience: provider.RedpandaCloud.Audience,
212+
AllowedOrigins: provider.RedpandaCloud.AllowedOrigins,
213+
}
207214
case provider.Google != nil:
208215
cc := redpandav1alpha1.SecretKeyRef{
209216
Namespace: provider.Google.ClientCredentialsRef.Namespace,

src/go/k8s/pkg/console/console.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"github.com/cloudhut/common/rest"
1515
"github.com/redpanda-data/console/backend/pkg/connect"
1616
"github.com/redpanda-data/console/backend/pkg/kafka"
17+
18+
redpandav1alpha1 "github.com/redpanda-data/redpanda/src/go/k8s/apis/redpanda/v1alpha1"
1719
)
1820

1921
const (
@@ -54,9 +56,10 @@ type EnterpriseRBAC struct {
5456

5557
// EnterpriseLogin is the Console Enterprise Login config
5658
type EnterpriseLogin struct {
57-
Enabled bool `json:"enabled" yaml:"enabled"`
58-
JWTSecret string `json:"jwtSecret,omitempty" yaml:"jwtSecret,omitempty"`
59-
Google *EnterpriseLoginGoogle `json:"google,omitempty" yaml:"google,omitempty"`
59+
Enabled bool `json:"enabled" yaml:"enabled"`
60+
JWTSecret string `json:"jwtSecret,omitempty" yaml:"jwtSecret,omitempty"`
61+
Google *EnterpriseLoginGoogle `json:"google,omitempty" yaml:"google,omitempty"`
62+
RedpandaCloud *redpandav1alpha1.EnterpriseLoginRedpandaCloud `json:"redpandaCloud,omitempty" yaml:"redpandaCloud,omitempty"`
6063
}
6164

6265
// EnterpriseLoginGoogle is the Console Enterprise Google SSO config

0 commit comments

Comments
 (0)