Skip to content

Commit

Permalink
clean-ups the code around defaulting oidc
Browse files Browse the repository at this point in the history
  • Loading branch information
Disper committed Sep 24, 2024
1 parent 75771f8 commit 81be84e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 86 deletions.
13 changes: 12 additions & 1 deletion internal/controller/runtime/fsm/runtime_fsm_configure_oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,23 @@ func DefaultAdditionalOidcIfNotPresent(runtime *imv1.Runtime, cfg RCCfg) {

if nil == additionalOidcConfig {
additionalOidcConfig = &[]gardener.OIDCConfig{}
defaultOIDCConfig := shoot.CreateDefaultOIDCConfig(cfg.Kubernetes.DefaultSharedIASTenant)
defaultOIDCConfig := CreateDefaultOIDCConfig(cfg.Kubernetes.DefaultSharedIASTenant)
*additionalOidcConfig = append(*additionalOidcConfig, defaultOIDCConfig)
runtime.Spec.Shoot.Kubernetes.KubeAPIServer.AdditionalOidcConfig = additionalOidcConfig
}
}

func CreateDefaultOIDCConfig(defaultSharedIASTenant shoot.OidcProvider) gardener.OIDCConfig {
return gardener.OIDCConfig{
ClientID: &defaultSharedIASTenant.ClientID,
GroupsClaim: &defaultSharedIASTenant.GroupsClaim,
IssuerURL: &defaultSharedIASTenant.IssuerURL,
SigningAlgs: defaultSharedIASTenant.SigningAlgs,
UsernameClaim: &defaultSharedIASTenant.UsernameClaim,
UsernamePrefix: &defaultSharedIASTenant.UsernamePrefix,
}
}

func sFnConfigureOidc(ctx context.Context, m *fsm, s *systemState) (stateFn, *ctrl.Result, error) {
m.log.Info("Configure OIDC state")

Expand Down
3 changes: 0 additions & 3 deletions internal/gardener/shoot/extender/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ func NewOidcExtender(clientId, groupsClaim, issuerURL, usernameClaim, usernamePr
}

oidcConfig := runtime.Spec.Shoot.Kubernetes.KubeAPIServer.OidcConfig

if ShouldDefaultOidcConfig(oidcConfig) {
oidcConfig = gardener.OIDCConfig{
ClientID: &clientId,
Expand All @@ -32,13 +31,11 @@ func NewOidcExtender(clientId, groupsClaim, issuerURL, usernameClaim, usernamePr
UsernamePrefix: &usernamePrefix,
}
}

setKubeAPIServerOIDCConfig(shoot, oidcConfig)

return nil
}
}

func CanEnableExtension(runtime imv1.Runtime) bool {
canEnable := true
createdByMigrator := runtime.Labels["operator.kyma-project.io/created-by-migrator"]
Expand Down
30 changes: 0 additions & 30 deletions internal/gardener/shoot/oidc_defaulter.go

This file was deleted.

52 changes: 0 additions & 52 deletions internal/gardener/shoot/oidc_defaulter_test.go

This file was deleted.

0 comments on commit 81be84e

Please sign in to comment.