提交 de218869 作者: 余乾开

feat(Kustomization):Kustomization

上级 06254479
# application.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cms-application
namespace: argocd
spec:
project: default # 项目名
source:
repoURL: http://git.mmcuav.cn/iuav/cms.git
targetRevision: HEAD #develop master # 分支名
path: argocd # 资源文件路径
destination:
server: https://kubernetes.default.svc # API Server 地址
namespace: develop # 部署应用的命名空间
# 默认情况下每 3 分钟会检测 Git 仓库一次
syncPolicy:
syncOptions:
- CreateNamespace=true
automated:
selfHeal: true
prune: true
apiVersion: v1
kind: ConfigMap
metadata:
name: cms-map
namespace: default
data:
SPRING_PROFILES_ACTIVE: default
apiVersion: apps/v1
kind: Deployment
metadata:
name: cms-deployment
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: cms
template:
metadata:
labels:
app: cms
spec:
containers:
- name: cms
image: REGISTRY/NAMESPACE/IMAGE:TAG
resources:
limits:
memory: 256Mi
cpu: 100m
ports:
- containerPort: 35150
env:
- name: SPRING_PROFILES_ACTIVE
valueFrom:
configMapKeyRef:
name: cms-map
key: SPRING_PROFILES_ACTIVE
\ No newline at end of file
#apiVersion: extensions/v1beta1
#kind: Ingress
#metadata:
# name: pms-ingress
# namespace: default
#spec:
# rules:
# - host: infra.mmcuav.cn
# http:
# paths:
# - backend:
# serviceName: pms-svc
# servicePort: 8081
# path: /
\ No newline at end of file
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
app: cms
resources:
- ./deployment.yaml
- ./service.yaml
- ./configMap.yaml
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: cms-svc
namespace: default
spec:
selector:
app: cms
type: NodePort
ports:
- protocol: TCP
port: 35150
targetPort: 35150
NodePort: 30150
\ No newline at end of file
apiVersion: v1
kind: ConfigMap
metadata:
name: cms-map
data:
SPRING_PROFILES_ACTIVE: dev
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: cms-deployment
spec:
template:
spec:
containers:
- name: cms
image: REGISTRY/NAMESPACE/IMAGE:TAG
\ No newline at end of file
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
namePrefix: dev-
namespace: dev
commonLabels:
variant: dev
commonAnnotations:
note: This is dev!
patchesStrategicMerge:
- configMap.yaml
- deployment.yaml
# - ingress.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: cms-map
data:
SPRING_PROFILES_ACTIVE: prod
\ No newline at end of file
apiVersion: apps/v1
kind: Deployment
metadata:
name: cms-deployment
spec:
replicas: 1
template:
spec:
containers:
- name: cms
image: REGISTRY/NAMESPACE/IMAGE:TAG
\ No newline at end of file
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../base
namespace: prod
namePrefix: prod-
commonLabels:
variant: prod
commonAnnotations:
note: This is prod!
patchesStrategicMerge:
- configMap.yaml
- deployment.yaml
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论