更新时间:2024-06-13 GMT+08:00
修改服务包内容
- 修改lifecycle.yaml文件。该文件包括OSC服务包的生命周期的相关信息,例如:安装方式、安装时需要的集群/命名空间级别权限、日志目录等。
install: clusterPermissions: # 集群级别权限,请按照Kubernetes RABC相关规范填写 - rules: - apiGroups: - "*" # * 表示所有 resources: - "*" # 监控所有资源 verbs: - "*" # 拥有所有权限 serviceAccountName: hwfka-operator-sa # 附有该权限的SA名称,用户deployments中指定运行operator会获得该权限 # permissions: null # 命名空间级别权限,与clusterPermissions结构相似,请按照Kubernetes RABC相关规范填写 deployments: # 实际运行operator deployments的具体执行内容,请参照Kubernetes Deployment资源规范书写 - name: hwfka-operator spec: replicas: 1 selector: matchLabels: operator: hwfka-operator strategy: {} template: metadata: labels: operator: hwfka-operator spec: # initContainers 如果有需要可添加 containers: - name: hwfka-operator image: hwfka-operator:0.0.1 # 该镜像为制作Operator镜像章节生成的镜像,请修改为实际的镜像地址 imagePullPolicy: Always serviceAccountName: hwfka-operator-sa strategy: deployment # 现在operator部署仅适用deployment资源进行部署 # 由于是第一次部署该服务,不涉及升级 # upgrade: # replaces: 0.0.1 # skips: # - 0.0.2 # skipRange: '>=4.1.0 < 4.1.2' # 该结构体用于运维操作配置,可以不进行配置 # operations: # logpath: ""
- 修改metadata.yaml文件。
name: "hwfka-operator" version: "0.0.1" source: ISV
- 修改manifests/hwfka_crd.yaml文件。该文件为描述operator使用到的自定义资源(CRD),可以直接复用hwfka-operator/config/crd/bases/osctest.huawei.com_hwfkas.yaml文件。因为该文件由Kubernetes社区提供的controller-gen及kustomize生成校验,所以可以直接作为标准CRD资源用户集群内CRD部署。
apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.7.0 creationTimestamp: null name: hwfkas.osctest.huawei.com spec: group: osctest.huawei.com names: kind: Hwfka listKind: HwfkaList plural: hwfkas singular: hwfka scope: Namespaced versions: - name: v1 schema: openAPIV3Schema: description: Hwfka is the Schema for the hwfkas API properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' type: string kind: description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' type: string metadata: type: object spec: description: HwfkaSpec defines the desired state of Hwfka properties: image: type: string size: description: 包含最大值 format: int32 maximum: 3 minimum: 1 type: integer storage: properties: accessModes: type: string class: type: string diskType: description: 华为公有云 EVS 场景需额外指定 diskType, region, zone type: string region: type: string size: anyOf: - type: integer - type: string pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ x-kubernetes-int-or-string: true zone: type: string required: - accessModes - class - size type: object required: - image - size - storage type: object status: description: HwfkaStatus defines the observed state of Hwfka properties: phase: type: string server: type: string type: object type: object served: true storage: true subresources: status: {} status: acceptedNames: kind: "" plural: "" conditions: [] storedVersions: []
- 修改csd.yaml文件。
role: serviceEntity defaultConfiguration: |- { "apiVersion": "hwfka.osc/v1", "kind": "Hwfka", "spec": { "image": "swr.cn-north-7.myhuaweicloud.com/osc-official/hwfka:0.0.1", # 该镜像为制作实例镜像章节生成的镜像,请修改为实际的镜像地址 "size": 2 } }
父主题: 制作服务包