-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
583 additions
and
46 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
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 @@ | ||
--- | ||
# TODO: move to image vector: | ||
gardener_operator_image_name: europe-docker.pkg.dev/gardener-project/releases/gardener/operator | ||
gardener_operator_image_tag: "{{ gardener_gardenlet_image_tag }}" |
41 changes: 0 additions & 41 deletions
41
...-plane/roles/gardener/tasks/gardener.yaml → ...asks/gardener_control_plane_obsolete.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
134 changes: 134 additions & 0 deletions
134
control-plane/roles/gardener/tasks/gardener_operator.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,134 @@ | ||
--- | ||
- name: Create backup infrastructure secret | ||
k8s: | ||
definition: | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: virtual-garden-etcd-main-backup-secret | ||
namespace: garden | ||
type: Opaque | ||
data: "{{ gardener_backup_infrastructure_secret }}" | ||
apply: yes | ||
|
||
- name: Create backup directory for local deployment | ||
import_tasks: local_backup.yaml | ||
when: gardener_backup_infrastructure.provider == "local" | ||
|
||
# TODO: prepare migration here | ||
# - label existing secrets like CA, ETCD encryption key, accordingly | ||
# - scale down existing components (gardener control plane + virtual garden with ETCD) | ||
|
||
- name: Deploy Gardener Operator | ||
include_role: | ||
name: ansible-common/roles/helm-chart | ||
vars: | ||
helm_timeout: "600s" | ||
helm_chart: "{{ gardener_local_tmp_dir }}/gardener/charts/gardener/operator" | ||
helm_release_name: operator | ||
helm_target_namespace: garden | ||
helm_value_file_template: gardener-operator-values.j2 | ||
|
||
- name: Create Garden | ||
k8s: | ||
definition: "{{ lookup('template', 'garden.yaml') }}" | ||
apply: yes | ||
|
||
- name: Wait until Garden is ready | ||
kubernetes.core.k8s_info: | ||
api_version: "operator.gardener.cloud/v1alpha1" | ||
kind: Garden | ||
name: "local" | ||
wait: yes | ||
wait_condition: | ||
status: "True" | ||
type: "{{ item }}" | ||
wait_timeout: 900 | ||
loop: | ||
- VirtualComponentsHealthy | ||
- RuntimeComponentsHealthy | ||
|
||
# TODO: we should expose through istio and Gardener Operator in the future? | ||
- name: Create ingress for virtual kube-apiserver | ||
k8s: | ||
definition: | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
nginx.ingress.kubernetes.io/ssl-passthrough: "true" | ||
name: apiserver-ingress | ||
namespace: garden | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- host: "{{ gardener_virtual_api_server_public_dns }}" | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: virtual-garden-kube-apiserver | ||
port: | ||
number: 443 | ||
tls: | ||
- hosts: | ||
- "{{ gardener_virtual_api_server_public_dns }}" | ||
apply: yes | ||
|
||
- name: Create virtual garden access secret | ||
k8s: | ||
apply: yes | ||
definition: | ||
apiVersion: v1 | ||
kind: Secret | ||
type: Opaque | ||
metadata: | ||
name: shoot-access-virtual-garden | ||
namespace: garden | ||
labels: | ||
resources.gardener.cloud/purpose: token-requestor | ||
resources.gardener.cloud/class: shoot | ||
annotations: | ||
serviceaccount.resources.gardener.cloud/name: virtual-garden-user | ||
serviceaccount.resources.gardener.cloud/namespace: kube-system | ||
serviceaccount.resources.gardener.cloud/token-expiration-duration: 3h | ||
|
||
- name: Create virtual garden access managed resource secret | ||
k8s: | ||
apply: yes | ||
definition: | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: managedresource-virtual-garden-access | ||
namespace: garden | ||
type: Opaque | ||
stringData: | ||
clusterrolebinding____gardener.cloud.virtual-garden-access.yaml: | | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: gardener.cloud.sap:virtual-garden | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: cluster-admin | ||
subjects: | ||
- kind: ServiceAccount | ||
name: virtual-garden-user | ||
namespace: kube-system | ||
- name: Create virtual garden access managed resource secret | ||
k8s: | ||
apply: yes | ||
definition: | ||
apiVersion: resources.gardener.cloud/v1alpha1 | ||
kind: ManagedResource | ||
metadata: | ||
name: virtual-garden-access | ||
namespace: garden | ||
spec: | ||
secretRefs: | ||
- name: managedresource-virtual-garden-access |
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 @@ | ||
--- | ||
# this is only intended to used when running this on local kind setups | ||
- name: Create local backup directory | ||
k8s: | ||
definition: | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: create-local-backup-dir | ||
spec: | ||
completions: 1 | ||
parallelism: 1 | ||
backoffLimit: 0 | ||
template: | ||
spec: | ||
containers: | ||
- image: alpine | ||
imagePullPolicy: IfNotPresent | ||
name: create | ||
command: | ||
- mkdir | ||
- -p | ||
- "{{ gardener_backup_infrastructure_secret.hostPath | b64decode }}" | ||
restartPolicy: Never | ||
namespace: "garden" | ||
wait: yes | ||
apply: yes | ||
wait_timeout: 30 | ||
wait_condition: | ||
type: Complete | ||
status: "True" | ||
when: | ||
- not lookup('k8s', api_version='batch/v1', namespace='garden', kind='Job', resource_name='create-local-backup-dir') |
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
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
Oops, something went wrong.