Skip to content

Commit

Permalink
feat: external cluster reference
Browse files Browse the repository at this point in the history
Signed-off-by: Dario Tranchitella <[email protected]>
  • Loading branch information
prometherion authored Jun 13, 2024
1 parent 4dff1e2 commit 8d0b73d
Show file tree
Hide file tree
Showing 23 changed files with 985 additions and 43 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ You can refer to the [official documentation website](https://kamaji.clastix.io/

### 📄 Documentation

The Kamaji Cluster API Control Plane provider documentation is referenced in the [Kamaji documentation](https://kamaji.clastix.io/) website.
The Kamaji Cluster API Control Plane provider documentation is referenced in the [Kamaji documentation](https://kamaji.clastix.io/guides/cluster-api/) website.

### 🚀 Supported CAPI infrastructure providers

Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/kamajicontrolplane_conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package v1alpha1
type KamajiControlPlaneConditionType string

var (
FoundExternalClusterReferenceConditionType KamajiControlPlaneConditionType = "FoundExternalReferenceClient"
TenantControlPlaneCreatedConditionType KamajiControlPlaneConditionType = "TenantControlPlaneCreated"
TenantControlPlaneAddressReadyConditionType KamajiControlPlaneConditionType = "TenantControlPlaneAddressReady"
InfrastructureClusterPatchedConditionType KamajiControlPlaneConditionType = "InfrastructureClusterPatched"
Expand Down
21 changes: 21 additions & 0 deletions api/v1alpha1/kamajicontrolplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ type DeploymentComponent struct {
ExtraInitContainers []corev1.Container `json:"extraInitContainers,omitempty"`
ExtraContainers []corev1.Container `json:"extraContainers,omitempty"`
ExtraVolumes []corev1.Volume `json:"extraVolumes,omitempty"`
// ExternalClusterReference allows defining the target Cluster where the Tenant Control Plane components must be deployed.
// When this value is nil, the Cluster API management cluster will be used as a target.
// The ExternalClusterReference feature gate must be enabled with one of the available flags.
ExternalClusterReference *ExternalClusterReference `json:"externalClusterReference,omitempty"`
}

type KamajiControlPlaneFields struct {
Expand Down Expand Up @@ -133,6 +137,23 @@ type KamajiControlPlaneFields struct {
Deployment DeploymentComponent `json:"deployment,omitempty"`
}

type ExternalClusterReference struct {
// The Secret object containing the kubeconfig used to interact with the remote cluster that will host
// the Tenant Control Plane resources generated by the Control Plane Provider.
// +kubebuilder:required
// +kubebuilder:validation:MinLength=1
KubeconfigSecretName string `json:"kubeconfigSecretName"`
// The key used to extract the kubeconfig from the specified Secret.
// +kubebuilder:required
// +kubebuilder:validation:MinLength=1
KubeconfigSecretKey string `json:"kubeconfigSecretKey"`
// When ExternalClusterReferenceCrossNamespace is enabled allows specifying a different Namespace where the kubeconfig can be retrieved.
// With ExternalClusterReference this value can be left empty since the KamajiControlPlane object Namespace will be used.
KubeconfigSecretNamespace string `json:"kubeconfigSecretNamespace,omitempty"`
// The Namespace where the resulting TenantControlPlane must be deployed to.
DeploymentNamespace string `json:"deploymentNamespace"`
}

// KamajiControlPlaneStatus defines the observed state of KamajiControlPlane.
type KamajiControlPlaneStatus struct {
// The TenantControlPlane has completed initialization.
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions config/control-plane-components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1497,6 +1497,35 @@ spec:
x-kubernetes-list-type: atomic
type: object
type: object
externalClusterReference:
description: |-
ExternalClusterReference allows defining the target Cluster where the Tenant Control Plane components must be deployed.
When this value is nil, the Cluster API management cluster will be used as a target.
The ExternalClusterReference feature gate must be enabled with one of the available flags.
properties:
deploymentNamespace:
description: The Namespace where the resulting TenantControlPlane must be deployed to.
type: string
kubeconfigSecretKey:
description: The key used to extract the kubeconfig from the specified Secret.
minLength: 1
type: string
kubeconfigSecretName:
description: |-
The Secret object containing the kubeconfig used to interact with the remote cluster that will host
the Tenant Control Plane resources generated by the Control Plane Provider.
minLength: 1
type: string
kubeconfigSecretNamespace:
description: |-
When ExternalClusterReferenceCrossNamespace is enabled allows specifying a different Namespace where the kubeconfig can be retrieved.
With ExternalClusterReference this value can be left empty since the KamajiControlPlane object Namespace will be used.
type: string
required:
- deploymentNamespace
- kubeconfigSecretKey
- kubeconfigSecretName
type: object
extraContainers:
items:
description: A single application container that you want to run within a pod.
Expand Down Expand Up @@ -8128,6 +8157,35 @@ spec:
x-kubernetes-list-type: atomic
type: object
type: object
externalClusterReference:
description: |-
ExternalClusterReference allows defining the target Cluster where the Tenant Control Plane components must be deployed.
When this value is nil, the Cluster API management cluster will be used as a target.
The ExternalClusterReference feature gate must be enabled with one of the available flags.
properties:
deploymentNamespace:
description: The Namespace where the resulting TenantControlPlane must be deployed to.
type: string
kubeconfigSecretKey:
description: The key used to extract the kubeconfig from the specified Secret.
minLength: 1
type: string
kubeconfigSecretName:
description: |-
The Secret object containing the kubeconfig used to interact with the remote cluster that will host
the Tenant Control Plane resources generated by the Control Plane Provider.
minLength: 1
type: string
kubeconfigSecretNamespace:
description: |-
When ExternalClusterReferenceCrossNamespace is enabled allows specifying a different Namespace where the kubeconfig can be retrieved.
With ExternalClusterReference this value can be left empty since the KamajiControlPlane object Namespace will be used.
type: string
required:
- deploymentNamespace
- kubeconfigSecretKey
- kubeconfigSecretName
type: object
extraContainers:
items:
description: A single application container that you want to run within a pod.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,37 @@ spec:
x-kubernetes-list-type: atomic
type: object
type: object
externalClusterReference:
description: |-
ExternalClusterReference allows defining the target Cluster where the Tenant Control Plane components must be deployed.
When this value is nil, the Cluster API management cluster will be used as a target.
The ExternalClusterReference feature gate must be enabled with one of the available flags.
properties:
deploymentNamespace:
description: The Namespace where the resulting TenantControlPlane
must be deployed to.
type: string
kubeconfigSecretKey:
description: The key used to extract the kubeconfig from the
specified Secret.
minLength: 1
type: string
kubeconfigSecretName:
description: |-
The Secret object containing the kubeconfig used to interact with the remote cluster that will host
the Tenant Control Plane resources generated by the Control Plane Provider.
minLength: 1
type: string
kubeconfigSecretNamespace:
description: |-
When ExternalClusterReferenceCrossNamespace is enabled allows specifying a different Namespace where the kubeconfig can be retrieved.
With ExternalClusterReference this value can be left empty since the KamajiControlPlane object Namespace will be used.
type: string
required:
- deploymentNamespace
- kubeconfigSecretKey
- kubeconfigSecretName
type: object
extraContainers:
items:
description: A single application container that you want to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,37 @@ spec:
x-kubernetes-list-type: atomic
type: object
type: object
externalClusterReference:
description: |-
ExternalClusterReference allows defining the target Cluster where the Tenant Control Plane components must be deployed.
When this value is nil, the Cluster API management cluster will be used as a target.
The ExternalClusterReference feature gate must be enabled with one of the available flags.
properties:
deploymentNamespace:
description: The Namespace where the resulting TenantControlPlane
must be deployed to.
type: string
kubeconfigSecretKey:
description: The key used to extract the kubeconfig
from the specified Secret.
minLength: 1
type: string
kubeconfigSecretName:
description: |-
The Secret object containing the kubeconfig used to interact with the remote cluster that will host
the Tenant Control Plane resources generated by the Control Plane Provider.
minLength: 1
type: string
kubeconfigSecretNamespace:
description: |-
When ExternalClusterReferenceCrossNamespace is enabled allows specifying a different Namespace where the kubeconfig can be retrieved.
With ExternalClusterReference this value can be left empty since the KamajiControlPlane object Namespace will be used.
type: string
required:
- deploymentNamespace
- kubeconfigSecretKey
- kubeconfigSecretName
type: object
extraContainers:
items:
description: A single application container that you
Expand Down
Loading

0 comments on commit 8d0b73d

Please sign in to comment.