Skip to content

Commit

Permalink
chore: add cluster-dev.yml for development and restore cluster.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
D-D-H committed Mar 4, 2024
1 parent b4787d9 commit 737afa1
Show file tree
Hide file tree
Showing 2 changed files with 204 additions and 0 deletions.
203 changes: 203 additions & 0 deletions cluster-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# http://www.eclipse.org/legal/epl-2.0
#
# SPDX-License-Identifier: EPL-2.0

apiVersion: v1
kind: Namespace
metadata:
name: jifa
labels:
name: jifa

---
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: jifa
name: jifa-service-account

---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: jifa
name: jifa-role
rules:
- apiGroups: [""]
resources: ["pods", "pods/exec"]
verbs: ["get", "list", "delete", "patch", "create"]

---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
namespace: jifa
name: role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: jifa-role
subjects:
- kind: ServiceAccount
namespace: jifa
name: jifa-service-account

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: jifa
name: mysql-pvc
spec:
storageClassName: alibabacloud-cnfs-nas
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

---
apiVersion: v1
kind: ConfigMap
metadata:
namespace: jifa
name: mysql-initdb-config
data:
initdb.sql: |
CREATE DATABASE IF NOT EXISTS jifa;
---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: jifa
name: mysql
spec:
selector:
matchLabels:
app: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mysql:5.6
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-pv
mountPath: /var/lib/mysql
- name: mysql-initdb
mountPath: /docker-entrypoint-initdb.d
volumes:
- name: mysql-pv
persistentVolumeClaim:
claimName: mysql-pvc
- name: mysql-initdb
configMap:
name: mysql-initdb-config

---
apiVersion: v1
kind: Service
metadata:
namespace: jifa
name: mysql-service
spec:
ports:
- port: 3306
selector:
app: mysql

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
namespace: jifa
name: jifa-pvc
spec:
storageClassName: alibabacloud-cnfs-nas
accessModes:
- ReadWriteMany
resources:
requests:
storage: 2Gi

---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: jifa
name: jifa-master
labels:
app: jifa-master
spec:
replicas: 3
selector:
matchLabels:
app: jifa-master
template:
metadata:
labels:
app: jifa-master
spec:
serviceAccountName: jifa-service-account
containers:
- name: main-container
image: eclipsejifa/jifa:latest
imagePullPolicy: Always
volumeMounts:
- name: jifa-pv
mountPath: "/jifa-storage"
env:
- name: MYSQL_HOST
value: mysql-service:3306
- name: MYSQL_DATABASE
value: jifa
- name: MYSQL_USER
value: root
- name: MYSQL_PASSWORD
value: password
args:
- --jifa.role=master
- --jifa.storage-pvc-name=jifa-pvc
- --jifa.storage-path=/jifa-storage
- --jifa.service-account-name=jifa-service-account
- --jifa.elastic-worker-image=eclipsejifa/jifa:latest
ports:
- name: jifa-port
containerPort: 8102
volumes:
- name: jifa-pv
persistentVolumeClaim:
claimName: jifa-pvc

---
apiVersion: v1
kind: Service
metadata:
namespace: jifa
name: jifa-service
spec:
selector:
app: jifa-master
ports:
- protocol: TCP
port: 80
targetPort: jifa-port
type: LoadBalancer
1 change: 1 addition & 0 deletions cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ spec:
value: password
args:
- --jifa.role=master
- --jifa.scheduling-strategy=elastic
- --jifa.storage-pvc-name=jifa-pvc
- --jifa.storage-path=/jifa-storage
- --jifa.service-account-name=jifa-service-account
Expand Down

0 comments on commit 737afa1

Please sign in to comment.