From 15c999e1c695f84b6ed36eb32b009777b53bbcc1 Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Thu, 21 Nov 2024 16:32:15 -0500
Subject: [PATCH 01/12] fixing wrong symlink address

---
 bootstrap.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bootstrap.sh b/bootstrap.sh
index 77c89d2f..b7cac24c 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -108,9 +108,9 @@ for service in "$base_source_dir"/*; do
   fi
 done
 
-# Symlink /opt/genestack/kustomize.sh to
+# Symlink /opt/genestack/base-kustomize/kustomize.sh to
 # /etc/genestack/kustomize/kustomize.sh
-ln -s $base_source_dir/base-kustomize/kustomize.sh $base_target_dir/kustomize/kustomize.sh
+ln -s $base_source_dir/kustomize.sh $base_target_dir/kustomize.sh
 
 # Ensure kustomization.yaml exists in each
 # service base/overlay directory

From 8c528ddbf2971a23876b010e3b0747f1e176f961 Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Tue, 26 Nov 2024 12:31:45 -0500
Subject: [PATCH 02/12] Converting mariadb-operator to use helm

---
 .github/workflows/helm-mariadb-operator.yaml  |  46 +++
 .../workflows/kustomize-mariadb-operator.yaml |  33 --
 .../mariadb-operator-helm-overrides.yaml      | 308 ++++++++++++++++++
 .../mariadb-operator/base/kustomization.yaml  |   4 +
 .../mariadb-operator/kustomization.yaml       |  36 --
 .../mariadb-operator/ns-mariadb.yaml          |   7 -
 bin/install-mariadb-operator.sh               |  49 +++
 docs/infrastructure-mariadb.md                |  11 +-
 8 files changed, 412 insertions(+), 82 deletions(-)
 create mode 100644 .github/workflows/helm-mariadb-operator.yaml
 delete mode 100644 .github/workflows/kustomize-mariadb-operator.yaml
 create mode 100644 base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
 create mode 100644 base-kustomize/mariadb-operator/base/kustomization.yaml
 delete mode 100644 base-kustomize/mariadb-operator/kustomization.yaml
 delete mode 100644 base-kustomize/mariadb-operator/ns-mariadb.yaml
 create mode 100644 bin/install-mariadb-operator.sh

diff --git a/.github/workflows/helm-mariadb-operator.yaml b/.github/workflows/helm-mariadb-operator.yaml
new file mode 100644
index 00000000..c7571215
--- /dev/null
+++ b/.github/workflows/helm-mariadb-operator.yaml
@@ -0,0 +1,46 @@
+name: Kustomize GitHub Actions for mariadb-operator
+
+on:
+  pull_request:
+    paths:
+      - base-helm-configs/mariadb-operator/**
+      - base-kustomize/mariadb-operator/**
+      - .github/workflows/helm-mariadb-operator.yaml
+jobs:
+  helm:
+    strategy:
+      matrix:
+        overlays:
+          - base
+    name: Helm
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+      - uses: azure/setup-helm@v3
+        with:
+          version: latest
+          token: "${{ secrets.GITHUB_TOKEN }}"
+        id: helm
+      - name: Kubectl Install
+        working-directory: /usr/local/bin/
+        run: |
+            if [ ! -f /usr/local/bin/kubectl ]; then
+              curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
+              chmod +x ./kubectl
+            fi
+      - name: Run Helm Template
+        run: |
+          ${{ steps.helm.outputs.helm-path }} template mariadb-operator https://mariadb-operator.github.io/mariadb-operator \
+            --namespace=mariadb-system \
+            --create-namespace \
+            --wait \
+            --timeout 120m \
+            -f ${{ github.workspace }}/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml \
+            --post-renderer ${{ github.workspace }}/base-kustomize/kustomize.sh \
+            --post-renderer-args mariadb-operator/${{ matrix.overlays }} > /tmp/rendered.yaml
+      - name: Return helm Build
+        uses: actions/upload-artifact@v4
+        with:
+          name: helm-mariadb-operator-artifact-${{ matrix.overlays }}
+          path: /tmp/rendered.yaml
diff --git a/.github/workflows/kustomize-mariadb-operator.yaml b/.github/workflows/kustomize-mariadb-operator.yaml
deleted file mode 100644
index 88ed60ca..00000000
--- a/.github/workflows/kustomize-mariadb-operator.yaml
+++ /dev/null
@@ -1,33 +0,0 @@
-name: Kustomize GitHub Actions for mariadb-operator
-
-on:
-  pull_request:
-    paths:
-      - base-kustomize/mariadb-operator/**
-      - .github/workflows/kustomize-mariadb-operator.yaml
-jobs:
-  kustomize:
-    name: Kustomize
-    runs-on: ubuntu-latest
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v4
-      - uses: azure/setup-helm@v3
-        with:
-          version: latest
-          token: "${{ secrets.GITHUB_TOKEN }}"
-        id: helm
-      - name: Kustomize Install
-        working-directory: /usr/local/bin/
-        run: |
-          if [ ! -f /usr/local/bin/kustomize ]; then
-            curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | sudo bash
-          fi
-      - name: Run Kustomize Build
-        run: |
-          kustomize build base-kustomize/mariadb-operator --enable-helm --helm-command ${{ steps.helm.outputs.helm-path }} > /tmp/rendered.yaml
-      - name: Return Kustomize Build
-        uses: actions/upload-artifact@v4
-        with:
-          name: kustomize-mariadb-operator-artifact
-          path: /tmp/rendered.yaml
diff --git a/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
new file mode 100644
index 00000000..161e5b82
--- /dev/null
+++ b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
@@ -0,0 +1,308 @@
+nameOverride: ""
+fullnameOverride: ""
+
+# --- CRDs
+crds:
+  # -- Whether the helm chart should create and update the CRDs. It is false by default, which implies that the CRDs must be
+  # managed independently with the mariadb-operator-crds helm chart.
+  # **WARNING** This should only be set to true during the initial deployment. If this chart manages the CRDs
+  # and is later uninstalled, all MariaDB instances will be DELETED.
+  enabled: false
+
+image:
+  repository: docker-registry3.mariadb.com/mariadb-operator/mariadb-operator
+  pullPolicy: IfNotPresent
+  # -- Image tag to use. By default the chart appVersion is used
+  tag: ""
+  # Setting a digest will override any tag
+  # digest: sha256:084a927ee9f3918a5c85d283f73822ae205757df352218de0b935853a0765060
+imagePullSecrets: []
+
+# -- Controller log level
+logLevel: INFO
+
+# -- Cluster DNS name
+clusterName: cluster.local
+
+# -- Whether the operator should watch CRDs only in its own namespace or not.
+currentNamespaceOnly: false
+
+ha:
+  # -- Enable high availability of the controller.
+  # If you enable it we recommend to set `affinity` and `pdb`
+  enabled: false
+  # -- Number of replicas
+  replicas: 3
+
+metrics:
+  # -- Enable operator internal metrics. Prometheus must be installed in the cluster
+  enabled: true
+  serviceMonitor:
+    # -- Enable controller ServiceMonitor
+    enabled: true
+    # -- Labels to be added to the controller ServiceMonitor
+    additionalLabels: {}
+    # release: kube-prometheus-stack
+    # --  Interval to scrape metrics
+    interval: 30s
+    # -- Timeout if metrics can't be retrieved in given time interval
+    scrapeTimeout: 25s
+
+serviceAccount:
+  # -- Specifies whether a service account should be created
+  enabled: true
+  # -- Automounts the service account token in all containers of the Pod
+  automount: true
+  # -- Annotations to add to the service account
+  annotations: {}
+  # -- Extra Labels to add to the service account
+  extraLabels: {}
+  # -- The name of the service account to use.
+  # If not set and enabled is true, a name is generated using the fullname template
+  name: ""
+
+rbac:
+  # -- Specifies whether RBAC resources should be created
+  enabled: true
+
+  aggregation:
+
+    # -- Specifies whether the cluster roles aggrate to view and edit predefinied roles
+    enabled: true
+
+# -- Extra arguments to be passed to the controller entrypoint
+extrArgs: []
+
+# -- Extra environment variables to be passed to the controller
+extraEnv: []
+
+# -- Extra environment variables from preexiting ConfigMap / Secret objects used by the controller using envFrom
+extraEnvFrom: []
+
+# -- Extra volumes to pass to pod.
+extraVolumes: []
+
+# -- Extra volumes to mount to the container.
+extraVolumeMounts: []
+
+# -- Annotations to add to controller Pod
+podAnnotations: {}
+
+# -- Security context to add to controller Pod
+podSecurityContext: {}
+
+# -- Security context to add to controller container
+securityContext: {}
+
+# -- Resources to add to controller container
+resources: {}
+# requests:
+#   cpu: 10m
+#   memory: 32Mi
+
+# -- Node selectors to add to controller Pod
+nodeSelector: {}
+
+# -- Tolerations to add to controller Pod
+tolerations: []
+
+# -- Affinity to add to controller Pod
+affinity: 
+  nodeAffinity:
+    requiredDuringSchedulingIgnoredDuringExecution:
+      nodeSelectorTerms:
+        - matchExpressions:
+            - key: node-role.kubernetes.io/worker
+              operator: In
+              values:
+                - worker
+  #  Sample on how to create an antiAffinity rule that place
+  #  the pods on different nodes, to be used together with `ha.enabled: true`
+  # podAntiAffinity:
+  #   requiredDuringSchedulingIgnoredDuringExecution:
+  #   - labelSelector:
+  #       matchExpressions:
+  #       - key: app.kubernetes.io/name
+  #         operator: In
+  #         values:
+  #         - mariadb-operator
+  #       - key: app.kubernetes.io/instance
+  #         operator: In
+  #         values:
+  #         - mariadb-operator
+  #     topologyKey: kubernetes.io/hostname
+
+pdb:
+  # -- Enable PodDisruptionBudget for the controller.
+  enabled: false
+  # -- Maximum number of unavailable Pods. You may also give a percentage, like `50%`
+  maxUnavailable: 1
+
+webhook:
+  # -- Specifies whether the webhook should be created.
+  enabled: true
+  image:
+    repository: docker-registry3.mariadb.com/mariadb-operator/mariadb-operator
+    pullPolicy: IfNotPresent
+    # -- Image tag to use. By default the chart appVersion is used
+    tag: ""
+    # Setting a digest will override any tag
+    # digest: sha256:084a927ee9f3918a5c85d283f73822ae205757df352218de0b935853a0765060
+  imagePullSecrets: []
+  ha:
+    # -- Enable high availability
+    enabled: false
+    # -- Number of replicas
+    replicas: 3
+  cert:
+    certManager:
+      # -- Whether to use cert-manager to issue and rotate the certificate. If set to false, mariadb-operator's cert-controller will be used instead.
+      enabled: true
+      # -- Issuer reference to be used in the Certificate resource. If not provided, a self-signed issuer will be used.
+      issuerRef: {}
+      # -- Duration to be used in the Certificate resource,
+      duration: ""
+      # -- Renew before duration to be used in the Certificate resource.
+      renewBefore: ""
+      # -- The maximum number of CertificateRequest revisions that are maintained in the Certificate’s history.
+      revisionHistoryLimit: 3
+    # -- Annotatioms to be added to webhook TLS secret.
+    secretAnnotations: {}
+    # -- Labels to be added to webhook TLS secret.
+    secretLabels: {}
+    ca:
+      # -- Path that contains the full CA trust chain.
+      path: ""
+      # -- File under 'ca.path' that contains the full CA trust chain.
+      key: ""
+    # -- Path where the certificate will be mounted. 'tls.crt' and 'tls.key' certificates files should be under this path.
+    path: /tmp/k8s-webhook-server/serving-certs
+  # -- Port to be used by the webhook server
+  port: 9443
+  # -- Expose the webhook server in the host network
+  hostNetwork: false
+  serviceMonitor:
+    # -- Enable webhook ServiceMonitor. Metrics must be enabled
+    enabled: true
+    # -- Labels to be added to the webhook ServiceMonitor
+    additionalLabels: {}
+    # release: kube-prometheus-stack
+    # --  Interval to scrape metrics
+    interval: 30s
+    # -- Timeout if metrics can't be retrieved in given time interval
+    scrapeTimeout: 25s
+  serviceAccount:
+    # -- Specifies whether a service account should be created
+    enabled: true
+    # -- Automounts the service account token in all containers of the Pod
+    automount: true
+    # -- Annotations to add to the service account
+    annotations: {}
+    # -- Extra Labels to add to the service account
+    extraLabels: {}
+    # -- The name of the service account to use.
+    # If not set and enabled is true, a name is generated using the fullname template
+    name: ""
+  # -- Annotations for webhook configurations.
+  annotations: {}
+  # -- Extra arguments to be passed to the webhook entrypoint
+  extrArgs: []
+  # -- Extra volumes to pass to webhook Pod
+  extraVolumes: []
+  # -- Extra volumes to mount to webhook container
+  extraVolumeMounts: []
+  # -- Annotations to add to webhook Pod
+  podAnnotations: {}
+  # -- Security context to add to webhook Pod
+  podSecurityContext: {}
+  # -- Security context to add to webhook container
+  securityContext: {}
+  # -- Resources to add to webhook container
+  resources: {}
+  # requests:
+  #   cpu: 10m
+  #   memory: 32Mi
+  # -- Node selectors to add to controller Pod
+  nodeSelector: {}
+  # -- Tolerations to add to controller Pod
+  tolerations: []
+  # -- Affinity to add to controller Pod
+  affinity:
+    nodeAffinity:
+    requiredDuringSchedulingIgnoredDuringExecution:
+      nodeSelectorTerms:
+        - matchExpressions:
+            - key: node-role.kubernetes.io/worker
+              operator: In
+              values:
+                - worker
+
+certController:
+  # -- Specifies whether the cert-controller should be created.
+  enabled: true
+  image:
+    repository: docker-registry3.mariadb.com/mariadb-operator/mariadb-operator
+    pullPolicy: IfNotPresent
+    # -- Image tag to use. By default the chart appVersion is used
+    tag: ""
+    # Setting a digest will override any tag
+    # digest: sha256:084a927ee9f3918a5c85d283f73822ae205757df352218de0b935853a0765060
+  imagePullSecrets: []
+  ha:
+    # -- Enable high availability
+    enabled: false
+    # -- Number of replicas
+    replicas: 3
+  # -- CA certificate validity. It must be greater than certValidity.
+  caValidity: 35064h
+  # -- Certificate validity.
+  certValidity: 8766h
+  # -- Duration used to verify whether a certificate is valid or not.
+  lookaheadValidity: 2160h
+  # -- Requeue duration to ensure that certificate gets renewed.
+  requeueDuration: 5m
+  serviceMonitor:
+    # -- Enable cert-controller ServiceMonitor. Metrics must be enabled
+    enabled: true
+    # -- Labels to be added to the cert-controller ServiceMonitor
+    additionalLabels: {}
+    # release: kube-prometheus-stack
+    # --  Interval to scrape metrics
+    interval: 30s
+    # -- Timeout if metrics can't be retrieved in given time interval
+    scrapeTimeout: 25s
+  serviceAccount:
+    # -- Specifies whether a service account should be created
+    enabled: true
+    # -- Automounts the service account token in all containers of the Pod
+    automount: true
+    # -- Annotations to add to the service account
+    annotations: {}
+    # -- Extra Labels to add to the service account
+    extraLabels: {}
+    # -- The name of the service account to use.
+    # If not set and enabled is true, a name is generated using the fullname template
+    name: ""
+  # -- Extra arguments to be passed to the cert-controller entrypoint
+  extrArgs: []
+  # -- Extra volumes to pass to cert-controller Pod
+  extraVolumes: []
+  # -- Extra volumes to mount to cert-controller container
+  extraVolumeMounts: []
+  # -- Annotations to add to cert-controller Pod
+  podAnnotations: {}
+  # -- Security context to add to cert-controller Pod
+  podSecurityContext: {}
+  # -- Security context to add to cert-controller container
+  securityContext: {}
+  # -- Resources to add to cert-controller container
+  resources: {}
+  # requests:
+  #   cpu: 10m
+  #   memory: 32Mi
+  # -- Node selectors to add to controller Pod
+  nodeSelector: {}
+  # -- Tolerations to add to controller Pod
+  tolerations: []
+  # -- Affinity to add to controller Pod
+  affinity: {}
\ No newline at end of file
diff --git a/base-kustomize/mariadb-operator/base/kustomization.yaml b/base-kustomize/mariadb-operator/base/kustomization.yaml
new file mode 100644
index 00000000..e609fb24
--- /dev/null
+++ b/base-kustomize/mariadb-operator/base/kustomization.yaml
@@ -0,0 +1,4 @@
+apiVersion: kustomize.config.k8s.io/v1beta1
+kind: Kustomization
+
+resources: []
diff --git a/base-kustomize/mariadb-operator/kustomization.yaml b/base-kustomize/mariadb-operator/kustomization.yaml
deleted file mode 100644
index 360fcdda..00000000
--- a/base-kustomize/mariadb-operator/kustomization.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-resources:
-  - ns-mariadb.yaml
-
-helmCharts:
-  - name: mariadb-operator
-    repo: https://mariadb-operator.github.io/mariadb-operator
-    releaseName: mariadb-operator
-    valuesInline:
-      clusterName: cluster.local
-      webhook:
-        cert:
-          certManager:
-            enabled: true
-        affinity:
-          nodeAffinity:
-            requiredDuringSchedulingIgnoredDuringExecution:
-              nodeSelectorTerms:
-                - matchExpressions:
-                    - key: node-role.kubernetes.io/worker
-                      operator: In
-                      values:
-                        - worker
-      metrics:
-        enabled: true
-      affinity:
-        nodeAffinity:
-          requiredDuringSchedulingIgnoredDuringExecution:
-            nodeSelectorTerms:
-              - matchExpressions:
-                  - key: node-role.kubernetes.io/worker
-                    operator: In
-                    values:
-                      - worker
-    includeCRDs: true
-    version: 0.28.1
-    namespace: mariadb-system
diff --git a/base-kustomize/mariadb-operator/ns-mariadb.yaml b/base-kustomize/mariadb-operator/ns-mariadb.yaml
deleted file mode 100644
index 2e2fc0e9..00000000
--- a/base-kustomize/mariadb-operator/ns-mariadb.yaml
+++ /dev/null
@@ -1,7 +0,0 @@
-apiVersion: v1
-kind: Namespace
-metadata:
-  labels:
-    kubernetes.io/metadata.name: mariadb-system
-    name: mariadb-system
-  name: mariadb-system
diff --git a/bin/install-mariadb-operator.sh b/bin/install-mariadb-operator.sh
new file mode 100644
index 00000000..6a135584
--- /dev/null
+++ b/bin/install-mariadb-operator.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# Default parameter value
+CLUSTER_NAME=${1:-cluster.local}
+
+# Directory to check for YAML files
+CONFIG_DIR="/etc/genestack/helm-configs/mariadb-operator"
+
+# 'cluster.local' is the default value in base helm values file
+if [ "${CLUSTER_NAME}" != "cluster.local" ]; then
+    CONFIG_FILE="$CONFIG_DIR/mariadb-operator-helm-overrides.yaml"
+
+    mkdir -p $CONFIG_DIR
+    touch "$CONFIG_FILE"
+
+    # Check if the file is empty and add/modify content accordingly
+    if [ ! -s "$CONFIG_FILE" ]; then
+        echo "clusterName: $CLUSTER_NAME" > "$CONFIG_FILE"
+    else
+        # If the clusterName line exists, modify it, otherwise add it at the end
+        if grep -q "^clusterName:" "$CONFIG_FILE"; then
+            sed -i -e "s/^clusterName: .*/clusterName: ${CLUSTER_NAME}/" "$CONFIG_FILE"
+        else
+            echo "clusterName: $CLUSTER_NAME" >> "$CONFIG_FILE"
+        fi
+    fi
+fi
+
+# Helm command setup
+HELM_CMD="helm upgrade --install mariadb-operator https://mariadb-operator.github.io/mariadb-operator \
+    --namespace=mariadb-system \
+    --create-namespace \
+    --timeout 120m \
+    --post-renderer /etc/genestack/kustomize/kustomize.sh \
+    --post-renderer-args mariadb-operator/overlay \
+    -f /opt/genestack/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml"
+
+# Check if YAML files exist in the specified directory
+if compgen -G "${CONFIG_DIR}/*.yaml" > /dev/null; then
+    # Add all YAML files from the directory to the helm command
+    for yaml_file in "${CONFIG_DIR}"/*.yaml; do
+        HELM_CMD+=" -f ${yaml_file}"
+    done
+fi
+
+# Run the helm command
+echo "Executing Helm command:"
+echo "${HELM_CMD}"
+eval "${HELM_CMD}"
diff --git a/docs/infrastructure-mariadb.md b/docs/infrastructure-mariadb.md
index 78c890eb..19eeae95 100644
--- a/docs/infrastructure-mariadb.md
+++ b/docs/infrastructure-mariadb.md
@@ -18,13 +18,12 @@
 
 ## Deploy the mariadb operator
 
-``` shell
-cluster_name=`kubectl config view --minify -o jsonpath='{.clusters[0].name}'`
-sed -i -e "s/cluster\.local/$cluster_name/" /etc/genestack/kustomize/mariadb-operator/kustomization.yaml
+!!! example "Run the mariadb-operator deployment Script `bin/install-mariadb-operator.sh` You can include cluster_name paramater. No paramaters deploys with `cluster.local"
 
-test -n "$cluster_name" && kubectl kustomize --enable-helm /etc/genestack/kustomize/mariadb-operator | \
-  kubectl --namespace mariadb-system apply --server-side --force-conflicts -f -
-```
+    ``` shell
+    cluster_name=`kubectl config view --minify -o jsonpath='{.clusters[0].name}'`
+    --8<-- "bin/install-mariadb-operator.sh $cluster_name"
+    ```
 
 !!! info
 

From 6db0a123dae842ca7830467bdddf7ebfdf44532d Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Tue, 26 Nov 2024 12:51:04 -0500
Subject: [PATCH 03/12] separating cluster_name

---
 docs/infrastructure-mariadb.md | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/docs/infrastructure-mariadb.md b/docs/infrastructure-mariadb.md
index 19eeae95..072d8eed 100644
--- a/docs/infrastructure-mariadb.md
+++ b/docs/infrastructure-mariadb.md
@@ -17,12 +17,16 @@
         ```
 
 ## Deploy the mariadb operator
+```
+cluster_name=`kubectl config view --minify -o jsonpath='{.clusters[0].name}'`
+echo $cluster_name
+```
+If `cluster_name` was anything other than `cluster.local` you should pass that as a parameter to the installer
 
-!!! example "Run the mariadb-operator deployment Script `bin/install-mariadb-operator.sh` You can include cluster_name paramater. No paramaters deploys with `cluster.local"
+!!! example "Run the mariadb-operator deployment Script `bin/install-mariadb-operator.sh` You can include cluster_name paramater. No paramaters deploys with `cluster.local` cluster name."
 
     ``` shell
-    cluster_name=`kubectl config view --minify -o jsonpath='{.clusters[0].name}'`
-    --8<-- "bin/install-mariadb-operator.sh $cluster_name"
+    --8<-- "bin/install-mariadb-operator.sh"
     ```
 
 !!! info

From 3da4777d7f98fdaba23c3e3b9ea779aede939fda Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Tue, 26 Nov 2024 16:35:16 -0500
Subject: [PATCH 04/12] add a comment

---
 base-kustomize/mariadb-operator/base/kustomization.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/base-kustomize/mariadb-operator/base/kustomization.yaml b/base-kustomize/mariadb-operator/base/kustomization.yaml
index e609fb24..e3d807a9 100644
--- a/base-kustomize/mariadb-operator/base/kustomization.yaml
+++ b/base-kustomize/mariadb-operator/base/kustomization.yaml
@@ -1,4 +1,6 @@
 apiVersion: kustomize.config.k8s.io/v1beta1
 kind: Kustomization
 
+# Keeping resources empty only as a placeholder for now
+# We can change this in the future when there was a need for post-renderer kustomize changes
 resources: []

From e9b93b957699912ee0c0632e171dc5941cbefa2a Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Fri, 29 Nov 2024 16:03:27 -0500
Subject: [PATCH 05/12] make scripts executable

---
 bin/install-libvirt.sh          | 0
 bin/install-mariadb-operator.sh | 0
 bin/install-memcached.sh        | 0
 3 files changed, 0 insertions(+), 0 deletions(-)
 mode change 100644 => 100755 bin/install-libvirt.sh
 mode change 100644 => 100755 bin/install-mariadb-operator.sh
 mode change 100644 => 100755 bin/install-memcached.sh

diff --git a/bin/install-libvirt.sh b/bin/install-libvirt.sh
old mode 100644
new mode 100755
diff --git a/bin/install-mariadb-operator.sh b/bin/install-mariadb-operator.sh
old mode 100644
new mode 100755
diff --git a/bin/install-memcached.sh b/bin/install-memcached.sh
old mode 100644
new mode 100755

From c8a716c994ad51a18f1122e9f44fde771438e30a Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Fri, 29 Nov 2024 17:05:04 -0500
Subject: [PATCH 06/12] fixing helm install command

---
 bin/install-mariadb-operator.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/install-mariadb-operator.sh b/bin/install-mariadb-operator.sh
index 6a135584..8d515f48 100755
--- a/bin/install-mariadb-operator.sh
+++ b/bin/install-mariadb-operator.sh
@@ -27,7 +27,7 @@ if [ "${CLUSTER_NAME}" != "cluster.local" ]; then
 fi
 
 # Helm command setup
-HELM_CMD="helm upgrade --install mariadb-operator https://mariadb-operator.github.io/mariadb-operator \
+HELM_CMD="helm upgrade --install mariadb-operator mariadb-operator --repo https://mariadb-operator.github.io/mariadb-operator \
     --namespace=mariadb-system \
     --create-namespace \
     --timeout 120m \

From fd328af32eb5a664259811ec06599f60baec86d8 Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Fri, 29 Nov 2024 17:18:45 -0500
Subject: [PATCH 07/12] fixing all.yaml for kustomize resources

---
 base-kustomize/mariadb-operator/base/kustomization.yaml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/base-kustomize/mariadb-operator/base/kustomization.yaml b/base-kustomize/mariadb-operator/base/kustomization.yaml
index e3d807a9..0f7996d3 100644
--- a/base-kustomize/mariadb-operator/base/kustomization.yaml
+++ b/base-kustomize/mariadb-operator/base/kustomization.yaml
@@ -1,6 +1,5 @@
 apiVersion: kustomize.config.k8s.io/v1beta1
 kind: Kustomization
 
-# Keeping resources empty only as a placeholder for now
-# We can change this in the future when there was a need for post-renderer kustomize changes
-resources: []
+resources:
+   - all.yaml

From f7d007d662d0d633aff9d86ca0c1f85c66c8432e Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Fri, 29 Nov 2024 17:19:57 -0500
Subject: [PATCH 08/12] fix helm command

---
 .github/workflows/helm-mariadb-operator.yaml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/helm-mariadb-operator.yaml b/.github/workflows/helm-mariadb-operator.yaml
index c7571215..5290b955 100644
--- a/.github/workflows/helm-mariadb-operator.yaml
+++ b/.github/workflows/helm-mariadb-operator.yaml
@@ -31,7 +31,7 @@ jobs:
             fi
       - name: Run Helm Template
         run: |
-          ${{ steps.helm.outputs.helm-path }} template mariadb-operator https://mariadb-operator.github.io/mariadb-operator \
+          ${{ steps.helm.outputs.helm-path }} template mariadb-operator mariadb-operator --repo https://mariadb-operator.github.io/mariadb-operator \
             --namespace=mariadb-system \
             --create-namespace \
             --wait \

From e7c249a38127cb942abc7026f51fb829d97487a0 Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Mon, 9 Dec 2024 15:03:08 -0500
Subject: [PATCH 09/12] using default values of mariadb-operator 0.28.0

---
 .../mariadb-operator-helm-overrides.yaml      | 74 +++----------------
 1 file changed, 10 insertions(+), 64 deletions(-)

diff --git a/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
index 161e5b82..fc08b254 100644
--- a/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
+++ b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
@@ -1,21 +1,11 @@
 nameOverride: ""
 fullnameOverride: ""
 
-# --- CRDs
-crds:
-  # -- Whether the helm chart should create and update the CRDs. It is false by default, which implies that the CRDs must be
-  # managed independently with the mariadb-operator-crds helm chart.
-  # **WARNING** This should only be set to true during the initial deployment. If this chart manages the CRDs
-  # and is later uninstalled, all MariaDB instances will be DELETED.
-  enabled: false
-
 image:
-  repository: docker-registry3.mariadb.com/mariadb-operator/mariadb-operator
+  repository: ghcr.io/mariadb-operator/mariadb-operator
   pullPolicy: IfNotPresent
   # -- Image tag to use. By default the chart appVersion is used
   tag: ""
-  # Setting a digest will override any tag
-  # digest: sha256:084a927ee9f3918a5c85d283f73822ae205757df352218de0b935853a0765060
 imagePullSecrets: []
 
 # -- Controller log level
@@ -24,19 +14,15 @@ logLevel: INFO
 # -- Cluster DNS name
 clusterName: cluster.local
 
-# -- Whether the operator should watch CRDs only in its own namespace or not.
-currentNamespaceOnly: false
-
 ha:
-  # -- Enable high availability of the controller.
-  # If you enable it we recommend to set `affinity` and `pdb`
+  # -- Enable high availability
   enabled: false
   # -- Number of replicas
   replicas: 3
 
 metrics:
   # -- Enable operator internal metrics. Prometheus must be installed in the cluster
-  enabled: true
+  enabled: false
   serviceMonitor:
     # -- Enable controller ServiceMonitor
     enabled: true
@@ -65,20 +51,12 @@ rbac:
   # -- Specifies whether RBAC resources should be created
   enabled: true
 
-  aggregation:
-
-    # -- Specifies whether the cluster roles aggrate to view and edit predefinied roles
-    enabled: true
-
 # -- Extra arguments to be passed to the controller entrypoint
 extrArgs: []
 
 # -- Extra environment variables to be passed to the controller
 extraEnv: []
 
-# -- Extra environment variables from preexiting ConfigMap / Secret objects used by the controller using envFrom
-extraEnvFrom: []
-
 # -- Extra volumes to pass to pod.
 extraVolumes: []
 
@@ -116,38 +94,13 @@ affinity:
               operator: In
               values:
                 - worker
-  #  Sample on how to create an antiAffinity rule that place
-  #  the pods on different nodes, to be used together with `ha.enabled: true`
-  # podAntiAffinity:
-  #   requiredDuringSchedulingIgnoredDuringExecution:
-  #   - labelSelector:
-  #       matchExpressions:
-  #       - key: app.kubernetes.io/name
-  #         operator: In
-  #         values:
-  #         - mariadb-operator
-  #       - key: app.kubernetes.io/instance
-  #         operator: In
-  #         values:
-  #         - mariadb-operator
-  #     topologyKey: kubernetes.io/hostname
-
-pdb:
-  # -- Enable PodDisruptionBudget for the controller.
-  enabled: false
-  # -- Maximum number of unavailable Pods. You may also give a percentage, like `50%`
-  maxUnavailable: 1
 
 webhook:
-  # -- Specifies whether the webhook should be created.
-  enabled: true
   image:
-    repository: docker-registry3.mariadb.com/mariadb-operator/mariadb-operator
+    repository: ghcr.io/mariadb-operator/mariadb-operator
     pullPolicy: IfNotPresent
     # -- Image tag to use. By default the chart appVersion is used
     tag: ""
-    # Setting a digest will override any tag
-    # digest: sha256:084a927ee9f3918a5c85d283f73822ae205757df352218de0b935853a0765060
   imagePullSecrets: []
   ha:
     # -- Enable high availability
@@ -160,22 +113,17 @@ webhook:
       enabled: true
       # -- Issuer reference to be used in the Certificate resource. If not provided, a self-signed issuer will be used.
       issuerRef: {}
-      # -- Duration to be used in the Certificate resource,
+       # -- Duration to be used in the Certificate resource,
       duration: ""
-      # -- Renew before duration to be used in the Certificate resource.
+       # -- Renew before duration to be used in the Certificate resource.
       renewBefore: ""
-      # -- The maximum number of CertificateRequest revisions that are maintained in the Certificate’s history.
-      revisionHistoryLimit: 3
     # -- Annotatioms to be added to webhook TLS secret.
     secretAnnotations: {}
     # -- Labels to be added to webhook TLS secret.
     secretLabels: {}
-    ca:
-      # -- Path that contains the full CA trust chain.
-      path: ""
-      # -- File under 'ca.path' that contains the full CA trust chain.
-      key: ""
-    # -- Path where the certificate will be mounted. 'tls.crt' and 'tls.key' certificates files should be under this path.
+    # -- Path where the CA certificate will be mounted.
+    caPath: /tmp/k8s-webhook-server/certificate-authority
+    # -- Path where the certificate will be mounted.
     path: /tmp/k8s-webhook-server/serving-certs
   # -- Port to be used by the webhook server
   port: 9443
@@ -241,12 +189,10 @@ certController:
   # -- Specifies whether the cert-controller should be created.
   enabled: true
   image:
-    repository: docker-registry3.mariadb.com/mariadb-operator/mariadb-operator
+    repository: ghcr.io/mariadb-operator/mariadb-operator
     pullPolicy: IfNotPresent
     # -- Image tag to use. By default the chart appVersion is used
     tag: ""
-    # Setting a digest will override any tag
-    # digest: sha256:084a927ee9f3918a5c85d283f73822ae205757df352218de0b935853a0765060
   imagePullSecrets: []
   ha:
     # -- Enable high availability

From fb9de314692ae9ee6021adbac672ed19488111db Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Wed, 11 Dec 2024 12:49:54 -0500
Subject: [PATCH 10/12] Fix: No newline at end of file

---
 .../mariadb-operator/mariadb-operator-helm-overrides.yaml      | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
index fc08b254..4aa0d3b2 100644
--- a/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
+++ b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
@@ -251,4 +251,5 @@ certController:
   # -- Tolerations to add to controller Pod
   tolerations: []
   # -- Affinity to add to controller Pod
-  affinity: {}
\ No newline at end of file
+  affinity: {}
+  
\ No newline at end of file

From d84878effa46c60e3d1f17eed469894ade463e35 Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Fri, 13 Dec 2024 11:16:12 -0500
Subject: [PATCH 11/12] missing new line

---
 .../mariadb-operator/mariadb-operator-helm-overrides.yaml        | 1 -
 1 file changed, 1 deletion(-)

diff --git a/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
index 4aa0d3b2..80c4f3a9 100644
--- a/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
+++ b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
@@ -252,4 +252,3 @@ certController:
   tolerations: []
   # -- Affinity to add to controller Pod
   affinity: {}
-  
\ No newline at end of file

From a729d9495503ad897bcd3c5bbadb7a100dac9ac6 Mon Sep 17 00:00:00 2001
From: mohammad <naghavimohammad@gmail.com>
Date: Fri, 13 Dec 2024 11:24:59 -0500
Subject: [PATCH 12/12] trailing white space

---
 .../mariadb-operator/mariadb-operator-helm-overrides.yaml       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
index 80c4f3a9..775a4a2b 100644
--- a/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
+++ b/base-helm-configs/mariadb-operator/mariadb-operator-helm-overrides.yaml
@@ -85,7 +85,7 @@ nodeSelector: {}
 tolerations: []
 
 # -- Affinity to add to controller Pod
-affinity: 
+affinity:
   nodeAffinity:
     requiredDuringSchedulingIgnoredDuringExecution:
       nodeSelectorTerms: