Skip to content

Commit

Permalink
console: fix godoc, move extra env to end of genEnvVars()
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand authored and RafalKorepta committed Jan 16, 2025
1 parent dd19253 commit 4911bfb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
3 changes: 1 addition & 2 deletions operator/api/vectorized/v1alpha1/console_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,7 @@ type Deployment struct {
// See: https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`

// +kubebuilder:pruning:PreserveUnknownFields
// Adds extra environment variables to the Pods that run Redpanda Console.
// ExtraEnv adds extra environment variables to the Pods that run Redpanda Console.
ExtraEnv []corev1.EnvVar `json:"extraEnv,omitempty"`
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ spec:
Deployment resource
properties:
extraEnv:
description: Adds extra environment variables to the Pods that
run Redpanda Console.
description: ExtraEnv adds extra environment variables to the
Pods that run Redpanda Console.
items:
description: EnvVar represents an environment variable present
in a Container.
Expand Down Expand Up @@ -505,7 +505,6 @@ spec:
- name
type: object
type: array
x-kubernetes-preserve-unknown-fields: true
image:
type: string
imagePullPolicy:
Expand Down
9 changes: 3 additions & 6 deletions operator/pkg/console/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,12 +585,6 @@ func (d *Deployment) getContainers(ctx context.Context, ss map[string]string) ([

//nolint:funlen // the function could be refactored later
func (d *Deployment) genEnvVars(ctx context.Context) (envars []corev1.EnvVar, err error) {
// first initialize to any custom provided env vars
// but we we override any of the ones we need to generate from other configs
if len(d.consoleobj.Spec.Deployment.ExtraEnv) > 0 {
envars = append(envars, d.consoleobj.Spec.Deployment.ExtraEnv...)
}

if d.clusterobj.IsSASLOnInternalEnabled() {
envars = append(envars, corev1.EnvVar{
Name: kafkaSASLBasicAuthPasswordEnvVar,
Expand Down Expand Up @@ -692,5 +686,8 @@ func (d *Deployment) genEnvVars(ctx context.Context) (envars []corev1.EnvVar, er
}
}

// add any custom provided env vars
envars = append(envars, d.consoleobj.Spec.Deployment.ExtraEnv...)

return envars, nil
}

0 comments on commit 4911bfb

Please sign in to comment.