Skip to content

Commit

Permalink
dex-config namespace configurable (#4499)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivam-nagar23 authored Jan 9, 2024
1 parent 42fb745 commit 33430e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
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

0 comments on commit 33430e1

Please sign in to comment.