云原生服务中心 OSC-打包到package目录:配置实例版本定义信息(可选)
配置实例版本定义信息(可选)
OSC提供配置实例版本定义信息以支持实例升级的能力。
- Operator类型实例
以redis为例, redis的cr内容如下所示:
apiVersion: redis.osc/v1kind: Redismetadata: annotations: osc.huawei.com/package-source: public osc.io/occupied-port: 135,139 creationTimestamp: '2021-09-29T03:21:57Z' finalizers: - storage.finalizers.redis.cluster generation: 2 name: redis-fwpydh namespace: default resourceVersion: '91743432' selfLink: /apis/redis.osc/v1/namespaces/default/redises/redis-fwpydh uid: 96f0203c-0ae0-48bb-b2b8-b08d2055b0e2spec: config: name: default-redis-fwpydh-unvu7g properties: aof-load-truncated: 'yes' aof-use-rdb-preamble: 'no' appendfsync: everysec appendonly: 'no' hash-max-ziplist-entries: 512 hash-max-ziplist-value: 64 latency-monitor-threshold: 100 list-max-ziplist-size: -2 loglevel: notice maxauthfailtimes: 100 maxclients: 10000 maxmemory-policy: noeviction repl-diskless-sync: 'yes' set-max-intset-entries: 512 slowlog-log-slower-than: 10000 stop-writes-on-bgsave-error: 'no' timeout: 0 zset-max-ziplist-entries: 128 zset-max-ziplist-value: 64 image: swr.cn-east-3.myhuaweicloud.com/osc-official/redis:21.9.18_20210918221431 masterSize: 1 mode: RedisHA ...... ...... 此处中间省略 ...... ...... phase: Available serviceAddr: redis-ha-redis-fwpydh.default.svc.cluster.local:6379 serviceAddrReadonly: redis-ha-redis-fwpydh-readonly.default.svc.cluster.local:6379 version: 21.9.18_20210918221431
- 编辑文件
实例版本定义配置是在csd文件中配置versionDefinition,实例版本定义支持operator类型和Helm类型。
versionDefinition: mode: url path: spec.image tags: - 0.0.1 - 0.0.2 - 0.0.3
- 打包到package目录。
把operator包压缩成zip格式的压缩包,放到package目录下。
- Helm服务
以clickhouse helm为例,values.yaml的内容如下:
## Timezonetimezone: "Asia/Shanghai"## Cluster domainclusterDomain: "cluster.local"#### Clickhouse Node selectors and tolerations for pod assignment## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#taints-and-tolerations-beta-feature### nodeSelector: {"beta.kubernetes.io/arch": "amd64"}# tolerations: []## Clickhouse pod/node affinity/anti-affinity## #affinity:# nodeAffinity:# requiredDuringSchedulingIgnoredDuringExecution:# nodeSelectorTerms:# - matchExpressions:# - key: "application/clickhouse"# operator: In# values:# - "true"clickhouse: ## StatefulSet controller supports relax its ordering guarantees while preserving its uniqueness and identity guarantees. There are two valid pod management policies: OrderedReady and Parallel ## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#pod-management-policy ## podManagementPolicy: "Parallel" ## StatefulSet controller supports automated updates. There are two valid update strategies: RollingUpdate and OnDelete ## ref: https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#updating-statefulsets ## updateStrategy: "RollingUpdate" ## Partition update strategy ## https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions ## # rollingUpdatePartition: ## ## The path to the directory containing data. ## Default value: /var/lib/clickhouse path: "/var/lib/clickhouse" ## ## The port for connecting to the server over HTTP http_port: "8123" ## ## Port for communicating with clients over the TCP protocol. tcp_port: "9000" ## ## Port for exchanging data between ClickHouse servers. interserver_http_port: "9009" ## ## The instance number of Clickhouse replicas: "3" ## Clickhouse image configuration. image: "swr.cn-east-3.myhuaweicloud.com/osctest/clickhouse-server" imageVersion: "0.0.1" imagePullPolicy: "IfNotPresent" imageBusybox: "swr.cn-north-7.myhuaweicloud.com/osctest/busybox:1.26.2" #imagePullSecrets: ## Periodic probe of container liveness. Container will be restarted if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes livenessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## Periodic probe of container service readiness. Container will be removed from service endpoints if the probe fails. Cannot be updated. ## More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes readinessProbe: enabled: true initialDelaySeconds: "30" periodSeconds: "30" timeoutSeconds: "5" failureThreshold: "3" successThreshold: "1" ## volumeClaimTemplates is a list of claims that pods are allowed to reference. ## The StatefulSet controller is responsible for mapping network identities to claims in a way that maintains the identity of a pod. ## Every claim in this list must have at least one matching (by name) volumeMount in one container in the template. ## A claim in this list takes precedence over any volumes in the template, with the same name. persistentVolumeClaim: enabled: false ## Clickhouse data volume dataPersistentVolume: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "-" storage: "500Gi" ## Clickhouse logs volume logsPersistentVolume: enabled: false accessModes: - "ReadWriteOnce" storageClassName: "csi-disk" storage: "50Gi" ## ## An API object that manages external access to the services in a cluster, typically HTTP. ## Ingress can provide load balancing, SSL termination and name-based virtual hosting. ingress: enabled: false # host: "clickhouse.domain.com" # path: "/" # tls: # enabled: false # hosts: # - "clickhouse.domain.com" # - "clickhouse.domain1.com" # secretName: "clickhouse-secret" ## ## Clickhouse config.xml and metrica.xml ...... ...... 后续省略 ...... ......
- 编辑文件。
实例版本定义配置是在csd文件中配置versionDefinition,实例版本定义支持operator类型和Helm类型。
versionDefinition: mode: tag path: clickhouse.imageVersion tags: - 0.0.1 - 0.0.2 - 0.0.3
- 打包到package目录。
把Helm包压缩成zip格式的压缩包,放到package目录下。