add pg and sonarqube

main
ycz008 2023-12-19 16:36:53 +08:00
parent c2570694ce
commit 307e904d29
2 changed files with 11 additions and 11 deletions

View File

@ -1,25 +1,25 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: StatefulSet kind: StatefulSet
metadata: metadata:
name: pg name: postgresql
spec: spec:
replicas: 1 replicas: 1
serviceName: pg serviceName: postgresql
selector: selector:
matchLabels: matchLabels:
app: pg app: postgresql
template: template:
metadata: metadata:
labels: labels:
app: pg app: postgresql
spec: spec:
containers: containers:
- name: pg - name: postgresql
image: postgres:14 image: postgres:14
ports: ports:
- containerPort: 5432 - containerPort: 5432
volumeMounts: volumeMounts:
- name: pg_data - name: postgresql_data
mountPath: /var/lib/postgresql/data mountPath: /var/lib/postgresql/data
env: env:
- name: POSTGRES_USER - name: POSTGRES_USER
@ -29,7 +29,7 @@ spec:
- name: POSTGRES_DB - name: POSTGRES_DB
value: "sonar" value: "sonar"
volumes: volumes:
- name: pg_data - name: postgresql_data
hostPath: hostPath:
path: /data/sonarqube/postgresql/data path: /data/sonarqube/postgresql/data
affinity: affinity:
@ -45,14 +45,14 @@ spec:
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: pg name: postgresql
labels: labels:
app: pg app: postgresql
spec: spec:
ports: ports:
- protocol: TCP - protocol: TCP
port: 5432 port: 5432
targetPort: 5432 targetPort: 5432
selector: selector:
app: pg app: postgresql
type: ClusterIP type: ClusterIP

View File

@ -19,7 +19,7 @@ spec:
image: sonarqube:10.3-community image: sonarqube:10.3-community
env: env:
- name: SONAR_JDBC_URL - name: SONAR_JDBC_URL
value: jdbc:postgresql://db:5432/sonar value: jdbc:postgresql://postgresql:5432/sonar
- name: SONAR_JDBC_USERNAME - name: SONAR_JDBC_USERNAME
value: sonar value: sonar
- name: SONAR_JDBC_PASSWORD - name: SONAR_JDBC_PASSWORD