Compare commits

..

3 Commits

3 changed files with 143 additions and 20 deletions

View File

@ -33,22 +33,32 @@ spec:
- "/bin/bash"
- "-ec"
- |
echo "COMECANDO com user 1013"
useradd -u 1013 -r -s /usr/sbin/nologin fenixuser
id
id stolon
id root
# Generate our keeper uid using the pod index
IFS='-' read -ra ADDR <<< "$(hostname)"
export STKEEPER_UID="keeper${ADDR[-1]}"
export POD_IP=$(hostname -i)
export STKEEPER_PG_LISTEN_ADDRESS=$POD_IP
mkdir -p /stolon-data/data
which psql
which postgres
which pg_ctl
export STOLON_DATA=/stolon-data/data
chown root:root /stolon-data
chown root:root $STOLON_DATA
exec gosu root stolon-keeper --data-dir $STOLON_DATA
securityContext:
runAsUser: 0
runAsGroup: 0
allowPrivilegeEscalation: true
mkdir -p $STOLON_DATA
ls -la $STOLON_DATA
exec gosu 1013 stolon-keeper --data-dir $STOLON_DATA
env:
- name: POD_NAME
valueFrom:
@ -92,7 +102,7 @@ spec:
- containerPort: 8080
volumeMounts:
- mountPath: /stolon-data
name: data
name: stolon-data
- mountPath: /etc/secrets/stolon
name: stolon
volumes:
@ -103,7 +113,7 @@ spec:
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: data
name: stolon-data
namespace: postgresql
spec:
accessModes:
@ -111,4 +121,6 @@ spec:
resources:
requests:
storage: 10Gi
storageClassName: stolon-nfs-csi
selector:
matchLabels:
postgres-id: "stolon-0"

View File

@ -0,0 +1,111 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: stolon-pv-0
namespace: postgresql
labels:
postgres-id: "stolon-0"
spec:
capacity:
storage: 10Gi
storageClassName: stolon-nfs-csi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
nfs:
server: 192.168.1.22
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/postgresql-stolon/keeper-0
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: stolon-pv-1
namespace: postgresql
labels:
postgres-id: "stolon-0"
spec:
capacity:
storage: 10Gi
storageClassName: stolon-nfs-csi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
nfs:
server: 192.168.1.22
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/postgresql-stolon/keeper-1
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: stolon-pv-2
namespace: postgresql
labels:
postgres-id: "stolon-0"
spec:
capacity:
storage: 10Gi
storageClassName: stolon-nfs-csi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
nfs:
server: 192.168.1.22
path: /mnt/fenix-main-nas-pool-0/data/k8s-Volumes/k8s-cluster-iac-deployed/postgresql-stolon/keeper-2
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: stolon-data-stolon-keeper-0
namespace: postgresql
labels:
postgres-id: "stolon-0"
spec:
storageClassName: stolon-nfs-csi
accessModes:
- ReadWriteOnce
volumeName: stolon-pv-0
resources:
requests:
storage: 10Gi
selector:
matchLabels:
postgres-id: "stolon-0"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: stolon-data-stolon-keeper-1
namespace: postgresql
labels:
postgres-id: "stolon-0"
spec:
storageClassName: stolon-nfs-csi
accessModes:
- ReadWriteOnce
volumeName: stolon-pv-1
resources:
requests:
storage: 10Gi
selector:
matchLabels:
postgres-id: "stolon-0"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: stolon-data-stolon-keeper-2
namespace: postgresql
labels:
postgres-id: "stolon-0"
spec:
storageClassName: stolon-nfs-csi
accessModes:
- ReadWriteOnce
volumeName: stolon-pv-2
resources:
requests:
storage: 10Gi
selector:
matchLabels:
postgres-id: "stolon-0"
---

View File

@ -60,11 +60,11 @@
environment:
KUBECONFIG: /home/fenix/.kube/config
#- name: Aplicar o stolon
# become: yes
# become_user: fenix
# shell: |
# kubectl run -i -n=postgresql -t stolonctl --image=sorintlab/stolon:master-pg10 --restart=Never --rm -- /usr/local/bin/stolonctl --cluster-name=kube-stolon --store-backend=kubernetes --kube-resource-kind=configmap init
# when: stolon_cluster_check.rc != 0
# environment:
# KUBECONFIG: /home/fenix/.kube/config
- name: Aplicar o stolon
become: yes
become_user: fenix
shell: |
kubectl run -i -n=postgresql -t stolonctl --image=sorintlab/stolon:master-pg15 --restart=Never --rm -- /usr/local/bin/stolonctl --cluster-name=kube-stolon --store-backend=kubernetes --kube-resource-kind=configmap init --yes
when: stolon_cluster_check.rc != 0
environment:
KUBECONFIG: /home/fenix/.kube/config