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

Add UTOPIA_CONSOLE_USER environment variable to console containers #334

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ manifests: generate
install-tools:
go install github.com/onsi/ginkgo/ginkgo@v1.16.5
go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.10.0
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
go install sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20230216140739-c98506dc3b8e
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the latest version of this supports golang >1.22. Rather than try to upgrade go I've just pinned to an older version that works without changing anything else


install-tools-homebrew:
brew install kubernetes-cli kustomize kind
Expand Down
2 changes: 2 additions & 0 deletions controllers/workloads/console/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,8 @@ func (r *ConsoleReconciler) buildJob(logger logr.Logger, name types.NamespacedNa
container.Stdin = true
container.TTY = true
}

container.Env = append(container.Env, corev1.EnvVar{Name: "UTOPIA_CONSOLE_USER", Value: csl.Spec.User})
}

if numContainers > 1 {
Expand Down
4 changes: 4 additions & 0 deletions controllers/workloads/console/integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ var _ = Describe("Console", func() {
job.Spec.Template.Spec.Containers[0].Args).To(Equal([]string{"console", "--help"}),
"job's args does not match the other command elements in the spec",
)
Expect(
job.Spec.Template.Spec.Containers[0].Env).To(ContainElement(corev1.EnvVar{Name: "UTOPIA_CONSOLE_USER", Value: "admin"}),
"job's env does not contain valid UTOPIA_CONSOLE_USER",
)
Expect(
*job.Spec.BackoffLimit).To(BeNumerically("==", 0),
"job's BackoffLimit is not 0",
Expand Down
Loading