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

View File

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