Commit e477e404 by 李辉02

init(commander-web): commander-web

parent bf282fbb
# 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/
apiVersion: v2
name: commander-web
description: commander-web helm chart
type: application
version: 0.0.1
appVersion: "0.0.1"
\ No newline at end of file
## 添加仓库到本地
```shell
helm repo add k8s-t0-commander https://k8s-t0.tencentcloudcr.com/chartrepo/commander --username 你的账号 --password 你的密码
```
## 打包
```shell
# 指定版本号
helm package . --version 0.0.1 --destination d:/helmCharts
# 使用chart里面的版本号
helm package . --destination d:/helmCharts
```
## 上传
```shell
#
C:\Users\admin\AppData\Roaming\helm\plugins\helm-push\bin\helm-cm-push.exe d:/helmCharts/commander-web-0.0.1.tgz k8s-t0-commander
# 查询
helm search repo k8s-t0-commander
# 更新
helm repo update
```
## 安装
需要在k8s集群上执行
```shell
helm install commander-web k8s-t0-commander/commander-web --version 0.0.1 -n commander-standard-dev --create-namespace
helm install commander-web k8s-t0-commander/commander-web -n commander-standard-dev --create-namespace
# 预检
helm install commander-web k8s-t0-commander/commander-web -n commander-standard-dev --dry-run
```
## 查询
```shell
helm list -n commander-standard-dev
```
## 卸载
```shell
helm uninstall commander-web -n commander-standard-dev
```
## 更新
```shell
helm upgrade commander-web k8s-t0-commander/commander-web -n commander-standard-dev
```
{{- define "app.resources" -}}
requests:
memory: "400Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "500m"
{{- end -}}
{{- define "app.imagePullSecrets" -}}
{{- if .Values.global.imagePullSecrets }}
{{- if eq .Values.global.imagePullSecrets "none" }}
imagePullSecrets: []
{{- else }}
imagePullSecrets:
- name: {{ .Values.global.imagePullSecrets }}
{{- end }}
{{- else }}
imagePullSecrets: []
{{- end }}
{{- end -}}
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Values.global.app.namespace }}
labels:
app: {{ .Chart.Name }}
spec:
replicas: {{ .Values.global.app.replicas }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
{{- include "app.imagePullSecrets" . | nindent 6 }}
containers:
- image: {{ .Values.global.app.imageUrl }}{{ .Chart.Name }}:{{ index .Values.global .Chart.Name "imageVersion" }}
name: {{ .Chart.Name }}
imagePullPolicy: Always
ports:
- containerPort: 80
protocol: TCP
name: http
resources:
{{- include "app.resources" . | nindent 12 }}
{{- $ingress := (index .Values.global .Chart.Name "ingress") }}
{{- if $ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Chart.Name }}-ingress
namespace: {{ .Values.global.app.namespace }}
{{- if $ingress.annotations }}
annotations:
{{- range $key, $value := $ingress.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
{{- end }}
spec:
ingressClassName: {{ $ingress.className }}
rules:
- host: {{ $ingress.host | default .Values.global.app.webHost }}
http:
paths:
- backend:
service:
name: {{ .Chart.Name }}
port:
number: {{ index .Values.global .Chart.Name "port" }}
path: /
pathType: Prefix
{{- if $ingress.loadBalancerHostname }}
status:
loadBalancer:
ingress:
- hostname: {{ $ingress.loadBalancerHostname }}
{{- end }}
{{- end }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}
namespace: {{ .Values.global.app.namespace }}
spec:
selector:
app: {{ .Chart.Name }}
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 80
\ No newline at end of file
# --------------------------------------------------------------------------------------------------
# 这个文件内容全部根据父chart values.yaml格式内容编写,最终全部服务都测试 helm 部署运行正常将合并到父 values.yml
# 保持规范,如果是某个微服务独有配置请通过 key 区分
# --------------------------------------------------------------------------------------------------
global:
imagePullSecrets: tcr.ipstcr-public
# ------------------------------------------------------------------------------
# app.namespace k8s环境应用部署命名空间
# app.imageUlr 应用镜像地址
# app.apiHost 域名
# ------------------------------------------------------------------------------
app:
namespace: commander-standard-dev
replicas: 1
imageUrl: k8s-t0.tencentcloudcr.com/commander/
webHost: "commander-web.example.com" # Web 前端域名
profiles_active: "prod"
# ------------------------------------------------------------------------------
commander-web:
imageVersion: "0.0.1"
port: 80
ingress:
enabled: true
className: "nginx"
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
host: "" # 留空则使用 global.app.webHost
loadBalancerHostname: "lb-rj9u1163-hsf9r24l80bc1zov.clb.bj-tencentclb.net"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment