File tree Expand file tree Collapse file tree 9 files changed +490
-8
lines changed
controllers/managedcontrolplane Expand file tree Collapse file tree 9 files changed +490
-8
lines changed Original file line number Diff line number Diff line change @@ -84,13 +84,16 @@ const (
8484 // SecretKeyCreationTimestamp is the name of the key in the AccessRequest secret that contains the creation timestamp.
8585 // This value is optional and must not be set for non-expiring authentication methods.
8686 SecretKeyCreationTimestamp = "creationTimestamp"
87- // SecretKeyCAData is the name of the key in the AccessRequest secret that contains the CA data.
88- // This value is optional and must not be set.
89- SecretKeyCAData = "caData"
90- // SecretKeyHost is the name of the key in the AccessRequest secret that contains the host.
91- // This value is optional and must not be set.
92- SecretKeyHost = "host"
9387 // SecretKeyClientID is the name of the key in the AccessRequest secret that contains the client ID.
9488 // This value is optional and must not be set for non-OIDC-based authentication methods.
9589 SecretKeyClientID = "clientID"
90+ // SecretKeyHost is the name of the key in the AccessRequest secret that contains the host of the cluster.
91+ // This value is optional.
92+ SecretKeyHost = "host"
93+ // SecretKeyCA is the name of the key in the AccessRequest secret that contains the CA certificate of the cluster.
94+ // This value is optional.
95+ SecretKeyCA = "ca.crt"
96+ // SecretKeyToken is the name of the key in the AccessRequest secret that contains the token.
97+ // This value is optional.
98+ SecretKeyToken = "token"
9699)
Original file line number Diff line number Diff line change @@ -11,4 +11,8 @@ const (
1111 ReasonConfigurationProblem = "ConfigurationProblem"
1212 // ReasonInternalError indicates that something went wrong internally.
1313 ReasonInternalError = "InternalError"
14+ // ReasonWaitingForClusterRequest indicates that something is waiting for a ClusterRequest to become ready.
15+ ReasonWaitingForClusterRequest = "WaitingForClusterRequest"
16+ // ReasonWaitingForAccessRequest indicates that something is waiting for an AccessRequest to become ready.
17+ ReasonWaitingForAccessRequest = "WaitingForAccessRequest"
1418)
Original file line number Diff line number Diff line change 44 // DefaultOIDCProviderName is the identifier for the default OIDC provider.
55 DefaultOIDCProviderName = "default"
66)
7+
8+ const (
9+ MCPLabel = GroupName + "/mcp"
10+ OIDCProviderLabel = GroupName + "/oidc-provider"
11+ )
12+
13+ const (
14+ ConditionClusterRequestReady = "ClusterRequestReady"
15+ ConditionPrefixOIDCAccessReady = "OIDCAccessReady_"
16+ ConditionAllAccessReady = "AllAccessReady"
17+ )
Original file line number Diff line number Diff line change @@ -7,9 +7,11 @@ import (
77 "sigs.k8s.io/controller-runtime/pkg/scheme"
88)
99
10+ const GroupName = "core.openmcp.cloud"
11+
1012var (
1113 // GroupVersion is group version used to register these objects
12- GroupVersion = schema.GroupVersion {Group : "core.openmcp.cloud" , Version : "v2alpha1" }
14+ GroupVersion = schema.GroupVersion {Group : GroupName , Version : "v2alpha1" }
1315
1416 // SchemeBuilder is used to add go types to the GroupVersionKind scheme
1517 SchemeBuilder = & scheme.Builder {GroupVersion : GroupVersion }
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ require (
1111 github.com/onsi/ginkgo/v2 v2.25.1
1212 github.com/onsi/gomega v1.38.1
1313 github.com/openmcp-project/controller-utils v0.18.0
14- github.com/openmcp-project/openmcp-operator/api v0.11.1
14+ github.com/openmcp-project/openmcp-operator/api v0.11.0
15+ github.com/openmcp-project/openmcp-operator/lib v0.11.0
1516 github.com/spf13/cobra v1.9.1
1617 k8s.io/api v0.33.4
1718 k8s.io/apimachinery v0.33.4
Original file line number Diff line number Diff line change @@ -99,6 +99,8 @@ github.com/onsi/gomega v1.38.1 h1:FaLA8GlcpXDwsb7m0h2A9ew2aTk3vnZMlzFgg5tz/pk=
9999github.com/onsi/gomega v1.38.1 /go.mod h1:LfcV8wZLvwcYRwPiJysphKAEsmcFnLMK/9c+PjvlX8g =
100100github.com/openmcp-project/controller-utils v0.18.0 h1:9UESJdCuGkoXhsvRZ/gWPpJrdK8bHvjx0ZP5fROib3k =
101101github.com/openmcp-project/controller-utils v0.18.0 /go.mod h1:S4Ym/PWOR8hy8A4LN1hfLyIf9XTNGUrnryvGtFMiq/U =
102+ github.com/openmcp-project/openmcp-operator/lib v0.11.0 h1:ga+n/lKwovULi/KYw3HttWVMKplON4S4dzIAIBg5CV4 =
103+ github.com/openmcp-project/openmcp-operator/lib v0.11.0 /go.mod h1:/FjNH8TJfbRomUYNvhtt4Peb1nrhe1IovCfun9DUMhY =
102104github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4 =
103105github.com/pkg/errors v0.9.1 /go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0 =
104106github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ type Config struct {
2929
3030 // AccessRequest is the configuration for the access request controller.
3131 AccessRequest * AccessRequestConfig `json:"accessRequest,omitempty"`
32+
33+ // ManagedControlPlane is the configuration for the MCP controller.
34+ ManagedControlPlane * ManagedControlPlaneConfig `json:"managedControlPlane,omitempty"`
3235}
3336
3437// Dump is used for logging and debugging purposes.
Original file line number Diff line number Diff line change 1+ package config
2+
3+ import (
4+ "k8s.io/apimachinery/pkg/util/validation/field"
5+
6+ commonapi "github.com/openmcp-project/openmcp-operator/api/common"
7+ )
8+
9+ type ManagedControlPlaneConfig struct {
10+ // MCPClusterPurpose is the purpose that is used for ClusterRequests created for ManagedControlPlane resources.
11+ MCPClusterPurpose string `json:"mcpClusterPurpose"`
12+
13+ // StandardOIDCProvider is the standard OIDC provider that is enabled for all ManagedControlPlane resources, unless explicitly disabled.
14+ // If nil, no standard OIDC provider will be used.
15+ StandardOIDCProvider * commonapi.OIDCProviderConfig `json:"standardOIDCProvider,omitempty"`
16+
17+ // ReconcileMCPEveryXDays specifies after how many days an MCP should be reconciled.
18+ // This is useful if the AccessRequests created by the MCP use an expiring authentication method and the MCP needs to refresh the access regularly.
19+ // A value of 0 disables the periodic reconciliation.
20+ // +optional
21+ ReconcileMCPEveryXDays int `json:"reconcileMCPEveryXDays,omitempty"`
22+ }
23+
24+ func (c * ManagedControlPlaneConfig ) Default (_ * field.Path ) error {
25+ return nil
26+ }
27+
28+ func (c * ManagedControlPlaneConfig ) Validate (fldPath * field.Path ) error {
29+ errs := field.ErrorList {}
30+
31+ if c .MCPClusterPurpose == "" {
32+ errs = append (errs , field .Required (fldPath .Child ("mcpClusterPurpose" ), "MCP cluster purpose must be set" ))
33+ }
34+
35+ return errs .ToAggregate ()
36+ }
You can’t perform that action at this time.
0 commit comments