Skip to content

Commit 756c6da

Browse files
committed
fix config and test
1 parent 4d791f8 commit 756c6da

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

internal/config/config_managedcontrolplane.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ type ManagedControlPlaneConfig struct {
2828
}
2929

3030
func (c *ManagedControlPlaneConfig) Default(_ *field.Path) error {
31-
c.DefaultOIDCProvider.Default()
32-
if c.DefaultOIDCProvider.Name == "" {
33-
c.DefaultOIDCProvider.Name = corev2alpha1.DefaultOIDCProviderName
31+
if c.DefaultOIDCProvider != nil {
32+
c.DefaultOIDCProvider.Default()
33+
if c.DefaultOIDCProvider.Name == "" {
34+
c.DefaultOIDCProvider.Name = corev2alpha1.DefaultOIDCProviderName
35+
}
3436
}
3537
if c.MCPClusterPurpose == "" {
3638
c.MCPClusterPurpose = corev2alpha1.DefaultMCPClusterPurpose
@@ -47,7 +49,7 @@ func (c *ManagedControlPlaneConfig) Validate(fldPath *field.Path) error {
4749
if c.ReconcileMCPEveryXDays < 0 {
4850
errs = append(errs, field.Invalid(fldPath.Child("reconcileMCPEveryXDays"), c.ReconcileMCPEveryXDays, "reconcile interval must be 0 or greater"))
4951
}
50-
if c.DefaultOIDCProvider == nil {
52+
if c.DefaultOIDCProvider != nil {
5153
oidcFldPath := fldPath.Child("defaultOIDCProvider")
5254
if len(c.DefaultOIDCProvider.RoleBindings) > 0 {
5355
errs = append(errs, field.Forbidden(oidcFldPath.Child("roleBindings"), "role bindings are specified in the MCP spec and may not be set in the config"))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
managedControlPlane:
22
mcpClusterPurpose: mcp
33
reconcileMCPEveryXDays: 7
4-
standardOIDCProvider:
4+
defaultOIDCProvider:
55
issuer: https://example.com/oidc
66
groupsPrefix: 'mygroups:'
77
usernamePrefix: 'myuser:'

0 commit comments

Comments
 (0)