-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add adopted cluster template to adopt existing k8s clusters
- Loading branch information
1 parent
673f0b4
commit 047904b
Showing
10 changed files
with
435 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: hmc.mirantis.com/v1alpha1 | ||
kind: ClusterDeployment | ||
metadata: | ||
name: aws-dev | ||
namespace: ${NAMESPACE} | ||
spec: | ||
template: adopted-cluster-0-0-4 | ||
credential: adopted-cluster-cred | ||
config: {} | ||
services: | ||
- template: kyverno-3-2-6 | ||
name: kyverno | ||
namespace: kyverno | ||
- template: ingress-nginx-4-11-0 | ||
name: ingress-nginx | ||
namespace: ingress-nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: v1 | ||
data: | ||
value: ${KUBECONFIG_DATA} | ||
kind: Secret | ||
metadata: | ||
name: adopted-cluster-kubeconf | ||
namespace: ${NAMESPACE} | ||
type: Opaque | ||
--- | ||
apiVersion: hmc.mirantis.com/v1alpha1 | ||
kind: Credential | ||
metadata: | ||
name: adopted-cluster-cred | ||
namespace: ${NAMESPACE} | ||
spec: | ||
description: Adopted Credentials | ||
identityRef: | ||
apiVersion: v1 | ||
kind: Secret | ||
name: adopted-cluster-kubeconf | ||
namespace: ${NAMESPACE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: v2 | ||
name: adopted-cluster | ||
description: | | ||
An HMC template to adopt an already existing kubernetes cluster | ||
type: application | ||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.0.4 | ||
annotations: | ||
cluster.x-k8s.io/provider: infrastructure-internal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{{- define "cluster.name" -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
10 changes: 10 additions & 0 deletions
10
templates/cluster/adopted-cluster/templates/sveltoscluster.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: lib.projectsveltos.io/v1beta1 | ||
kind: SveltosCluster | ||
metadata: | ||
labels: | ||
projectsveltos.io/k8s-version: v1.31.1 | ||
name: {{ include "cluster.name" . }} | ||
namespace: {{ .Release.Namespace }} | ||
spec: | ||
consecutiveFailureThreshold: {{ .Values.consecutiveFailureThreshold }} | ||
kubeconfigName: {{ .Values.clusterIdentity.name }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"description": "An HMC template to adopt an existing k8s cluster.", | ||
"type": "object", | ||
"required": [ | ||
"clusterIdentity" | ||
], | ||
"properties": { | ||
"consecutiveFailureThreshold": { | ||
"description": "The number of the failures prior to setting the status condition", | ||
"type": "integer", | ||
"minimum": 1 | ||
}, | ||
"clusterIdentity": { | ||
"type": "object", | ||
"description": "Adopted Cluster Identity object reference", | ||
"required": [ | ||
"name", | ||
"kind" | ||
], | ||
"properties": { | ||
"name": { | ||
"description": "Adopted ClusterIdentity object name", | ||
"type": "string" | ||
}, | ||
"kind": { | ||
"description": "Adopted ClusterIdentity object kind", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Cluster parameters | ||
|
||
clusterIdentity: | ||
name: "adopted-cluster-identity" | ||
kind: "Secret" | ||
|
||
consecutiveFailureThreshold: 3 |
15 changes: 15 additions & 0 deletions
15
templates/provider/hmc-templates/files/templates/adopted-cluster-0-0-4.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
apiVersion: hmc.mirantis.com/v1alpha1 | ||
kind: ClusterTemplate | ||
metadata: | ||
name: adopted-cluster-0-0-4 | ||
annotations: | ||
helm.sh/resource-policy: keep | ||
spec: | ||
helm: | ||
chartSpec: | ||
chart: adopted-cluster | ||
version: 0.0.4 | ||
interval: 10m0s | ||
sourceRef: | ||
kind: HelmRepository | ||
name: hmc-templates |
Oops, something went wrong.