@@ -16,9 +16,9 @@ type ManagedControlPlaneConfig struct {
1616 // MCPClusterPurpose is the purpose that is used for ClusterRequests created for ManagedControlPlane resources.
1717 MCPClusterPurpose string `json:"mcpClusterPurpose"`
1818
19- // StandardOIDCProvider is the standard OIDC provider that is enabled for all ManagedControlPlane resources, unless explicitly disabled.
19+ // DefaultOIDCProvider is the standard OIDC provider that is enabled for all ManagedControlPlane resources, unless explicitly disabled.
2020 // If nil, no standard OIDC provider will be used.
21- StandardOIDCProvider * commonapi.OIDCProviderConfig `json:"standardOIDCProvider ,omitempty"`
21+ DefaultOIDCProvider * commonapi.OIDCProviderConfig `json:"defaultOIDCProvider ,omitempty"`
2222
2323 // ReconcileMCPEveryXDays specifies after how many days an MCP should be reconciled.
2424 // This is useful if the AccessRequests created by the MCP use an expiring authentication method and the MCP needs to refresh the access regularly.
@@ -28,9 +28,12 @@ type ManagedControlPlaneConfig struct {
2828}
2929
3030func (c * ManagedControlPlaneConfig ) Default (_ * field.Path ) error {
31- c .StandardOIDCProvider .Default ()
32- if c .StandardOIDCProvider .Name == "" {
33- c .StandardOIDCProvider .Name = corev2alpha1 .DefaultOIDCProviderName
31+ c .DefaultOIDCProvider .Default ()
32+ if c .DefaultOIDCProvider .Name == "" {
33+ c .DefaultOIDCProvider .Name = corev2alpha1 .DefaultOIDCProviderName
34+ }
35+ if c .MCPClusterPurpose == "" {
36+ c .MCPClusterPurpose = corev2alpha1 .DefaultMCPClusterPurpose
3437 }
3538 return nil
3639}
@@ -44,13 +47,13 @@ func (c *ManagedControlPlaneConfig) Validate(fldPath *field.Path) error {
4447 if c .ReconcileMCPEveryXDays < 0 {
4548 errs = append (errs , field .Invalid (fldPath .Child ("reconcileMCPEveryXDays" ), c .ReconcileMCPEveryXDays , "reconcile interval must be 0 or greater" ))
4649 }
47- if c .StandardOIDCProvider == nil {
48- oidcFldPath := fldPath .Child ("standardOIDCProvider " )
49- if len (c .StandardOIDCProvider .RoleBindings ) > 0 {
50+ if c .DefaultOIDCProvider == nil {
51+ oidcFldPath := fldPath .Child ("defaultOIDCProvider " )
52+ if len (c .DefaultOIDCProvider .RoleBindings ) > 0 {
5053 errs = append (errs , field .Forbidden (oidcFldPath .Child ("roleBindings" ), "role bindings are specified in the MCP spec and may not be set in the config" ))
5154 }
52- if c .StandardOIDCProvider .Name != "" && c .StandardOIDCProvider .Name != corev2alpha1 .DefaultOIDCProviderName {
53- errs = append (errs , field .Invalid (oidcFldPath .Child ("name" ), c .StandardOIDCProvider .Name , fmt .Sprintf ("standard OIDC provider name must be '%s' or left empty (in which case it will be defaulted)" , corev2alpha1 .DefaultOIDCProviderName )))
55+ if c .DefaultOIDCProvider .Name != "" && c .DefaultOIDCProvider .Name != corev2alpha1 .DefaultOIDCProviderName {
56+ errs = append (errs , field .Invalid (oidcFldPath .Child ("name" ), c .DefaultOIDCProvider .Name , fmt .Sprintf ("standard OIDC provider name must be '%s' or left empty (in which case it will be defaulted)" , corev2alpha1 .DefaultOIDCProviderName )))
5457 }
5558 }
5659
0 commit comments