diff --git a/dr/daemonset-k8s-regional-rbd/kustomization.yaml b/dr/daemonset-k8s-regional-rbd/kustomization.yaml new file mode 100644 index 0000000..eaa2d45 --- /dev/null +++ b/dr/daemonset-k8s-regional-rbd/kustomization.yaml @@ -0,0 +1,6 @@ +--- +namespace: daemonset-rbd +commonLabels: + app: daemonset-rbd +resources: + - ../base diff --git a/dr/statefulset-k8s-regional-rbd/kustomization.yaml b/dr/statefulset-k8s-regional-rbd/kustomization.yaml new file mode 100644 index 0000000..767e376 --- /dev/null +++ b/dr/statefulset-k8s-regional-rbd/kustomization.yaml @@ -0,0 +1,6 @@ +--- +namespace: statefulset-rbd +commonLabels: + app: statefulset-rbd +resources: + - ../base diff --git a/subscription/daemonset-k8s-regional-rbd/kustomization.yaml b/subscription/daemonset-k8s-regional-rbd/kustomization.yaml new file mode 100644 index 0000000..7b7d3b0 --- /dev/null +++ b/subscription/daemonset-k8s-regional-rbd/kustomization.yaml @@ -0,0 +1,15 @@ +--- +resources: + - ../base +namespace: daemonset-rbd +commonLabels: + app: daemonset-rbd +patches: + # Customize path to application. + - target: + kind: Subscription + name: subscription + patch: |- + - op: replace + path: /metadata/annotations/apps.open-cluster-management.io~1github-path + value: workloads/daemonset/k8s-regional-rbd diff --git a/subscription/statefulset-k8s-regional-rbd/kustomization.yaml b/subscription/statefulset-k8s-regional-rbd/kustomization.yaml new file mode 100644 index 0000000..0ee36ae --- /dev/null +++ b/subscription/statefulset-k8s-regional-rbd/kustomization.yaml @@ -0,0 +1,15 @@ +--- +resources: + - ../base +namespace: statefulset-rbd +commonLabels: + app: statefulset-rbd +patches: + # Customize path to application. + - target: + kind: Subscription + name: subscription + patch: |- + - op: replace + path: /metadata/annotations/apps.open-cluster-management.io~1github-path + value: workloads/statefulset/k8s-regional-rbd diff --git a/workloads/daemonset/base/daemonset.yaml b/workloads/daemonset/base/daemonset.yaml new file mode 100644 index 0000000..7f12a63 --- /dev/null +++ b/workloads/daemonset/base/daemonset.yaml @@ -0,0 +1,47 @@ +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: busybox +spec: + selector: + matchLabels: + appname: busybox + template: + metadata: + labels: + appname: busybox + spec: + containers: + - name: logger + image: quay.io/nirsof/busybox:stable + imagePullPolicy: IfNotPresent + command: + - sh + - -c + - | + emit() { + echo "$(date) $1" | tee -a /var/log/ramen.log + sync + } + trap "emit STOP; exit" TERM + emit START + while true; do + sleep 10 & wait + emit UPDATE + done + volumeMounts: + - name: varlog + mountPath: /var/log + volumes: + - name: varlog + persistentVolumeClaim: + claimName: busybox-pvc + tolerations: + # Run also on control-plane and master nodes. + - key: node-role.kubernetes.io/control-plane + operator: Exists + effect: NoSchedule + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule diff --git a/workloads/daemonset/base/kustomization.yaml b/workloads/daemonset/base/kustomization.yaml new file mode 100644 index 0000000..95b1e30 --- /dev/null +++ b/workloads/daemonset/base/kustomization.yaml @@ -0,0 +1,8 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +commonLabels: + appname: busybox +resources: + - pvc.yaml + - daemonset.yaml diff --git a/workloads/daemonset/base/pvc.yaml b/workloads/daemonset/base/pvc.yaml new file mode 100644 index 0000000..64cb777 --- /dev/null +++ b/workloads/daemonset/base/pvc.yaml @@ -0,0 +1,13 @@ +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: busybox-pvc +spec: + accessModes: + - ReadWriteOnce + # Customize in your overlay. + storageClassName: STORAGE_CLASS_NAME + resources: + requests: + storage: 1Gi diff --git a/workloads/daemonset/k8s-regional-rbd/kustomization.yaml b/workloads/daemonset/k8s-regional-rbd/kustomization.yaml new file mode 100644 index 0000000..1e102fe --- /dev/null +++ b/workloads/daemonset/k8s-regional-rbd/kustomization.yaml @@ -0,0 +1,11 @@ +--- +resources: + - ../base +patches: + - target: + kind: PersistentVolumeClaim + name: busybox-pvc + patch: |- + - op: replace + path: /spec/storageClassName + value: rook-ceph-block diff --git a/workloads/statefulset/base/kustomization.yaml b/workloads/statefulset/base/kustomization.yaml new file mode 100644 index 0000000..248538d --- /dev/null +++ b/workloads/statefulset/base/kustomization.yaml @@ -0,0 +1,7 @@ +--- +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +commonLabels: + appname: busybox +resources: + - statefulset.yaml diff --git a/workloads/statefulset/base/statefulset.yaml b/workloads/statefulset/base/statefulset.yaml new file mode 100644 index 0000000..468b295 --- /dev/null +++ b/workloads/statefulset/base/statefulset.yaml @@ -0,0 +1,55 @@ +--- +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: busybox +spec: + # Required for proper clean up on failover and successful relocate. You + # must enable the StatefulSetAutoDeletePVC feature gate for this. + # https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention + persistentVolumeClaimRetentionPolicy: + whenDeleted: Delete + whenScaled: Retain + selector: + matchLabels: + appname: busybox + replicas: 2 + template: + metadata: + labels: + appname: busybox + spec: + containers: + - name: logger + image: quay.io/nirsof/busybox:stable + imagePullPolicy: IfNotPresent + command: + - sh + - -c + - | + emit() { + echo "$(date) $1" | tee -a /var/log/ramen.log + sync + } + trap "emit STOP; exit" TERM + emit START + while true; do + sleep 10 & wait + emit UPDATE + done + volumeMounts: + - name: varlog + mountPath: /var/log + volumeClaimTemplates: + - metadata: + name: varlog + labels: + appname: busybox + spec: + accessModes: + - ReadWriteOnce + # Customize in your overlay. + storageClassName: STORAGE_CLASS_NAME + resources: + requests: + storage: 1Gi diff --git a/workloads/statefulset/k8s-regional-rbd/kustomization.yaml b/workloads/statefulset/k8s-regional-rbd/kustomization.yaml new file mode 100644 index 0000000..fcc2cc8 --- /dev/null +++ b/workloads/statefulset/k8s-regional-rbd/kustomization.yaml @@ -0,0 +1,11 @@ +--- +resources: + - ../base +patches: + - target: + kind: StatefulSet + name: busybox + patch: |- + - op: replace + path: /spec/volumeClaimTemplates/0/spec/storageClassName + value: rook-ceph-block