File tree Expand file tree Collapse file tree 9 files changed +489
-1
lines changed
controllers/managedcontrolplane Expand file tree Collapse file tree 9 files changed +489
-1
lines changed Original file line number Diff line number Diff line change @@ -84,4 +84,13 @@ 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+ // SecretKeyHost is the name of the key in the AccessRequest secret that contains the host of the cluster.
88+ // This value is optional.
89+ SecretKeyHost = "host"
90+ // SecretKeyCA is the name of the key in the AccessRequest secret that contains the CA certificate of the cluster.
91+ // This value is optional.
92+ SecretKeyCA = "ca.crt"
93+ // SecretKeyToken is the name of the key in the AccessRequest secret that contains the token.
94+ // This value is optional.
95+ SecretKeyToken = "token"
8796)
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 @@ -12,6 +12,7 @@ require (
1212 github.com/onsi/gomega v1.38.0
1313 github.com/openmcp-project/controller-utils v0.14.0
1414 github.com/openmcp-project/openmcp-operator/api v0.9.1
15+ github.com/openmcp-project/openmcp-operator/lib v0.9.1
1516 github.com/spf13/cobra v1.9.1
1617 k8s.io/api v0.33.3
1718 k8s.io/apimachinery v0.33.3
Original file line number Diff line number Diff line change @@ -101,6 +101,8 @@ github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY=
101101github.com/onsi/gomega v1.38.0 /go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJEB6o =
102102github.com/openmcp-project/controller-utils v0.14.0 h1:semDlO6fmEmTp7mT1j2ZmT1cCG3TtNujrMyKBU5Tzic =
103103github.com/openmcp-project/controller-utils v0.14.0 /go.mod h1:BA5sey3z1ISAqOP5CzgWGVcPeA906XgXEq4uBOpNfg4 =
104+ github.com/openmcp-project/openmcp-operator/lib v0.9.1 h1:zp/1L/2ySLajx7z1NSGDzvaHZBy0NyCqBUtZMRybfLA =
105+ github.com/openmcp-project/openmcp-operator/lib v0.9.1 /go.mod h1:DvL3Dl1sbqQTs6tfX2Bd4UxYt1hW+zBX2vRyoOdmgmI =
104106github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4 =
105107github.com/pkg/errors v0.9.1 /go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0 =
106108github.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