diff --git a/k8s/argocd/templates/app-longhorn.yaml b/k8s/argocd/templates/app-longhorn.yaml index 8b09736..2172ce9 100644 --- a/k8s/argocd/templates/app-longhorn.yaml +++ b/k8s/argocd/templates/app-longhorn.yaml @@ -20,81 +20,5 @@ # syncOptions: # - CreateNamespace=true # --- -# # source: https://raw.githubusercontent.com/longhorn/longhorn/v1.4.0/deploy/prerequisite/longhorn-iscsi-installation.yaml -# apiVersion: apps/v1 -# kind: DaemonSet -# metadata: -# name: longhorn-iscsi-installation -# namespace: "{{ .Release.Namespace }}" -# labels: -# app: longhorn-iscsi-installation -# annotations: -# command: &cmd OS=$(grep -E "^ID_LIKE=" /etc/os-release | cut -d '=' -f 2); if [[ -z "${OS}" ]]; then OS=$(grep -E "^ID=" /etc/os-release | cut -d '=' -f 2); fi; if [[ "${OS}" == *"debian"* ]]; then sudo apt-get update -q -y && sudo apt-get install -q -y open-iscsi && sudo systemctl -q enable iscsid && sudo systemctl start iscsid && sudo modprobe iscsi_tcp; elif [[ "${OS}" == *"suse"* ]]; then sudo zypper --gpg-auto-import-keys -q refresh && sudo zypper --gpg-auto-import-keys -q install -y open-iscsi && sudo systemctl -q enable iscsid && sudo systemctl start iscsid && sudo modprobe iscsi_tcp; else sudo yum makecache -q -y && sudo yum --setopt=tsflags=noscripts install -q -y iscsi-initiator-utils && echo "InitiatorName=$(/sbin/iscsi-iname)" > /etc/iscsi/initiatorname.iscsi && sudo systemctl -q enable iscsid && sudo systemctl start iscsid && sudo modprobe iscsi_tcp; fi && if [ $? -eq 0 ]; then echo "iscsi install successfully"; else echo "iscsi install failed error code $?"; fi -# spec: -# selector: -# matchLabels: -# app: longhorn-iscsi-installation -# template: -# metadata: -# labels: -# app: longhorn-iscsi-installation -# spec: -# hostNetwork: true -# hostPID: true -# initContainers: -# - name: iscsi-installation -# command: -# - nsenter -# - --mount=/proc/1/ns/mnt -# - -- -# - bash -# - -c -# - *cmd -# image: alpine:3.12 -# securityContext: -# privileged: true -# containers: -# - name: sleep -# image: k8s.gcr.io/pause:3.1 -# updateStrategy: -# type: RollingUpdate -# --- -# # source: https://raw.githubusercontent.com/longhorn/longhorn/v1.4.0/deploy/prerequisite/longhorn-nfs-installation.yaml -# apiVersion: apps/v1 -# kind: DaemonSet -# metadata: -# name: longhorn-nfs-installation -# namespace: "{{ .Release.Namespace }}" -# labels: -# app: longhorn-nfs-installation -# annotations: -# command: &cmd OS=$(grep -E "^ID_LIKE=" /etc/os-release | cut -d '=' -f 2); if [[ -z "${OS}" ]]; then OS=$(grep -E "^ID=" /etc/os-release | cut -d '=' -f 2); fi; if [[ "${OS}" == *"debian"* ]]; then sudo apt-get update -q -y && sudo apt-get install -q -y nfs-common && sudo modprobe nfs; elif [[ "${OS}" == *"suse"* ]]; then sudo zypper --gpg-auto-import-keys -q refresh && sudo zypper --gpg-auto-import-keys -q install -y nfs-client && sudo modprobe nfs; else sudo yum makecache -q -y && sudo yum --setopt=tsflags=noscripts install -q -y nfs-utils && sudo modprobe nfs; fi && if [ $? -eq 0 ]; then echo "nfs install successfully"; else echo "nfs install failed error code $?"; fi -# spec: -# selector: -# matchLabels: -# app: longhorn-nfs-installation -# template: -# metadata: -# labels: -# app: longhorn-nfs-installation -# spec: -# hostNetwork: true -# hostPID: true -# initContainers: -# - name: nfs-installation -# command: -# - nsenter -# - --mount=/proc/1/ns/mnt -# - -- -# - bash -# - -c -# - *cmd -# image: alpine:3.12 -# securityContext: -# privileged: true -# containers: -# - name: sleep -# image: k8s.gcr.io/pause:3.1 -# updateStrategy: -# type: RollingUpdate + # {{- end -}} \ No newline at end of file diff --git a/k8s/argocd/templates/project-services.yaml b/k8s/argocd/templates/project-services.yaml index 44123a9..e82a71e 100644 --- a/k8s/argocd/templates/project-services.yaml +++ b/k8s/argocd/templates/project-services.yaml @@ -3,12 +3,12 @@ apiVersion: argoproj.io/v1alpha1 kind: AppProject metadata: - name: services + name: infra namespace: "{{ .Release.Namespace }}" finalizers: - resources-finalizer.argocd.argoproj.io spec: - description: services + description: infra sourceRepos: - '*' destinations: diff --git a/k8s/infra/misc/.helmignore b/k8s/infra/longhorn/.helmignore similarity index 100% rename from k8s/infra/misc/.helmignore rename to k8s/infra/longhorn/.helmignore diff --git a/k8s/infra/longhorn/Chart.yaml b/k8s/infra/longhorn/Chart.yaml new file mode 100644 index 0000000..ab88cef --- /dev/null +++ b/k8s/infra/longhorn/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: longhorn +description: "" +type: application +version: 0.1.0 + - name: longhorn + version: v1.4.0 + repository: https://charts.longhorn.io diff --git a/k8s/infra/longhorn/templates/iscsi.yaml b/k8s/infra/longhorn/templates/iscsi.yaml new file mode 100644 index 0000000..54e75a8 --- /dev/null +++ b/k8s/infra/longhorn/templates/iscsi.yaml @@ -0,0 +1,37 @@ +# source: https://raw.githubusercontent.com/longhorn/longhorn/v1.4.0/deploy/prerequisite/iscsi-installation.yaml +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: iscsi-installation + labels: + app: iscsi-installation + annotations: + command: &cmd OS=$(grep -E "^ID_LIKE=" /etc/os-release | cut -d '=' -f 2); if [[ -z "${OS}" ]]; then OS=$(grep -E "^ID=" /etc/os-release | cut -d '=' -f 2); fi; if [[ "${OS}" == *"debian"* ]]; then sudo apt-get update -q -y && sudo apt-get install -q -y open-iscsi && sudo systemctl -q enable iscsid && sudo systemctl start iscsid && sudo modprobe iscsi_tcp; elif [[ "${OS}" == *"suse"* ]]; then sudo zypper --gpg-auto-import-keys -q refresh && sudo zypper --gpg-auto-import-keys -q install -y open-iscsi && sudo systemctl -q enable iscsid && sudo systemctl start iscsid && sudo modprobe iscsi_tcp; else sudo yum makecache -q -y && sudo yum --setopt=tsflags=noscripts install -q -y iscsi-initiator-utils && echo "InitiatorName=$(/sbin/iscsi-iname)" > /etc/iscsi/initiatorname.iscsi && sudo systemctl -q enable iscsid && sudo systemctl start iscsid && sudo modprobe iscsi_tcp; fi && if [ $? -eq 0 ]; then echo "iscsi install successfully"; else echo "iscsi install failed error code $?"; fi +spec: + selector: + matchLabels: + app: iscsi-installation + template: + metadata: + labels: + app: iscsi-installation + spec: + hostNetwork: true + hostPID: true + initContainers: + - name: iscsi-installation + command: + - nsenter + - --mount=/proc/1/ns/mnt + - -- + - bash + - -c + - *cmd + image: alpine:3.12 + securityContext: + privileged: true + containers: + - name: sleep + image: k8s.gcr.io/pause:3.1 + updateStrategy: + type: RollingUpdate \ No newline at end of file diff --git a/k8s/infra/longhorn/templates/nfs.yaml b/k8s/infra/longhorn/templates/nfs.yaml new file mode 100644 index 0000000..703b5f2 --- /dev/null +++ b/k8s/infra/longhorn/templates/nfs.yaml @@ -0,0 +1,38 @@ +--- +# source: https://raw.githubusercontent.com/longhorn/longhorn/v1.4.0/deploy/prerequisite/longhorn-nfs-installation.yaml +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: nfs-installation + labels: + app: nfs-installation + annotations: + command: &cmd OS=$(grep -E "^ID_LIKE=" /etc/os-release | cut -d '=' -f 2); if [[ -z "${OS}" ]]; then OS=$(grep -E "^ID=" /etc/os-release | cut -d '=' -f 2); fi; if [[ "${OS}" == *"debian"* ]]; then sudo apt-get update -q -y && sudo apt-get install -q -y nfs-common && sudo modprobe nfs; elif [[ "${OS}" == *"suse"* ]]; then sudo zypper --gpg-auto-import-keys -q refresh && sudo zypper --gpg-auto-import-keys -q install -y nfs-client && sudo modprobe nfs; else sudo yum makecache -q -y && sudo yum --setopt=tsflags=noscripts install -q -y nfs-utils && sudo modprobe nfs; fi && if [ $? -eq 0 ]; then echo "nfs install successfully"; else echo "nfs install failed error code $?"; fi +spec: + selector: + matchLabels: + app: nfs-installation + template: + metadata: + labels: + app: nfs-installation + spec: + hostNetwork: true + hostPID: true + initContainers: + - name: nfs-installation + command: + - nsenter + - --mount=/proc/1/ns/mnt + - -- + - bash + - -c + - *cmd + image: alpine:3.12 + securityContext: + privileged: true + containers: + - name: sleep + image: k8s.gcr.io/pause:3.1 + updateStrategy: + type: RollingUpdate \ No newline at end of file diff --git a/k8s/infra/misc/values.yaml b/k8s/infra/longhorn/values.yaml similarity index 100% rename from k8s/infra/misc/values.yaml rename to k8s/infra/longhorn/values.yaml diff --git a/k8s/infra/misc/Chart.yaml b/k8s/infra/misc/Chart.yaml deleted file mode 100644 index c2d6855..0000000 --- a/k8s/infra/misc/Chart.yaml +++ /dev/null @@ -1,5 +0,0 @@ -apiVersion: v2 -name: misc -description: A Helm chart for Kubernetes -type: application -version: 0.1.0