Skip to content
Open
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
24 changes: 21 additions & 3 deletions apis/controller/v1alpha1/devworkspaceoperatorconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,31 @@ type RegistryConfig struct {
// AuthSecret is the name of a Kubernetes secret of
// type kubernetes.io/dockerconfigjson.
// The secret is expected to be in the same namespace the workspace is running in.
// If secret is not found in the workspace namespace, the operator will look for the secret
// in the namespace where the operator is running in.
// as the DevWorkspaceOperatorCongfig.
// If secret is not found in the workspace namespace and copyOperatorAuthSecret is true,
// the operator will copy the secret from the operator namespace to the workspace namespace.
// The secret must contain "controller.devfile.io/watch-secret=true" label so that it can be
// recognized by the operator.
// +kubebuilder:validation:Optional
AuthSecret string `json:"authSecret,omitempty"`
// CopyOperatorAuthSecret controls whether the operator should copy the authentication
// secret from the operator namespace to the workspace namespace when it's not found
// in the workspace namespace.
//
// If true: The operator will copy the secret from the operator namespace
// if it's not found in the workspace namespace. This provides automatic configuration
// but exposes operator-level credentials to workspace users.
Comment on lines +93 to +95
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it's a bit verbose,

Can we update thee If true... section to:

If true, this enables the fallback mechanism where the operator will copy the secret from the operator namespace.

//
// If false (default): The operator will not copy the secret. Users must manually create a secret
// with the configured name in their workspace namespace. This is more secure as it allows
// users to provide scoped credentials with minimal privileges.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think it's a bit verbose,

Can we update the If false... section to:

If false, the operator will not copy the secret to workspace namespaces. 

//
// Note: Regardless of this setting, if a secret already exists in the workspace namespace,
// it will never be overwritten. User-provided secrets are always respected.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// it will never be overwritten. User-provided secrets are always respected.
// it will never be overwritten.

//
// Defaults to false.
// +kubebuilder:validation:Optional
// +kubebuilder:default=false
CopyOperatorAuthSecret *bool `json:"copyOperatorAuthSecret,omitempty"`
}

type OrasConfig struct {
Expand Down
7 changes: 6 additions & 1 deletion apis/controller/v1alpha1/zz_generated.deepcopy.go

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

48 changes: 31 additions & 17 deletions controllers/backupcronjob/backupcronjob_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: pointer.Bool(true),
Schedule: "* * * * *",
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand All @@ -148,7 +149,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand All @@ -173,7 +175,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -206,7 +209,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule1,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -242,7 +246,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule1,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand All @@ -268,7 +273,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -303,8 +309,9 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
AuthSecret: "non-existent",
Path: "fake-registry",
AuthSecret: "non-existent",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -335,7 +342,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
OrasConfig: &controllerv1alpha1.OrasConfig{
ExtraArgs: "--extra-arg1",
Expand Down Expand Up @@ -392,7 +400,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Schedule: schedule,
BackoffLimit: &backoffLimit,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -428,7 +437,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -469,7 +479,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -500,8 +511,9 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "my-registry:5000",
AuthSecret: "my-secret",
Path: "my-registry:5000",
AuthSecret: "my-secret",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -536,8 +548,9 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "my-registry:5000",
AuthSecret: "my-secret",
Path: "my-registry:5000",
AuthSecret: "my-secret",
CopyOperatorAuthSecret: pointer.Bool(true),
},
},
},
Expand Down Expand Up @@ -572,7 +585,8 @@ var _ = Describe("BackupCronJobReconciler", func() {
Enable: &enabled,
Schedule: schedule,
Registry: &controllerv1alpha1.RegistryConfig{
Path: "fake-registry",
Path: "fake-registry",
CopyOperatorAuthSecret: pointer.Bool(true),
},
OrasConfig: &controllerv1alpha1.OrasConfig{
ExtraArgs: "--extra-arg1",
Expand Down

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

25 changes: 22 additions & 3 deletions deploy/deployment/kubernetes/combined.yaml

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

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

25 changes: 22 additions & 3 deletions deploy/deployment/openshift/combined.yaml

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

Loading
Loading