mirror of
https://gitea.fenix-dev.com/fenix-gitea-admin/iac-ansible-private.git
synced 2026-03-22 04:19:48 +00:00
Compare commits
3 Commits
f532ff4507
...
d460624689
| Author | SHA1 | Date | |
|---|---|---|---|
| d460624689 | |||
| 676cc04dd4 | |||
| e62baff9e7 |
@ -33,22 +33,32 @@ spec:
|
|||||||
- "/bin/bash"
|
- "/bin/bash"
|
||||||
- "-ec"
|
- "-ec"
|
||||||
- |
|
- |
|
||||||
|
|
||||||
|
echo "COMECANDO com user 1013"
|
||||||
|
useradd -u 1013 -r -s /usr/sbin/nologin fenixuser
|
||||||
|
id
|
||||||
id stolon
|
id stolon
|
||||||
id root
|
|
||||||
# Generate our keeper uid using the pod index
|
# Generate our keeper uid using the pod index
|
||||||
IFS='-' read -ra ADDR <<< "$(hostname)"
|
IFS='-' read -ra ADDR <<< "$(hostname)"
|
||||||
export STKEEPER_UID="keeper${ADDR[-1]}"
|
export STKEEPER_UID="keeper${ADDR[-1]}"
|
||||||
export POD_IP=$(hostname -i)
|
export POD_IP=$(hostname -i)
|
||||||
export STKEEPER_PG_LISTEN_ADDRESS=$POD_IP
|
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
|
export STOLON_DATA=/stolon-data/data
|
||||||
chown root:root /stolon-data
|
mkdir -p $STOLON_DATA
|
||||||
chown root:root $STOLON_DATA
|
|
||||||
exec gosu root stolon-keeper --data-dir $STOLON_DATA
|
|
||||||
securityContext:
|
ls -la $STOLON_DATA
|
||||||
runAsUser: 0
|
|
||||||
runAsGroup: 0
|
exec gosu 1013 stolon-keeper --data-dir $STOLON_DATA
|
||||||
allowPrivilegeEscalation: true
|
|
||||||
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- name: POD_NAME
|
- name: POD_NAME
|
||||||
valueFrom:
|
valueFrom:
|
||||||
@ -92,7 +102,7 @@ spec:
|
|||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /stolon-data
|
- mountPath: /stolon-data
|
||||||
name: data
|
name: stolon-data
|
||||||
- mountPath: /etc/secrets/stolon
|
- mountPath: /etc/secrets/stolon
|
||||||
name: stolon
|
name: stolon
|
||||||
volumes:
|
volumes:
|
||||||
@ -103,7 +113,7 @@ spec:
|
|||||||
- kind: PersistentVolumeClaim
|
- kind: PersistentVolumeClaim
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
metadata:
|
metadata:
|
||||||
name: data
|
name: stolon-data
|
||||||
namespace: postgresql
|
namespace: postgresql
|
||||||
spec:
|
spec:
|
||||||
accessModes:
|
accessModes:
|
||||||
@ -111,4 +121,6 @@ spec:
|
|||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
storage: 10Gi
|
storage: 10Gi
|
||||||
storageClassName: stolon-nfs-csi
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
postgres-id: "stolon-0"
|
||||||
111
roles/stolon/files/stolon-pvcs.yaml
Normal file
111
roles/stolon/files/stolon-pvcs.yaml
Normal 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"
|
||||||
|
---
|
||||||
@ -60,11 +60,11 @@
|
|||||||
environment:
|
environment:
|
||||||
KUBECONFIG: /home/fenix/.kube/config
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
|
|
||||||
#- name: Aplicar o stolon
|
- name: Aplicar o stolon
|
||||||
# become: yes
|
become: yes
|
||||||
# become_user: fenix
|
become_user: fenix
|
||||||
# shell: |
|
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
|
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
|
when: stolon_cluster_check.rc != 0
|
||||||
# environment:
|
environment:
|
||||||
# KUBECONFIG: /home/fenix/.kube/config
|
KUBECONFIG: /home/fenix/.kube/config
|
||||||
Reference in New Issue
Block a user