From 69bfcb8d87fd6f331eada0f2e822d27ce6a4d299 Mon Sep 17 00:00:00 2001 From: Cindy Bang Date: Tue, 26 Nov 2024 06:01:55 -0500 Subject: [PATCH] templates: add cluster object store configuration --- .../cluster-object-store.yaml | 42 +++++++++++++++++++ .../cluster-object-store/kustomization.yaml | 5 +++ .../k3s/full-vpcless/kustomization.yaml | 15 +++++++ templates/flavors/k3s/full/kustomization.yaml | 15 +++++++ .../kubeadm/full-vpcless/kustomization.yaml | 15 +++++++ .../flavors/kubeadm/full/kustomization.yaml | 15 +++++++ .../rke2/full-vpcless/kustomization.yaml | 15 +++++++ .../flavors/rke2/full/kustomization.yaml | 15 +++++++ 8 files changed, 137 insertions(+) create mode 100644 templates/addons/cluster-object-store/cluster-object-store.yaml create mode 100644 templates/addons/cluster-object-store/kustomization.yaml diff --git a/templates/addons/cluster-object-store/cluster-object-store.yaml b/templates/addons/cluster-object-store/cluster-object-store.yaml new file mode 100644 index 000000000..b3e96d718 --- /dev/null +++ b/templates/addons/cluster-object-store/cluster-object-store.yaml @@ -0,0 +1,42 @@ +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: LinodeObjectStorageBucket +metadata: + labels: + app.kubernetes.io/name: linodeobjectstoragebucket + app.kubernetes.io/instance: ${CLUSTER_NAME}-object-store + app.kubernetes.io/part-of: cluster-api-provider-linode + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: cluster-api-provider-linode + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} + name: ${CLUSTER_NAME}-object-store +spec: + credentialsRef: + name: ${CLUSTER_NAME}-credentials + region: ${OBJ_BUCKET_REGION:=${LINODE_REGION}} +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 +kind: LinodeObjectStorageKey +metadata: + labels: + app.kubernetes.io/name: linodeobjectstoragekey + app.kubernetes.io/instance: ${CLUSTER_NAME}-object-store + app.kubernetes.io/part-of: cluster-api-provider-linode + app.kubernetes.io/managed-by: kustomize + app.kubernetes.io/created-by: cluster-api-provider-linode + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} + name: ${CLUSTER_NAME}-object-store +spec: + credentialsRef: + name: ${CLUSTER_NAME}-credentials + bucketAccess: + - bucketName: ${CLUSTER_NAME}-object-store + permissions: read_write + region: ${OBJ_BUCKET_REGION:=${LINODE_REGION}} + generatedSecret: + type: Opaque + format: + bucket_name: '{{ .BucketName }}' + s3_endpoint: '{{ .S3Endpoint }}' + access_key: '{{ .AccessKey }}' + secret_key: '{{ .SecretKey }}' diff --git a/templates/addons/cluster-object-store/kustomization.yaml b/templates/addons/cluster-object-store/kustomization.yaml new file mode 100644 index 000000000..2ea4f37e1 --- /dev/null +++ b/templates/addons/cluster-object-store/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - cluster-object-store.yaml diff --git a/templates/flavors/k3s/full-vpcless/kustomization.yaml b/templates/flavors/k3s/full-vpcless/kustomization.yaml index 02f55b6f3..d89e74960 100644 --- a/templates/flavors/k3s/full-vpcless/kustomization.yaml +++ b/templates/flavors/k3s/full-vpcless/kustomization.yaml @@ -7,6 +7,7 @@ resources: - ../../../addons/etcd-backup-restore - ../../../addons/machine-health-check - ../../../addons/placementGroups + - ../../../addons/cluster-object-store patches: - target: @@ -198,3 +199,17 @@ patches: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 kind: LinodePlacementGroup name: ${CLUSTER_NAME} + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: LinodeCluster + patch: |- + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: LinodeCluster + metadata: + name: ${CLUSTER_NAME} + spec: + objectStore: + presignedURLDuration: "24h" + credentialsRef: + name: ${CLUSTER_NAME}-object-store-obj-key diff --git a/templates/flavors/k3s/full/kustomization.yaml b/templates/flavors/k3s/full/kustomization.yaml index 5a52e8b7e..0d196648a 100644 --- a/templates/flavors/k3s/full/kustomization.yaml +++ b/templates/flavors/k3s/full/kustomization.yaml @@ -7,6 +7,7 @@ resources: - ../../../addons/etcd-backup-restore - ../../../addons/machine-health-check - ../../../addons/placementGroups + - ../../../addons/cluster-object-store patches: - target: @@ -50,3 +51,17 @@ patches: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 kind: LinodePlacementGroup name: ${CLUSTER_NAME} + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: LinodeCluster + patch: |- + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: LinodeCluster + metadata: + name: ${CLUSTER_NAME} + spec: + objectStore: + presignedURLDuration: "24h" + credentialsRef: + name: ${CLUSTER_NAME}-object-store-obj-key diff --git a/templates/flavors/kubeadm/full-vpcless/kustomization.yaml b/templates/flavors/kubeadm/full-vpcless/kustomization.yaml index 11b624ed4..fae4d4e70 100644 --- a/templates/flavors/kubeadm/full-vpcless/kustomization.yaml +++ b/templates/flavors/kubeadm/full-vpcless/kustomization.yaml @@ -7,6 +7,7 @@ resources: - ../../../addons/etcd-backup-restore - ../../../addons/machine-health-check - ../../../addons/placementGroups + - ../../../addons/cluster-object-store patches: - target: @@ -224,3 +225,17 @@ patches: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 kind: LinodePlacementGroup name: ${CLUSTER_NAME} + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: LinodeCluster + patch: |- + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: LinodeCluster + metadata: + name: ${CLUSTER_NAME} + spec: + objectStore: + presignedURLDuration: "24h" + credentialsRef: + name: ${CLUSTER_NAME}-object-store-obj-key diff --git a/templates/flavors/kubeadm/full/kustomization.yaml b/templates/flavors/kubeadm/full/kustomization.yaml index 05517cad6..e6261fb60 100644 --- a/templates/flavors/kubeadm/full/kustomization.yaml +++ b/templates/flavors/kubeadm/full/kustomization.yaml @@ -7,6 +7,7 @@ resources: - ../../../addons/etcd-backup-restore - ../../../addons/machine-health-check - ../../../addons/placementGroups + - ../../../addons/cluster-object-store patches: - target: @@ -103,3 +104,17 @@ patches: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 kind: LinodePlacementGroup name: ${CLUSTER_NAME} + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: LinodeCluster + patch: |- + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: LinodeCluster + metadata: + name: ${CLUSTER_NAME} + spec: + objectStore: + presignedURLDuration: "24h" + credentialsRef: + name: ${CLUSTER_NAME}-object-store-obj-key diff --git a/templates/flavors/rke2/full-vpcless/kustomization.yaml b/templates/flavors/rke2/full-vpcless/kustomization.yaml index 508d082f0..4c8f45625 100644 --- a/templates/flavors/rke2/full-vpcless/kustomization.yaml +++ b/templates/flavors/rke2/full-vpcless/kustomization.yaml @@ -7,6 +7,7 @@ resources: - ../../../addons/etcd-backup-restore - ../../../addons/machine-health-check - ../../../addons/placementGroups + - ../../../addons/cluster-object-store patches: - target: @@ -97,3 +98,17 @@ patches: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 kind: LinodePlacementGroup name: ${CLUSTER_NAME} + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: LinodeCluster + patch: |- + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: LinodeCluster + metadata: + name: ${CLUSTER_NAME} + spec: + objectStore: + presignedURLDuration: "24h" + credentialsRef: + name: ${CLUSTER_NAME}-object-store-obj-key diff --git a/templates/flavors/rke2/full/kustomization.yaml b/templates/flavors/rke2/full/kustomization.yaml index ecd6b5131..ad978f61b 100644 --- a/templates/flavors/rke2/full/kustomization.yaml +++ b/templates/flavors/rke2/full/kustomization.yaml @@ -7,6 +7,7 @@ resources: - ../../../addons/etcd-backup-restore - ../../../addons/machine-health-check - ../../../addons/placementGroups + - ../../../addons/cluster-object-store patches: - target: @@ -89,3 +90,17 @@ patches: apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 kind: LinodePlacementGroup name: ${CLUSTER_NAME} + - target: + group: infrastructure.cluster.x-k8s.io + version: v1alpha2 + kind: LinodeCluster + patch: |- + apiVersion: infrastructure.cluster.x-k8s.io/v1alpha2 + kind: LinodeCluster + metadata: + name: ${CLUSTER_NAME} + spec: + objectStore: + presignedURLDuration: "24h" + credentialsRef: + name: ${CLUSTER_NAME}-object-store-obj-key