From e6a1d193439cec597fa9a97cbc8f228bd44e2201 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Wed, 3 Apr 2024 18:44:44 +0800 Subject: [PATCH] update --- app/admin/hdl/hdl_set_center.go | 8 ++- app/admin/md/md_set_center.go | 5 ++ k8s/deployment-prd.yaml | 90 +++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 k8s/deployment-prd.yaml diff --git a/app/admin/hdl/hdl_set_center.go b/app/admin/hdl/hdl_set_center.go index 166b206..8739832 100644 --- a/app/admin/hdl/hdl_set_center.go +++ b/app/admin/hdl/hdl_set_center.go @@ -24,6 +24,11 @@ func SetCenter(c *gin.Context) { sysCfgDb.SysCfgUpdate(enum.BigDataScreenPassword, req.BigDataScreenPassword) sysCfgDb.SysCfgUpdate(enum.ProductionWorkshopAccount, req.ProductionWorkshopAccount) sysCfgDb.SysCfgUpdate(enum.ProductionWorkshopPassword, req.ProductionWorkshopPassword) + sysCfgDb.SysCfgUpdate("file_bucket", req.FileBucket) + sysCfgDb.SysCfgUpdate("file_bucket_region", req.FileBucketRegion) + sysCfgDb.SysCfgUpdate("file_secret_key", req.FileSecretKey) + sysCfgDb.SysCfgUpdate("file_bucket_host", req.FileBucketHost) + sysCfgDb.SysCfgUpdate("file_access_key", req.FileAccessKey) e.OutSuc(c, "success", nil) return } @@ -31,7 +36,8 @@ func SetCenter(c *gin.Context) { func GetCenter(c *gin.Context) { sysCfgDb := db.SysCfgDb{} sysCfgDb.Set() - res := sysCfgDb.SysCfgFindWithDb(enum.BigDataScreenAccount, enum.BigDataScreenPassword, enum.ProductionWorkshopAccount, enum.ProductionWorkshopPassword) + res := sysCfgDb.SysCfgFindWithDb(enum.BigDataScreenAccount, enum.BigDataScreenPassword, enum.ProductionWorkshopAccount, enum.ProductionWorkshopPassword, + "file_bucket", "file_bucket_region", "file_secret_key", "file_bucket_host", "file_access_key") e.OutSuc(c, res, nil) return } diff --git a/app/admin/md/md_set_center.go b/app/admin/md/md_set_center.go index 41b9df8..b7613c7 100644 --- a/app/admin/md/md_set_center.go +++ b/app/admin/md/md_set_center.go @@ -5,4 +5,9 @@ type SetCenterReq struct { BigDataScreenPassword string `json:"big_data_screen_password" label:"数据大屏-密码"` ProductionWorkshopAccount string `json:"production_workshop_account" label:"制作车间-密码"` ProductionWorkshopPassword string `json:"production_workshop_password" label:"制作车间-密码"` + FileBucket string `json:"file_bucket" ` + FileBucketRegion string `json:"file_bucket_region" ` + FileSecretKey string `json:"file_secret_key" ` + FileBucketHost string `json:"file_bucket_host" ` + FileAccessKey string `json:"file_access_key" ` } diff --git a/k8s/deployment-prd.yaml b/k8s/deployment-prd.yaml new file mode 100644 index 0000000..e049fe9 --- /dev/null +++ b/k8s/deployment-prd.yaml @@ -0,0 +1,90 @@ +kind: Deployment +apiVersion: apps/v1 +# 元数据 +metadata: + name: bakery + namespace: zhios # namespace,测试环境为dev,正式环境为:zhios + labels: + app: bakery + annotations: + kubesphere.io/creator: dengbiao + kubesphere.io/description: 面包店 +# deployment主要部分 +spec: + replicas: 1 + selector: + matchLabels: + # 名称与上面的labels对应 + app: bakery + template: + metadata: + labels: + # 名称与上面的matchLabels对应 + app: bakery + spec: + # 声明挂载卷(将外部已存在的pvc、config等挂载进来) + volumes: + # 用于时区校正 + - name: host-time + hostPath: + path: /etc/localtime + type: '' + # 将前面创建的configMap也挂载进来 + - name: bakery-cfg + configMap: + # 这里的名字就是前面创建的configMap的名字 + name: bakery-cfg + defaultMode: 420 + # pvc + - name: bakery # 在该部署中的名称,后面使用改名称挂载 + persistentVolumeClaim: + claimName: bakery # pvc的名称 + # Nginx配置 + - name: bakery-nginx + configMap: + name: bakery-nginx # 外部configMap的名称 + items: + - key: go.conf + path: default.conf + containers: + # 主容器 + - name: bakery + # 镜像地址(提前打包好并推送的镜像仓库) + image: 'registry.cn-shenzhen.aliyuncs.com/fnuoos-prd/bakery:1.0.0' + ports: + - name: httpsupply4001 + # 容器端口号(注意与golang web server启动的端口一致) + containerPort: 4001 + protocol: TCP + # 将前面volume声明的需要用到的pvc、config挂载上来 + volumeMounts: + - name: host-time + readOnly: true + mountPath: /etc/localtime + - name: bakery-cfg # 该名字对应前面volumes声明的名字 + readOnly: true + # 挂载到容器的哪个路径 + mountPath: /var/zyos + imagePullPolicy: Always + # Nginx 容器 + - name: container-nginx + image: nginx + ports: + - name: http-80 + containerPort: 80 + protocol: TCP + volumeMounts: + # 时区校正 + - name: host-time + readOnly: true + mountPath: /etc/localtime + # 存储卷 用于存放前端代码 + - name: bakery # 前面volumes声明的名称 + mountPath: /usr/share/nginx/html + - name: bakery-nginx # Nginx 配置 + readOnly: true + mountPath: /etc/nginx/conf.d/default.conf + subPath: default.conf + restartPolicy: Always + terminationGracePeriodSeconds: 30 + dnsPolicy: ClusterFirst