Skip to content

feat: Configurable namespace for secrets in dex config #4499

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

Merged
merged 3 commits into from
Jan 9, 2024
Merged
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
5 changes: 2 additions & 3 deletions pkg/auth/sso/SSOLoginService.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (

"github.com/devtron-labs/devtron/api/bean"
util2 "github.com/devtron-labs/devtron/util"
"github.com/devtron-labs/devtron/util/argo"
"github.com/go-pg/pg"
"go.uber.org/zap"
"sigs.k8s.io/yaml"
Expand Down Expand Up @@ -233,7 +232,7 @@ func (impl SSOLoginServiceImpl) updateDexConfig(request *bean.SSOLoginDto) (bool
retryCount := 0
for !updateSuccess && retryCount < 3 {
retryCount = retryCount + 1
secret, err := impl.K8sUtil.GetSecret(argo.DEVTRONCD_NAMESPACE, impl.devtronSecretConfig.DevtronSecretName, k8sClient)
secret, err := impl.K8sUtil.GetSecret(impl.devtronSecretConfig.DevtronDexSecretNamespace, impl.devtronSecretConfig.DevtronSecretName, k8sClient)
if err != nil {
impl.logger.Errorw("exception in fetching configmap", "error", err)
return flag, err
Expand All @@ -250,7 +249,7 @@ func (impl SSOLoginServiceImpl) updateDexConfig(request *bean.SSOLoginDto) (bool
data["dex.config"] = []byte(updatedData["dex.config"])
data["url"] = []byte(request.Url)
secret.Data = data
_, err = impl.K8sUtil.UpdateSecret(argo.DEVTRONCD_NAMESPACE, secret, k8sClient)
_, err = impl.K8sUtil.UpdateSecret(impl.devtronSecretConfig.DevtronDexSecretNamespace, secret, k8sClient)
if err != nil {
impl.logger.Warnw("config map update failed for sso config", "err", err)
continue
Expand Down
3 changes: 2 additions & 1 deletion util/GlobalConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ func GetGlobalEnvVariables() (*GlobalEnvVariables, error) {
}

type DevtronSecretConfig struct {
DevtronSecretName string `env:"DEVTRON_SECRET_NAME" envDefault:"devtron-secret"`
DevtronSecretName string `env:"DEVTRON_SECRET_NAME" envDefault:"devtron-secret"`
DevtronDexSecretNamespace string `env:"DEVTRON_DEX_SECRET_NAMESPACE" envDefault:"devtroncd"`
}

func GetDevtronSecretName() (*DevtronSecretConfig, error) {
Expand Down