From 730d1133930f65c2efa582e95160300185057f1a Mon Sep 17 00:00:00 2001 From: zhanjian Date: Tue, 30 Apr 2024 19:17:38 +0800 Subject: [PATCH] add Manually deploy yaml for 1.28 k8s --- charts/gravity-operator/deploy/admin.yaml | 103 ++++++++++++++ .../gravity-operator/deploy/cluster-co.yaml | 16 +++ charts/gravity-operator/deploy/crd.yaml | 134 ++++++++++++++++++ charts/gravity-operator/deploy/operator.yaml | 65 +++++++++ charts/gravity-operator/deploy/rbac.yaml | 40 ++++++ 5 files changed, 358 insertions(+) create mode 100644 charts/gravity-operator/deploy/admin.yaml create mode 100644 charts/gravity-operator/deploy/cluster-co.yaml create mode 100644 charts/gravity-operator/deploy/crd.yaml create mode 100644 charts/gravity-operator/deploy/operator.yaml create mode 100644 charts/gravity-operator/deploy/rbac.yaml diff --git a/charts/gravity-operator/deploy/admin.yaml b/charts/gravity-operator/deploy/admin.yaml new file mode 100644 index 0000000..fb9792b --- /dev/null +++ b/charts/gravity-operator/deploy/admin.yaml @@ -0,0 +1,103 @@ +apiVersion: v1 +kind: Service +metadata: + name: gravity-operator-admin + labels: + app.kubernetes.io/name: gravity-operator-admin + helm.sh/chart: gravity-operator-0.3.0 + app.kubernetes.io/instance: gravity-operator-admin + app.kubernetes.io/managed-by: Tiller +spec: + type: NodePort + ports: + - name: http + port: 80 + targetPort: http + nodePort: 30066 + selector: + app.kubernetes.io/name: gravity-operator-admin + app.kubernetes.io/instance: gravity-operator-admin +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: gravity-operator-admin + labels: + app.kubernetes.io/name: gravity-operator-admin + helm.sh/chart: gravity-operator-0.3.0 + app.kubernetes.io/instance: gravity-operator-admin + app.kubernetes.io/managed-by: Tiller +data: + gravity.conf: | + tcp_nopush on; + tcp_nodelay on; + types_hash_max_size 2048; + + gzip on; + gzip_min_length 1024; + gzip_buffers 4 8k; + gzip_types text/plain application/x-javascript text/css application/xml application/json; + + server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + index index.html; + try_files $uri $uri/ /index.html; + } + + location /api/ { + proxy_pass http://gravity-operator:80/; + } + + location /health { + access_log off; + return 200 "healthy"; + } + } +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: gravity-operator-admin + labels: + app.kubernetes.io/name: gravity-operator-admin + helm.sh/chart: gravity-operator-0.3.0 + app.kubernetes.io/instance: gravity-operator-admin + app.kubernetes.io/managed-by: Tiller +spec: + selector: + matchLabels: + app.kubernetes.io/name: gravity-operator-admin + app.kubernetes.io/instance: gravity-operator-admin + strategy: + rollingUpdate: + maxUnavailable: 0 + template: + metadata: + labels: + app.kubernetes.io/name: gravity-operator-admin + app.kubernetes.io/instance: gravity-operator-admin + spec: + restartPolicy: Always + volumes: + - name: ng-conf + configMap: + name: gravity-operator-admin + containers: + - name: admin + image: "moiot/gravity-admin:v0.2.0" + imagePullPolicy: IfNotPresent + volumeMounts: + - name: ng-conf + mountPath: /etc/nginx/conf.d + ports: + - name: http + containerPort: 80 + protocol: TCP + readinessProbe: + httpGet: + path: /health + port: http diff --git a/charts/gravity-operator/deploy/cluster-co.yaml b/charts/gravity-operator/deploy/cluster-co.yaml new file mode 100644 index 0000000..737690e --- /dev/null +++ b/charts/gravity-operator/deploy/cluster-co.yaml @@ -0,0 +1,16 @@ +apiVersion: gravity.mobike.io/v1alpha1 +kind: Cluster +metadata: + name: gravity-operator-cluster + labels: + app.kubernetes.io/name: gravity-operator-cluster + helm.sh/chart: gravity-operator-0.3.0 + app.kubernetes.io/instance: gravity-operator + app.kubernetes.io/managed-by: Tiller +spec: + rolling: "25%" + deploymentRules: + - group: "default" + pipelines: ["*"] + image: "moiot/gravity:v0.9.21" + command: ["/gravity", "-config=/etc/gravity/config.json"] diff --git a/charts/gravity-operator/deploy/crd.yaml b/charts/gravity-operator/deploy/crd.yaml new file mode 100644 index 0000000..dbea3bc --- /dev/null +++ b/charts/gravity-operator/deploy/crd.yaml @@ -0,0 +1,134 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + helm.sh/hook: crd-install + + name: clusters.gravity.mobike.io + +spec: + conversion: + strategy: None + group: gravity.mobike.io + names: + kind: Cluster + listKind: ClusterList + plural: clusters + singular: cluster + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Total number of pipelines. + jsonPath: .status.pipelines + name: Total + type: integer + - description: Total number of pipelines which version match current deployment + rule. + jsonPath: .status.updatedPipelines + name: Updated + type: integer + - description: Total number of available pipelines (ready for at least minReadySeconds). + jsonPath: .status.availablePipelines + name: Available + type: integer + - description: Total number of unavailable pipelines. + jsonPath: .status.unavailablePipelines + name: Unavailable + type: integer + name: v1alpha1 + served: true + storage: true + subresources: + status: {} + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object + properties: + deploymentRules: + type: array + items: + type: object + properties: + command: + type: array + items: + type: string + group: + type: string + image: + type: string + pipelines: + type: array + items: + type: string + rolling: + type: string + +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + helm.sh/hook: crd-install + generation: 1 + name: pipelines.gravity.mobike.io + +spec: + conversion: + strategy: None + group: gravity.mobike.io + names: + kind: Pipeline + listKind: PipelineList + plural: pipelines + singular: pipeline + scope: Namespaced + versions: + - additionalPrinterColumns: + - description: Position of the pipeline. + jsonPath: .status.position + name: Position + type: string + name: v1alpha1 + served: true + storage: true + subresources: + status: {} + schema: + openAPIV3Schema: + type: object + properties: + spec: + type: object + properties: + command: + type: array + items: + type: string + configHash: + type: string + image: + type: string + lastUpdate: + type: string + format: date-time + paused: + type: boolean + x-kubernetes-preserve-unknown-fields: true + status: + type: object + properties: + command: + type: array + items: + type: string + image: + type: string + podName: + type: string + position: + type: string + x-kubernetes-preserve-unknown-fields: true \ No newline at end of file diff --git a/charts/gravity-operator/deploy/operator.yaml b/charts/gravity-operator/deploy/operator.yaml new file mode 100644 index 0000000..fad7106 --- /dev/null +++ b/charts/gravity-operator/deploy/operator.yaml @@ -0,0 +1,65 @@ +apiVersion: v1 +kind: Service +metadata: + name: gravity-operator + labels: + app.kubernetes.io/name: gravity-operator + helm.sh/chart: gravity-operator + app.kubernetes.io/instance: gravity-operator + app.kubernetes.io/managed-by: Tiller +spec: + type: ClusterIP + ports: + - name: http + port: 80 + targetPort: http + selector: + app.kubernetes.io/name: gravity-operator + app.kubernetes.io/instance: gravity-operator + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: gravity-operator + labels: + app.kubernetes.io/name: gravity-operator + helm.sh/chart: gravity-operator + app.kubernetes.io/instance: gravity-operator + app.kubernetes.io/managed-by: Tiller +spec: + minReadySeconds: 5 + selector: + matchLabels: + app.kubernetes.io/name: gravity-operator + app.kubernetes.io/instance: gravity-operator + strategy: + type: Recreate + template: + metadata: + labels: + app.kubernetes.io/name: gravity-operator + app.kubernetes.io/instance: gravity-operator + spec: + serviceAccountName: gravity-operator + restartPolicy: Always + containers: + - name: operator + env: + - name: MY_POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: MY_SERVICE_URI + value: http://gravity-operator:80 + image: "moiot/gravity-operator:v0.3.0" + command: ["/gravity-operator"] + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 8080 + protocol: TCP + readinessProbe: + httpGet: + path: /metrics + port: http diff --git a/charts/gravity-operator/deploy/rbac.yaml b/charts/gravity-operator/deploy/rbac.yaml new file mode 100644 index 0000000..5905389 --- /dev/null +++ b/charts/gravity-operator/deploy/rbac.yaml @@ -0,0 +1,40 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + name: gravity-operator-role +rules: + - apiGroups: [""] + resources: ["configmaps", "pods", "services", "endpoints", "events"] + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] + + - apiGroups: ["apps"] + resources: ["statefulsets"] + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] + + - apiGroups: ["batch"] + resources: ["cronjobs", "jobs"] + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] + + - apiGroups: ["gravity.mobike.io"] + resources: ["*"] + verbs: ["*"] + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: gravity-operator-rolebinding +subjects: + - kind: ServiceAccount + name: gravity-operator +roleRef: + kind: Role + name: gravity-operator-role + apiGroup: rbac.authorization.k8s.io + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: gravity-operator