From 66e890083b5d004e306450cd875e61df55c208d7 Mon Sep 17 00:00:00 2001 From: Monet Lee Date: Sun, 29 Dec 2024 10:32:14 +0800 Subject: [PATCH] build: update kubernetes deployment files. (#617) * remove unused contents. * update go version in dockerfile. * build: update kubernetes deployment files. * update go mod. * update deployments docs. * docs: update docs contents. * build: update deployment contents. * docs: update deployment docs. * docs: update deployment docs. * docs: improve docs contents. --- Dockerfile | 4 +- deployments/README.md | 122 ++++++++++++++ deployments/deploy/chat-config.yml | 148 +++++++++++++++++ deployments/deploy/mongo-secret.yml | 8 + .../deploy/openim-admin-api-deployment.yml | 46 ++++++ .../deploy/openim-admin-api-service.yml | 13 ++ .../deploy/openim-admin-rpc-deployment.yml | 46 ++++++ .../deploy/openim-admin-rpc-service.yml | 13 ++ .../deploy/openim-chat-api-deployment.yml | 46 ++++++ .../deploy/openim-chat-api-service.yml | 13 ++ .../deploy/openim-chat-rpc-deployment.yml | 46 ++++++ .../deploy/openim-chat-rpc-service.yml | 13 ++ deployments/deploy/redis-secret.yml | 7 + deployments/helm-charts/.helmignore | 23 --- deployments/helm-charts/Chart.yaml | 38 ----- .../helm-charts/charts/admin-rpc/.helmignore | 23 --- .../helm-charts/charts/admin-rpc/Chart.yaml | 38 ----- .../charts/admin-rpc/templates/NOTES.txt | 22 --- .../charts/admin-rpc/templates/_helpers.tpl | 62 -------- .../admin-rpc/templates/deployment.yaml | 83 ---------- .../charts/admin-rpc/templates/hpa.yaml | 42 ----- .../charts/admin-rpc/templates/ingress.yaml | 75 --------- .../charts/admin-rpc/templates/service.yaml | 29 ---- .../admin-rpc/templates/serviceaccount.yaml | 26 --- .../helm-charts/charts/admin-rpc/values.yaml | 96 ----------- .../helm-charts/charts/chat-api/.helmignore | 23 --- .../helm-charts/charts/chat-api/Chart.yaml | 38 ----- .../charts/chat-api/templates/NOTES.txt | 22 --- .../charts/chat-api/templates/_helpers.tpl | 62 -------- .../charts/chat-api/templates/deployment.yaml | 83 ---------- .../charts/chat-api/templates/hpa.yaml | 42 ----- .../charts/chat-api/templates/ingress.yaml | 75 --------- .../charts/chat-api/templates/service.yaml | 29 ---- .../chat-api/templates/serviceaccount.yaml | 26 --- .../helm-charts/charts/chat-api/values.yaml | 98 ------------ .../helm-charts/charts/chat-rpc/.helmignore | 23 --- .../helm-charts/charts/chat-rpc/Chart.yaml | 38 ----- .../charts/chat-rpc/templates/NOTES.txt | 22 --- .../charts/chat-rpc/templates/_helpers.tpl | 62 -------- .../charts/chat-rpc/templates/deployment.yaml | 83 ---------- .../charts/chat-rpc/templates/hpa.yaml | 42 ----- .../charts/chat-rpc/templates/ingress.yaml | 75 --------- .../charts/chat-rpc/templates/service.yaml | 29 ---- .../chat-rpc/templates/serviceaccount.yaml | 26 --- .../helm-charts/charts/chat-rpc/values.yaml | 96 ----------- deployments/helm-charts/config.yaml | 128 --------------- deployments/helm-charts/templates/NOTES.txt | 22 --- .../helm-charts/templates/_helpers.tpl | 62 -------- deployments/helm-charts/templates/app-cm.yaml | 23 --- .../helm-charts/templates/deployment.yaml | 83 ---------- deployments/helm-charts/templates/hpa.yaml | 42 ----- .../helm-charts/templates/ingress.yaml | 75 --------- .../helm-charts/templates/service.yaml | 29 ---- .../helm-charts/templates/serviceaccount.yaml | 26 --- deployments/helm-charts/values.yaml | 98 ------------ deployments/templates/config.yaml | 150 ------------------ go.mod | 12 +- 57 files changed, 529 insertions(+), 2297 deletions(-) create mode 100644 deployments/README.md create mode 100644 deployments/deploy/chat-config.yml create mode 100644 deployments/deploy/mongo-secret.yml create mode 100644 deployments/deploy/openim-admin-api-deployment.yml create mode 100644 deployments/deploy/openim-admin-api-service.yml create mode 100644 deployments/deploy/openim-admin-rpc-deployment.yml create mode 100644 deployments/deploy/openim-admin-rpc-service.yml create mode 100644 deployments/deploy/openim-chat-api-deployment.yml create mode 100644 deployments/deploy/openim-chat-api-service.yml create mode 100644 deployments/deploy/openim-chat-rpc-deployment.yml create mode 100644 deployments/deploy/openim-chat-rpc-service.yml create mode 100644 deployments/deploy/redis-secret.yml delete mode 100644 deployments/helm-charts/.helmignore delete mode 100644 deployments/helm-charts/Chart.yaml delete mode 100644 deployments/helm-charts/charts/admin-rpc/.helmignore delete mode 100644 deployments/helm-charts/charts/admin-rpc/Chart.yaml delete mode 100644 deployments/helm-charts/charts/admin-rpc/templates/NOTES.txt delete mode 100644 deployments/helm-charts/charts/admin-rpc/templates/_helpers.tpl delete mode 100644 deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml delete mode 100644 deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml delete mode 100644 deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml delete mode 100644 deployments/helm-charts/charts/admin-rpc/templates/service.yaml delete mode 100644 deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml delete mode 100644 deployments/helm-charts/charts/admin-rpc/values.yaml delete mode 100644 deployments/helm-charts/charts/chat-api/.helmignore delete mode 100644 deployments/helm-charts/charts/chat-api/Chart.yaml delete mode 100644 deployments/helm-charts/charts/chat-api/templates/NOTES.txt delete mode 100644 deployments/helm-charts/charts/chat-api/templates/_helpers.tpl delete mode 100644 deployments/helm-charts/charts/chat-api/templates/deployment.yaml delete mode 100644 deployments/helm-charts/charts/chat-api/templates/hpa.yaml delete mode 100644 deployments/helm-charts/charts/chat-api/templates/ingress.yaml delete mode 100644 deployments/helm-charts/charts/chat-api/templates/service.yaml delete mode 100644 deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml delete mode 100644 deployments/helm-charts/charts/chat-api/values.yaml delete mode 100644 deployments/helm-charts/charts/chat-rpc/.helmignore delete mode 100644 deployments/helm-charts/charts/chat-rpc/Chart.yaml delete mode 100644 deployments/helm-charts/charts/chat-rpc/templates/NOTES.txt delete mode 100644 deployments/helm-charts/charts/chat-rpc/templates/_helpers.tpl delete mode 100644 deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml delete mode 100644 deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml delete mode 100644 deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml delete mode 100644 deployments/helm-charts/charts/chat-rpc/templates/service.yaml delete mode 100644 deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml delete mode 100644 deployments/helm-charts/charts/chat-rpc/values.yaml delete mode 100644 deployments/helm-charts/config.yaml delete mode 100644 deployments/helm-charts/templates/NOTES.txt delete mode 100644 deployments/helm-charts/templates/_helpers.tpl delete mode 100644 deployments/helm-charts/templates/app-cm.yaml delete mode 100644 deployments/helm-charts/templates/deployment.yaml delete mode 100644 deployments/helm-charts/templates/hpa.yaml delete mode 100644 deployments/helm-charts/templates/ingress.yaml delete mode 100644 deployments/helm-charts/templates/service.yaml delete mode 100644 deployments/helm-charts/templates/serviceaccount.yaml delete mode 100644 deployments/helm-charts/values.yaml delete mode 100644 deployments/templates/config.yaml diff --git a/Dockerfile b/Dockerfile index c0076d9cd..8751beace 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Use Go 1.21 Alpine as the base image for building the application -FROM golang:1.21-alpine as builder +FROM golang:1.22-alpine as builder # Define the base directory for the application as an environment variable ENV SERVER_DIR=/openim-chat @@ -22,7 +22,7 @@ RUN go install github.com/magefile/mage@v1.15.0 RUN mage build # Using Alpine Linux with Go environment for the final image -FROM golang:1.21-alpine +FROM golang:1.22-alpine # Install necessary packages, such as bash RUN apk add --no-cache bash diff --git a/deployments/README.md b/deployments/README.md new file mode 100644 index 000000000..09b9e42f1 --- /dev/null +++ b/deployments/README.md @@ -0,0 +1,122 @@ +# OpenIM Chat Deployment + +## Preconditions + +- Ensure deployed OpenIM Server and its dependencies. + - Redis + - MongoDB + - Kafka + - MinIO +- Expose the corresponding Services and ports of OpenIM Server. + +## Deploy OpenIM Chat + +**Chat depends on OpenIM Server, so you need to deploy OpenIM Server first.** + +enter the target directory + +```shell +cd deployments/deploy +``` + +### Modify ConfigMap + +You need to modify the `chat-config.yml` file to match your environment. Focus on the following fields: +**discovery.yml** + +- `kubernetes.namespace`: default is `default`, you can change it to your namespace. + +**mongodb.yml** + +- `address`: set to your already mongodb address or mongo Service name and port in your deployed. +- `database`: set to your mongodb database name.(Need have a created database.) +- `authSource`: et to your mongodb authSource. (authSource is specify the database name associated with the user's credentials, user need create in this database.) + +**redis.yml** + +- `address`: set to your already redis address or redis Service name and port in your deployed. + +**share.yml** + +- `openIM.apiURL`: modify to your already API address or use your `openim-api` service name and port +- `openIM.secret`: same to IM Server `share.secret` value. + +### Set the secret + +A Secret is an object that contains a small amount of sensitive data. Such as password and secret. Secret is similar to ConfigMaps. + +#### Redis: + +Update the `redis-password` value in `redis-secret.yml` to your Redis password encoded in base64. + +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: openim-redis-secret +type: Opaque +data: + redis-password: b3BlbklNMTIz # update to your redis password encoded in base64, if need empty, you can set to "" +``` + +#### Mongo: + +Update the `mongo_openim_username`, `mongo_openim_password` value in `mongo-secret.yml` to your Mongo username and password encoded in base64. + +```yaml +apiVersion: v1 +kind: Secret +metadata: + name: openim-mongo-secret +type: Opaque +data: + mongo_openim_username: b3BlbklN # update to your mongo username encoded in base64, if need empty, you can set to "" (this user credentials need in authSource database) + mongo_openim_password: b3BlbklNMTIz # update to your mongo password encoded in base64, if need empty, you can set to "" +``` + +### Apply the secret. + +```shell +kubectl apply -f redis-secret.yml -f mongo-secret.yml +``` + +### Apply Config and Services + +deploy the config and services + +```shell +kubectl apply -f chat-config.yml -f openim-admin-api-service.yml -f openim-chat-api-service.yml -f openim-admin-rpc-service.yml -f openim-chat-rpc-service.yml +``` + +### Start Chat Deployments + +```shell +kubectl apply -f openim-chat-api-deployment.yml -f openim-admin-api-deployment.yml -f openim-chat-rpc-deployment.yml -f openim-admin-rpc-deployment.yml +``` + +## Verify + +After the deployment is complete, you can verify the deployment status. + +```shell +# Check the status of all pods +kubectl get pods + +# Check the status of services +kubectl get svc + +# Check the status of deployments +kubectl get deployments + +# View all resources +kubectl get all + +``` + +## clean all + +`kubectl delete -f ./` + +## Notes: + +- If you use a specific namespace for your deployment, be sure to append the -n flag to your kubectl commands. diff --git a/deployments/deploy/chat-config.yml b/deployments/deploy/chat-config.yml new file mode 100644 index 000000000..330d69122 --- /dev/null +++ b/deployments/deploy/chat-config.yml @@ -0,0 +1,148 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: openim-chat-config +data: + discovery.yml: | + enable: kubernetes + kubernetes: + namespace: default + etcd: + rootDirectory: openim + address: [ localhost:12379 ] + username: '' + password: '' + + rpcService: + chat: chat-rpc-service + admin: admin-rpc-service + + log.yml: | + # Log storage path, default is acceptable, change to a full path if modification is needed + # storageLocation: ../../../../logs/ + storageLocation: ./logs/ + # Log rotation period (in hours), default is acceptable + rotationTime: 24 + # Number of log files to retain, default is acceptable + remainRotationCount: 2 + # Log level settings: 3 for production environment; 6 for more verbose logging in debugging environments + remainLogLevel: 6 + # Whether to output to standard output, default is acceptable + isStdout: true + # Whether to log in JSON format, default is acceptable + isJson: false + # output simplify log when KeyAndValues's value len is bigger than 50 in rpc method log + isSimplify: true + + mongodb.yml: | + # URI for database connection, leave empty if using address and credential settings directly + uri: '' + # List of MongoDB server addresses + address: [ mongo-service:37017 ] + # Name of the database + database: openim_v3 + # Username for database authentication + username: openIM + # Password for database authentication + password: # openIM123 + # Authentication source for database authentication, if use root user, set it to admin + authSource: openim_v3 + # Maximum number of connections in the connection pool + maxPoolSize: 100 + # Maximum number of retry attempts for a failed database connection + maxRetry: 10 + + redis.yml: | + # List of Redis server addresses + address: [ redis-service:16379 ] + # Username for Redis authentication (leave blank if not used) + username: '' + # Password for Redis authentication + password: # openIM123 + # Enable or disable pipeline processing + enablePipeline: false + # Enable or disable cluster mode + clusterMode: false + # Database index to be used + db: 0 + # Maximum number of retry attempts for a failed connection + maxRetry: 10 + + share.yml: | + openIM: + # OpenIM API address + apiURL: http://openim-api-service:10002 + # OpenIM secret key, must be consistent with OpenIM + secret: openIM123 + # OpenIM administrator userID, must be consistent with OpenIM + adminUserID: imAdmin + + chatAdmin: + # Default username and password for the admin + - "chatAdmin" + + chat-api-admin.yml: | + api: + # Listening IP; 0.0.0.0 means both internal and external IPs are listened to, default is recommended + listenIP: 0.0.0.0 + # Listening ports; if multiple are configured, multiple instances will be launched + ports: [ 10009 ] + + chat-rpc-admin.yml: | + rpc: + # The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP + registerIP: '' + # IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP + listenIP: 0.0.0.0 + # List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. + ports: [ 30200 ] + + tokenPolicy: + expire: 90 + + secret: chat123 + chat-api-chat.yml: | + api: + # Listening IP; 0.0.0.0 means both internal and external IPs are listened to, default is recommended + listenIP: 0.0.0.0 + # Listening ports; if multiple are configured, multiple instances will be launched + ports: [ 10008 ] + + chat-rpc-chat.yml: | + rpc: + # The IP address where this RPC service registers itself; if left blank, it defaults to the internal network IP + registerIP: '' + # IP address that the RPC service listens on; setting to 0.0.0.0 listens on both internal and external IPs. If left blank, it automatically uses the internal network IP + listenIP: 0.0.0.0 + # List of ports that the RPC service listens on; configuring multiple ports will launch multiple instances. + ports: [ 30300 ] + + verifyCode: + validTime: 300 + validCount: 5 + uintTime: 86400 + maxCount: 10 + superCode: "666666" + len: 6 + phone: + use: "" + ali: + endpoint: "" + accessKeyId: "" + accessKeySecret: "" + signName: "" + verificationCodeTemplateCode: "" + mail: + enable: false + title: "" + senderMail: "" + senderAuthorizationCode: "" + smtpAddr: "" + smtpPort: + + liveKit: + url: "ws://127.0.0.1:7880" # LIVEKIT_URL, LiveKit server address and port + key: "APIGPW3gnFTzqHH" + secret: "23ztfSqsfQ8hKkHzHTl3Z4bvaxro0snjk5jwbp5p6Q3" + + allowRegister: true diff --git a/deployments/deploy/mongo-secret.yml b/deployments/deploy/mongo-secret.yml new file mode 100644 index 000000000..c3c10af24 --- /dev/null +++ b/deployments/deploy/mongo-secret.yml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: openim-mongo-secret +type: Opaque +data: + mongo_openim_username: b3BlbklN # base64 for "openIM", this user credentials need in authSource database. + mongo_openim_password: b3BlbklNMTIz # base64 for "openIM123" diff --git a/deployments/deploy/openim-admin-api-deployment.yml b/deployments/deploy/openim-admin-api-deployment.yml new file mode 100644 index 000000000..8f7baddfc --- /dev/null +++ b/deployments/deploy/openim-admin-api-deployment.yml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: admin-api-server +spec: + replicas: 1 + selector: + matchLabels: + app: admin-api-server + template: + metadata: + labels: + app: admin-api-server + spec: + containers: + - name: openim-admin-api-container + image: openim/openim-admin-api:v3.8.3 + env: + - name: CONFIG_PATH + value: "/config" + - name: CHATENV_REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: redis-secret + key: redis-password + - name: IMENV_MONGODB_USERNAME + valueFrom: + secretKeyRef: + name: openim-mongo-secret + key: mongo_openim_username + - name: CHATENV_MONGODB_PASSWORD + valueFrom: + secretKeyRef: + name: mongo-secret + key: mongo_openim_password + + volumeMounts: + - name: openim-chat-config + mountPath: "/config" + readOnly: true + ports: + - containerPort: 10009 + volumes: + - name: openim-chat-config + configMap: + name: openim-chat-config diff --git a/deployments/deploy/openim-admin-api-service.yml b/deployments/deploy/openim-admin-api-service.yml new file mode 100644 index 000000000..dcb723b14 --- /dev/null +++ b/deployments/deploy/openim-admin-api-service.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: admin-api-service +spec: + selector: + app: admin-api-server + ports: + - name: http-10009 + protocol: TCP + port: 10009 + targetPort: 10009 + type: NodePort diff --git a/deployments/deploy/openim-admin-rpc-deployment.yml b/deployments/deploy/openim-admin-rpc-deployment.yml new file mode 100644 index 000000000..3c7a30e57 --- /dev/null +++ b/deployments/deploy/openim-admin-rpc-deployment.yml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: admin-rpc-server +spec: + replicas: 1 + selector: + matchLabels: + app: admin-rpc-server + template: + metadata: + labels: + app: admin-rpc-server + spec: + containers: + - name: openim-admin-rpc-container + image: openim/openim-admin-rpc:v3.8.3 + env: + - name: CONFIG_PATH + value: "/config" + - name: CHATENV_REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: redis-secret + key: redis-password + - name: IMENV_MONGODB_USERNAME + valueFrom: + secretKeyRef: + name: openim-mongo-secret + key: mongo_openim_username + - name: CHATENV_MONGODB_PASSWORD + valueFrom: + secretKeyRef: + name: mongo-secret + key: mongo_openim_password + + volumeMounts: + - name: openim-chat-config + mountPath: "/config" + readOnly: true + ports: + - containerPort: 30200 + volumes: + - name: openim-chat-config + configMap: + name: openim-chat-config diff --git a/deployments/deploy/openim-admin-rpc-service.yml b/deployments/deploy/openim-admin-rpc-service.yml new file mode 100644 index 000000000..100e43103 --- /dev/null +++ b/deployments/deploy/openim-admin-rpc-service.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: admin-rpc-service +spec: + selector: + app: admin-rpc-server + ports: + - name: rpc-30200 + protocol: TCP + port: 30200 + targetPort: 30200 + type: ClusterIP diff --git a/deployments/deploy/openim-chat-api-deployment.yml b/deployments/deploy/openim-chat-api-deployment.yml new file mode 100644 index 000000000..8465d862a --- /dev/null +++ b/deployments/deploy/openim-chat-api-deployment.yml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: chat-api-server +spec: + replicas: 1 + selector: + matchLabels: + app: chat-api-server + template: + metadata: + labels: + app: chat-api-server + spec: + containers: + - name: openim-chat-api-container + image: openim/openim-chat-api:v3.8.3 + env: + - name: CONFIG_PATH + value: "/config" + - name: CHATENV_REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: redis-secret + key: redis-password + - name: IMENV_MONGODB_USERNAME + valueFrom: + secretKeyRef: + name: openim-mongo-secret + key: mongo_openim_username + - name: CHATENV_MONGODB_PASSWORD + valueFrom: + secretKeyRef: + name: mongo-secret + key: mongo_openim_password + + volumeMounts: + - name: openim-chat-config + mountPath: "/config" + readOnly: true + ports: + - containerPort: 10008 + volumes: + - name: openim-chat-config + configMap: + name: openim-chat-config diff --git a/deployments/deploy/openim-chat-api-service.yml b/deployments/deploy/openim-chat-api-service.yml new file mode 100644 index 000000000..43a777e31 --- /dev/null +++ b/deployments/deploy/openim-chat-api-service.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: chat-api-service +spec: + selector: + app: chat-api-server + ports: + - name: http-10008 + protocol: TCP + port: 10008 + targetPort: 10008 + type: NodePort diff --git a/deployments/deploy/openim-chat-rpc-deployment.yml b/deployments/deploy/openim-chat-rpc-deployment.yml new file mode 100644 index 000000000..81ea3d67e --- /dev/null +++ b/deployments/deploy/openim-chat-rpc-deployment.yml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: chat-rpc-server +spec: + replicas: 1 + selector: + matchLabels: + app: chat-rpc-server + template: + metadata: + labels: + app: chat-rpc-server + spec: + containers: + - name: openim-chat-rpc-container + image: openim/openim-chat-rpc:v3.8.3 + env: + - name: CONFIG_PATH + value: "/config" + - name: CHATENV_REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: redis-secret + key: redis-password + - name: IMENV_MONGODB_USERNAME + valueFrom: + secretKeyRef: + name: openim-mongo-secret + key: mongo_openim_username + - name: CHATENV_MONGODB_PASSWORD + valueFrom: + secretKeyRef: + name: mongo-secret + key: mongo_openim_password + + volumeMounts: + - name: openim-chat-config + mountPath: "/config" + readOnly: true + ports: + - containerPort: 30300 + volumes: + - name: openim-chat-config + configMap: + name: openim-chat-config diff --git a/deployments/deploy/openim-chat-rpc-service.yml b/deployments/deploy/openim-chat-rpc-service.yml new file mode 100644 index 000000000..e245e45f1 --- /dev/null +++ b/deployments/deploy/openim-chat-rpc-service.yml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: chat-rpc-service +spec: + selector: + app: chat-rpc-server + ports: + - name: rpc-30300 + protocol: TCP + port: 30300 + targetPort: 30300 + type: ClusterIP diff --git a/deployments/deploy/redis-secret.yml b/deployments/deploy/redis-secret.yml new file mode 100644 index 000000000..463ec9545 --- /dev/null +++ b/deployments/deploy/redis-secret.yml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Secret +metadata: + name: openim-redis-secret +type: Opaque +data: + redis-password: b3BlbklNMTIz # "openIM123" in base64 diff --git a/deployments/helm-charts/.helmignore b/deployments/helm-charts/.helmignore deleted file mode 100644 index 0e8a0eb36..000000000 --- a/deployments/helm-charts/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/deployments/helm-charts/Chart.yaml b/deployments/helm-charts/Chart.yaml deleted file mode 100644 index b96fa7961..000000000 --- a/deployments/helm-charts/Chart.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v2 -name: admin-api -description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" diff --git a/deployments/helm-charts/charts/admin-rpc/.helmignore b/deployments/helm-charts/charts/admin-rpc/.helmignore deleted file mode 100644 index 0e8a0eb36..000000000 --- a/deployments/helm-charts/charts/admin-rpc/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/deployments/helm-charts/charts/admin-rpc/Chart.yaml b/deployments/helm-charts/charts/admin-rpc/Chart.yaml deleted file mode 100644 index 7b1761050..000000000 --- a/deployments/helm-charts/charts/admin-rpc/Chart.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v2 -name: admin-rpc -description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" diff --git a/deployments/helm-charts/charts/admin-rpc/templates/NOTES.txt b/deployments/helm-charts/charts/admin-rpc/templates/NOTES.txt deleted file mode 100644 index cb5db3d55..000000000 --- a/deployments/helm-charts/charts/admin-rpc/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "admin-rpc.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "admin-rpc.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "admin-rpc.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "admin-rpc.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} diff --git a/deployments/helm-charts/charts/admin-rpc/templates/_helpers.tpl b/deployments/helm-charts/charts/admin-rpc/templates/_helpers.tpl deleted file mode 100644 index b6da95769..000000000 --- a/deployments/helm-charts/charts/admin-rpc/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "admin-rpc.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "admin-rpc.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "admin-rpc.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "admin-rpc.labels" -}} -helm.sh/chart: {{ include "admin-rpc.chart" . }} -{{ include "admin-rpc.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "admin-rpc.selectorLabels" -}} -app.kubernetes.io/name: {{ include "admin-rpc.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "admin-rpc.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "admin-rpc.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml b/deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml deleted file mode 100644 index 5fb1e3834..000000000 --- a/deployments/helm-charts/charts/admin-rpc/templates/deployment.yaml +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "admin-rpc.fullname" . }} - labels: - {{- include "admin-rpc.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "admin-rpc.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "admin-rpc.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "admin-rpc.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - #livenessProbe: - # httpGet: - # path: / - # port: http - #readinessProbe: - # httpGet: - # path: / - # port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumeMounts: - - mountPath: /app/config/config.yaml - name: config - subPath: config.yaml - volumes: - - name: config - configMap: - name: imchat-cm - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml b/deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml deleted file mode 100644 index 27755e494..000000000 --- a/deployments/helm-charts/charts/admin-rpc/templates/hpa.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "admin-rpc.fullname" . }} - labels: - {{- include "admin-rpc.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "admin-rpc.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml b/deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml deleted file mode 100644 index 3d9466030..000000000 --- a/deployments/helm-charts/charts/admin-rpc/templates/ingress.yaml +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "admin-rpc.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "admin-rpc.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/admin-rpc/templates/service.yaml b/deployments/helm-charts/charts/admin-rpc/templates/service.yaml deleted file mode 100644 index a5b0dca54..000000000 --- a/deployments/helm-charts/charts/admin-rpc/templates/service.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: Service -metadata: - name: {{ include "admin-rpc.fullname" . }} - labels: - {{- include "admin-rpc.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "admin-rpc.selectorLabels" . | nindent 4 }} diff --git a/deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml b/deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml deleted file mode 100644 index 417951552..000000000 --- a/deployments/helm-charts/charts/admin-rpc/templates/serviceaccount.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "admin-rpc.serviceAccountName" . }} - labels: - {{- include "admin-rpc.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/admin-rpc/values.yaml b/deployments/helm-charts/charts/admin-rpc/values.yaml deleted file mode 100644 index ee7225e6b..000000000 --- a/deployments/helm-charts/charts/admin-rpc/values.yaml +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Default values for admin-rpc. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: nginx - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: false - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: false - className: "" - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} diff --git a/deployments/helm-charts/charts/chat-api/.helmignore b/deployments/helm-charts/charts/chat-api/.helmignore deleted file mode 100644 index 0e8a0eb36..000000000 --- a/deployments/helm-charts/charts/chat-api/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/deployments/helm-charts/charts/chat-api/Chart.yaml b/deployments/helm-charts/charts/chat-api/Chart.yaml deleted file mode 100644 index a82e9e115..000000000 --- a/deployments/helm-charts/charts/chat-api/Chart.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v2 -name: chat-api -description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" diff --git a/deployments/helm-charts/charts/chat-api/templates/NOTES.txt b/deployments/helm-charts/charts/chat-api/templates/NOTES.txt deleted file mode 100644 index 012270869..000000000 --- a/deployments/helm-charts/charts/chat-api/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "chat-api.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "chat-api.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chat-api.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chat-api.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} diff --git a/deployments/helm-charts/charts/chat-api/templates/_helpers.tpl b/deployments/helm-charts/charts/chat-api/templates/_helpers.tpl deleted file mode 100644 index a7a4c2c28..000000000 --- a/deployments/helm-charts/charts/chat-api/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "chat-api.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "chat-api.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "chat-api.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "chat-api.labels" -}} -helm.sh/chart: {{ include "chat-api.chart" . }} -{{ include "chat-api.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "chat-api.selectorLabels" -}} -app.kubernetes.io/name: {{ include "chat-api.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "chat-api.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "chat-api.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/chat-api/templates/deployment.yaml b/deployments/helm-charts/charts/chat-api/templates/deployment.yaml deleted file mode 100644 index d29efdf1d..000000000 --- a/deployments/helm-charts/charts/chat-api/templates/deployment.yaml +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "chat-api.fullname" . }} - labels: - {{- include "chat-api.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "chat-api.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "chat-api.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "chat-api.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - #livenessProbe: - # httpGet: - # path: / - # port: http - #readinessProbe: - # httpGet: - # path: / - # port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumeMounts: - - mountPath: /app/config/config.yaml - name: config - subPath: config.yaml - volumes: - - name: config - configMap: - name: imchat-cm - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/deployments/helm-charts/charts/chat-api/templates/hpa.yaml b/deployments/helm-charts/charts/chat-api/templates/hpa.yaml deleted file mode 100644 index f6d63e828..000000000 --- a/deployments/helm-charts/charts/chat-api/templates/hpa.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "chat-api.fullname" . }} - labels: - {{- include "chat-api.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "chat-api.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/chat-api/templates/ingress.yaml b/deployments/helm-charts/charts/chat-api/templates/ingress.yaml deleted file mode 100644 index 43ecdb75a..000000000 --- a/deployments/helm-charts/charts/chat-api/templates/ingress.yaml +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "chat-api.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "chat-api.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/chat-api/templates/service.yaml b/deployments/helm-charts/charts/chat-api/templates/service.yaml deleted file mode 100644 index ec844e288..000000000 --- a/deployments/helm-charts/charts/chat-api/templates/service.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: Service -metadata: - name: {{ include "chat-api.fullname" . }} - labels: - {{- include "chat-api.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "chat-api.selectorLabels" . | nindent 4 }} diff --git a/deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml b/deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml deleted file mode 100644 index 52f3aabda..000000000 --- a/deployments/helm-charts/charts/chat-api/templates/serviceaccount.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "chat-api.serviceAccountName" . }} - labels: - {{- include "chat-api.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/chat-api/values.yaml b/deployments/helm-charts/charts/chat-api/values.yaml deleted file mode 100644 index 4aa411610..000000000 --- a/deployments/helm-charts/charts/chat-api/values.yaml +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Default values for chat-api. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: nginx - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: false - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: true - className: "nginx" - annotations: - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - nginx.ingress.kubernetes.io/use-regex: "true" - nginx.ingress.kubernetes.io/rewrite-target: /$2 - hosts: - - host: openim1.nsddd.top - paths: - - path: /chat(/|$)(.*) - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} diff --git a/deployments/helm-charts/charts/chat-rpc/.helmignore b/deployments/helm-charts/charts/chat-rpc/.helmignore deleted file mode 100644 index 0e8a0eb36..000000000 --- a/deployments/helm-charts/charts/chat-rpc/.helmignore +++ /dev/null @@ -1,23 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ diff --git a/deployments/helm-charts/charts/chat-rpc/Chart.yaml b/deployments/helm-charts/charts/chat-rpc/Chart.yaml deleted file mode 100644 index a3ffcbbd0..000000000 --- a/deployments/helm-charts/charts/chat-rpc/Chart.yaml +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v2 -name: chat-rpc -description: A Helm chart for Kubernetes - -# A chart can be either an 'application' or a 'library' chart. -# -# Application charts are a collection of templates that can be packaged into versioned archives -# to be deployed. -# -# Library charts provide useful utilities or functions for the chart developer. They're included as -# a dependency of application charts to inject those utilities and functions into the rendering -# pipeline. Library charts do not define any templates and therefore cannot be deployed. -type: application - -# This is the chart version. This version number should be incremented each time you make changes -# to the chart and its templates, including the app version. -# Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.1.0 - -# This is the version number of the application being deployed. This version number should be -# incremented each time you make changes to the application. Versions are not expected to -# follow Semantic Versioning. They should reflect the version the application is using. -# It is recommended to use it with quotes. -appVersion: "1.16.0" diff --git a/deployments/helm-charts/charts/chat-rpc/templates/NOTES.txt b/deployments/helm-charts/charts/chat-rpc/templates/NOTES.txt deleted file mode 100644 index 2f1beaee5..000000000 --- a/deployments/helm-charts/charts/chat-rpc/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "chat-rpc.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "chat-rpc.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "chat-rpc.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "chat-rpc.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} diff --git a/deployments/helm-charts/charts/chat-rpc/templates/_helpers.tpl b/deployments/helm-charts/charts/chat-rpc/templates/_helpers.tpl deleted file mode 100644 index 9edc1981c..000000000 --- a/deployments/helm-charts/charts/chat-rpc/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "chat-rpc.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "chat-rpc.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "chat-rpc.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "chat-rpc.labels" -}} -helm.sh/chart: {{ include "chat-rpc.chart" . }} -{{ include "chat-rpc.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "chat-rpc.selectorLabels" -}} -app.kubernetes.io/name: {{ include "chat-rpc.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "chat-rpc.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "chat-rpc.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml b/deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml deleted file mode 100644 index da9df7e1f..000000000 --- a/deployments/helm-charts/charts/chat-rpc/templates/deployment.yaml +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "chat-rpc.fullname" . }} - labels: - {{- include "chat-rpc.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "chat-rpc.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "chat-rpc.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "chat-rpc.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - #livenessProbe: - # httpGet: - # path: / - # port: http - #readinessProbe: - # httpGet: - # path: / - # port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumeMounts: - - mountPath: /app/config/config.yaml - name: config - subPath: config.yaml - volumes: - - name: config - configMap: - name: imchat-cm - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml b/deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml deleted file mode 100644 index f54187544..000000000 --- a/deployments/helm-charts/charts/chat-rpc/templates/hpa.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "chat-rpc.fullname" . }} - labels: - {{- include "chat-rpc.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "chat-rpc.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml b/deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml deleted file mode 100644 index 1b292c080..000000000 --- a/deployments/helm-charts/charts/chat-rpc/templates/ingress.yaml +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "chat-rpc.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "chat-rpc.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/chat-rpc/templates/service.yaml b/deployments/helm-charts/charts/chat-rpc/templates/service.yaml deleted file mode 100644 index a24600366..000000000 --- a/deployments/helm-charts/charts/chat-rpc/templates/service.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: Service -metadata: - name: {{ include "chat-rpc.fullname" . }} - labels: - {{- include "chat-rpc.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "chat-rpc.selectorLabels" . | nindent 4 }} diff --git a/deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml b/deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml deleted file mode 100644 index 8705421da..000000000 --- a/deployments/helm-charts/charts/chat-rpc/templates/serviceaccount.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "chat-rpc.serviceAccountName" . }} - labels: - {{- include "chat-rpc.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/charts/chat-rpc/values.yaml b/deployments/helm-charts/charts/chat-rpc/values.yaml deleted file mode 100644 index 719f8553a..000000000 --- a/deployments/helm-charts/charts/chat-rpc/values.yaml +++ /dev/null @@ -1,96 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Default values for chat-rpc. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: nginx - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: false - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: false - className: "" - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: - - path: / - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} diff --git a/deployments/helm-charts/config.yaml b/deployments/helm-charts/config.yaml deleted file mode 100644 index 6be98c93f..000000000 --- a/deployments/helm-charts/config.yaml +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -image: - repository: registry.cn-shenzhen.aliyuncs.com/huanglin_hub/admin-api - pullPolicy: Always - tag: "dev" -admin-rpc: - image: - repository: registry.cn-shenzhen.aliyuncs.com/huanglin_hub/admin-rpc - pullPolicy: Always - tag: "dev" -chat-api: - image: - repository: registry.cn-shenzhen.aliyuncs.com/huanglin_hub/chat-api - pullPolicy: Always - tag: "dev" -chat-rpc: - image: - repository: registry.cn-shenzhen.aliyuncs.com/huanglin_hub/chat-rpc - pullPolicy: Always - tag: "dev" - -config: - envs: - discovery: k8s - zookeeper: - schema: openim - zkAddr: - - 127.0.0.1:12181 - username: "" - password: "" - - chatApi: - openImChatApiPort: [ 80 ] - listenIP: - - adminApi: - openImAdminApiPort: [ 80 ] - listenIP: - - rpc: - registerIP: - listenIP: - - rpcPort: - openImAdminPort: [ 80 ] - openImChatPort: [ 80 ] - rpcRegisterName: - openImAdminName: openimchat-admin-rpc:80 - openImChatName: openimchat-chat-rpc:80 - - - mysql: - address: [ im-mysql:3306 ] - username: root - password: openIM123 - #database: openIM_v2 - maxOpenConn: 1000 - maxIdleConn: 100 - maxLifeTime: 60 - logLevel: 4 - slowThreshold: 500 - database: openim_enterprise - - - log: - storageLocation: ../_output/logs/ - rotationTime: 24 - remainRotationCount: 2 - remainLogLevel: 6 - isStdout: true - isJson: false - withStack: false - - secret: openIM123 - chatSecret: openIM123 - - tokenPolicy: - expire: 86400 - - verifyCode: - validTime: 300 - validCount: 5 - uintTime: 86400 - maxCount: 10 - superCode: "666666" - len: 6 - use: "" - ali: - endpoint: "dysmsapi.aliyuncs.com" - accessKeyId: "" - accessKeySecret: "" - signName: "" - verificationCodeTemplateCode: "" - - - #proxyHeader: "X-Forwarded-For" - - adminList: - - adminID: admin1 - nickname: chat1 - imAdmin: openIM123456 - - adminID: admin2 - nickname: chat2 - imAdmin: openIM654321 - - adminID: admin3 - nickname: chat3 - imAdmin: openIMAdmin - - - openIMUrl: "http://openimserver-openim-api" - - redis: - address: [ im-redis-master:6379 ] - username: '' - password: openIM123 diff --git a/deployments/helm-charts/templates/NOTES.txt b/deployments/helm-charts/templates/NOTES.txt deleted file mode 100644 index 9cbe57754..000000000 --- a/deployments/helm-charts/templates/NOTES.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} - {{- end }} -{{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "admin-api.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT -{{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "admin-api.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "admin-api.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "admin-api.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") - echo "Visit http://127.0.0.1:8080 to use your application" - kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT -{{- end }} diff --git a/deployments/helm-charts/templates/_helpers.tpl b/deployments/helm-charts/templates/_helpers.tpl deleted file mode 100644 index 10ad4b5e4..000000000 --- a/deployments/helm-charts/templates/_helpers.tpl +++ /dev/null @@ -1,62 +0,0 @@ -{{/* -Expand the name of the chart. -*/}} -{{- define "admin-api.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -If release name contains chart name it will be used as a full name. -*/}} -{{- define "admin-api.fullname" -}} -{{- if .Values.fullnameOverride }} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- $name := default .Chart.Name .Values.nameOverride }} -{{- if contains $name .Release.Name }} -{{- .Release.Name | trunc 63 | trimSuffix "-" }} -{{- else }} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} -{{- end }} -{{- end }} -{{- end }} - -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "admin-api.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} -{{- end }} - -{{/* -Common labels -*/}} -{{- define "admin-api.labels" -}} -helm.sh/chart: {{ include "admin-api.chart" . }} -{{ include "admin-api.selectorLabels" . }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end }} - -{{/* -Selector labels -*/}} -{{- define "admin-api.selectorLabels" -}} -app.kubernetes.io/name: {{ include "admin-api.name" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} - -{{/* -Create the name of the service account to use -*/}} -{{- define "admin-api.serviceAccountName" -}} -{{- if .Values.serviceAccount.create }} -{{- default (include "admin-api.fullname" .) .Values.serviceAccount.name }} -{{- else }} -{{- default "default" .Values.serviceAccount.name }} -{{- end }} -{{- end }} diff --git a/deployments/helm-charts/templates/app-cm.yaml b/deployments/helm-charts/templates/app-cm.yaml deleted file mode 100644 index e01c895a6..000000000 --- a/deployments/helm-charts/templates/app-cm.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: ConfigMap -metadata: - name: imchat-cm -data: - config.yaml: |+ - {{- with .Values.config }} - {{- toYaml . | nindent 4 }} - {{- end }} diff --git a/deployments/helm-charts/templates/deployment.yaml b/deployments/helm-charts/templates/deployment.yaml deleted file mode 100644 index a8cd54f32..000000000 --- a/deployments/helm-charts/templates/deployment.yaml +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "admin-api.fullname" . }} - labels: - {{- include "admin-api.labels" . | nindent 4 }} -spec: - {{- if not .Values.autoscaling.enabled }} - replicas: {{ .Values.replicaCount }} - {{- end }} - selector: - matchLabels: - {{- include "admin-api.selectorLabels" . | nindent 6 }} - template: - metadata: - {{- with .Values.podAnnotations }} - annotations: - {{- toYaml . | nindent 8 }} - {{- end }} - labels: - {{- include "admin-api.selectorLabels" . | nindent 8 }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ include "admin-api.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - ports: - - name: http - containerPort: 80 - protocol: TCP - #livenessProbe: - # httpGet: - # path: / - # port: http - #readinessProbe: - # httpGet: - # path: / - # port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - volumeMounts: - - mountPath: /app/config/config.yaml - name: config - subPath: config.yaml - volumes: - - name: config - configMap: - name: imchat-cm - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} diff --git a/deployments/helm-charts/templates/hpa.yaml b/deployments/helm-charts/templates/hpa.yaml deleted file mode 100644 index 3ffac34d9..000000000 --- a/deployments/helm-charts/templates/hpa.yaml +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.autoscaling.enabled }} -apiVersion: autoscaling/v2beta1 -kind: HorizontalPodAutoscaler -metadata: - name: {{ include "admin-api.fullname" . }} - labels: - {{- include "admin-api.labels" . | nindent 4 }} -spec: - scaleTargetRef: - apiVersion: apps/v1 - kind: Deployment - name: {{ include "admin-api.fullname" . }} - minReplicas: {{ .Values.autoscaling.minReplicas }} - maxReplicas: {{ .Values.autoscaling.maxReplicas }} - metrics: - {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} - - type: Resource - resource: - name: cpu - targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} - {{- end }} - {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/templates/ingress.yaml b/deployments/helm-charts/templates/ingress.yaml deleted file mode 100644 index 2580e9cd2..000000000 --- a/deployments/helm-charts/templates/ingress.yaml +++ /dev/null @@ -1,75 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "admin-api.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} - {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} - {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} - {{- end }} -{{- end }} -{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1 -{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: - {{- include "admin-api.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} - ingressClassName: {{ .Values.ingress.className }} - {{- end }} - {{- if .Values.ingress.tls }} - tls: - {{- range .Values.ingress.tls }} - - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} - {{- end }} - {{- end }} - rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ .path }} - {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} - pathType: {{ .pathType }} - {{- end }} - backend: - {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} - service: - name: {{ $fullName }} - port: - number: {{ $svcPort }} - {{- else }} - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/templates/service.yaml b/deployments/helm-charts/templates/service.yaml deleted file mode 100644 index e5d385f7f..000000000 --- a/deployments/helm-charts/templates/service.yaml +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: v1 -kind: Service -metadata: - name: {{ include "admin-api.fullname" . }} - labels: - {{- include "admin-api.labels" . | nindent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - {{- include "admin-api.selectorLabels" . | nindent 4 }} diff --git a/deployments/helm-charts/templates/serviceaccount.yaml b/deployments/helm-charts/templates/serviceaccount.yaml deleted file mode 100644 index c0c056579..000000000 --- a/deployments/helm-charts/templates/serviceaccount.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ include "admin-api.serviceAccountName" . }} - labels: - {{- include "admin-api.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -{{- end }} diff --git a/deployments/helm-charts/values.yaml b/deployments/helm-charts/values.yaml deleted file mode 100644 index 2664d3d87..000000000 --- a/deployments/helm-charts/values.yaml +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Default values for admin-api. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: nginx - pullPolicy: IfNotPresent - # Overrides the image tag whose default is the chart appVersion. - tag: "" - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: false - # Annotations to add to the service account - annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: "" - -podAnnotations: {} - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: true - className: "nginx" - annotations: - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - nginx.ingress.kubernetes.io/use-regex: "true" - nginx.ingress.kubernetes.io/rewrite-target: /$2 - hosts: - - host: openim1.nsddd.top - paths: - - path: /complete_admin(/|$)(.*) - pathType: ImplementationSpecific - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local - -resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi - -autoscaling: - enabled: false - minReplicas: 1 - maxReplicas: 100 - targetCPUUtilizationPercentage: 80 - # targetMemoryUtilizationPercentage: 80 - -nodeSelector: {} - -tolerations: [] - -affinity: {} diff --git a/deployments/templates/config.yaml b/deployments/templates/config.yaml deleted file mode 100644 index 60cb5f0fb..000000000 --- a/deployments/templates/config.yaml +++ /dev/null @@ -1,150 +0,0 @@ -# Copyright © 2023 OpenIM open source community. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# OpenIM Server should be started before this configuration is applied -envs: - discovery: "zookeeper" # ENVS_DISCOVERY, e.g., zookeeper, etcd... - -# Zookeeper configuration - used for service discovery and coordination -zookeeper: - schema: openim # ZOOKEEPER_SCHEMA, the schema to use in Zookeeper - zkAddr: - - 172.28.0.1:12181 # ZOOKEEPER_ADDRESS and ZOOKEEPER_PORT, Zookeeper address and port - username: "" # ZOOKEEPER_USERNAME, Username for Zookeeper authentication - password: "" # ZOOKEEPER_PASSWORD, Password for Zookeeper authentication - -# Configuration for the chat API service -chatApi: - openImChatApiPort: [ 10008 ] # Port for OpenIM Chat API - listenIP: # CHAT_API_LISTEN_IP, IP address to listen on for Chat API - -# Configuration for the admin API service -adminApi: - openImAdminApiPort: [ 10009 ] # Port for OpenIM Admin API - listenIP: # ADMIN_API_LISTEN_IP, IP address to listen on for Admin API - -# RPC configuration for service communication -rpc: - registerIP: # RPC_REGISTER_IP, IP address to register with Zookeeper for RPC - listenIP: # RPC_LISTEN_IP, IP address to listen on for RPC (default 0.0.0.0) - -# Ports for RPC services -rpcPort: - openImAdminPort: [ 30200 ] # Port for OpenIM Admin RPC service - openImChatPort: [ 30300 ] # Port for OpenIM Chat RPC service - -# Names for RPC services registration -rpcRegisterName: - openImAdminName: admin # Name for OpenIM Admin RPC service - openImChatName: chat # Name for OpenIM Chat RPC service - -# Log configuration - defines how logging is handled -log: - storageLocation: ../_output/logs/ # LOG_STORAGE_LOCATION, Directory for storing logs - rotationTime: 24 # Log rotation time in hours - remainRotationCount: 2 # Number of log files to retain - remainLogLevel: 6 # Log level (6 = all levels) - isStdout: false # Whether to output logs to stdout - isJson: false # Whether to output logs in JSON format - withStack: false # Whether to include stack trace in logs - -# Secret key for secure communication -secret: openIM123 # SECRET, Secret key for encryption and secure communication - -# Token policy configuration -tokenPolicy: - expire: 86400 # TOKEN_EXPIRE, Token expiration time in seconds - -# Verification code settings -verifyCode: - validTime: 300 # Verification code valid time in seconds - validCount: 5 # Number of times a verification code is valid - uintTime: 86400 # Time unit for verification code - maxCount: 10 # Maximum number of verification codes in a time unit - superCode: "666666" # Super verification code (used only when `use` is empty) - len: 6 # Length of the verification code - use: "" # Service used for verification code (e.g., "ali") - # Aliyun SMS service configuration - ali: - endpoint: "dysmsapi.aliyuncs.com" - accessKeyId: "" - accessKeySecret: "" - signName: "" - verificationCodeTemplateCode: "" - # Email service configuration - mail: - title: "" - senderMail: "" # Email address of the sender - senderAuthorizationCode: "" # Authorization code for the sender's email - smtpAddr: "smtp.qq.com" # SMTP server address - smtpPort: 465 # SMTP server port for email sending - -# Proxy header configuration for IP extraction -# proxyHeader: "X-Forwarded-For" # PROXY_HEADER, Header used for extracting the client IP address - -# List of admin users -# Attention! This configure is discarded. If you have used him before, configure your own -adminList: - - adminID: - nickname: - imAdmin: - - adminID: - nickname: - imAdmin: - - adminID: - nickname: - imAdmin: - -# chatAdmin, use for send notification -chatAdmin: - - adminID: chatAdmin - nickname: chatAdmin - imAdmin: imAdmin - -# URL for OpenIM server -openIMUrl: "http://172.28.0.1:10002" # OPENIM_SERVER_ADDRESS:API_OPENIM_PORT, URL of the OpenIM server - -# Redis configuration - used for caching and session management -redis: - address: [ 172.28.0.1:16379 ] # REDIS_ADDRESS and REDIS_PORT, Redis server address and port - username: # REDIS_USERNAME, Username for Redis authentication - password: openIM123 # REDIS_PASSWORD, Password for Redis - -# LiveKit configuration - used for video and audio rtc -liveKit: - liveKitUrl: "ws://172.28.0.1:7880" # LIVEKIT_URL, LiveKit server address and port - key: "APIDXJxJeCL8haY" # LIVEKIT_API_KEY - secret: "ak1qulJ3nfXeflQHWBdmQDc4js4ueMc5OnxoORVJC2xA" # LIVEKIT_API_SECRET - -# MongoDB configuration - -# If uri is not empty, it will be used directly for the MongoDB connection. -# This is a complete MongoDB URI string. -# Example: mongodb://user:password@host1:port1,host2:port2/dbname?options - -mongo: - uri: '' - - # List of MongoDB server addresses. - # Used for constructing the MongoDB URI if 'uri' above is empty. - # For a standalone setup, specify the address of the single server. - # For a sharded cluster, specify the addresses of the Mongos servers. - # Example: [ '172.28.0.1:37017', '172.28.0.2:37017' ] - # Default MongoDB database name - # Maximum connection pool size - address: [ 172.28.0.1:37017 ] - database: openim_v3 - username: openIM - password: openIM123 - maxPoolSize: 100 diff --git a/go.mod b/go.mod index 71433ed82..3a2ebc57b 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/google/uuid v1.6.0 github.com/jinzhu/copier v0.4.0 // indirect - github.com/pkg/errors v0.9.1 + github.com/pkg/errors v0.9.1 // indirect google.golang.org/grpc v1.62.1 google.golang.org/protobuf v1.34.2 gopkg.in/yaml.v3 v3.0.1 // indirect @@ -33,13 +33,8 @@ require ( github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 github.com/xuri/excelize/v2 v2.8.0 - go.etcd.io/etcd/client/v3 v3.5.13 go.mongodb.org/mongo-driver v1.14.0 - go.uber.org/zap v1.27.0 gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df - k8s.io/api v0.31.2 - k8s.io/apimachinery v0.31.2 - k8s.io/client-go v0.31.2 ) require ( @@ -124,7 +119,9 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.etcd.io/etcd/api/v3 v3.5.13 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.13 // indirect + go.etcd.io/etcd/client/v3 v3.5.13 // indirect go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect golang.org/x/arch v0.3.0 // indirect golang.org/x/crypto v0.24.0 // indirect golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect @@ -142,6 +139,9 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + k8s.io/api v0.31.2 // indirect + k8s.io/apimachinery v0.31.2 // indirect + k8s.io/client-go v0.31.2 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect