From 34c95822e1792ab277eb8a05482f57e3cb5682f6 Mon Sep 17 00:00:00 2001 From: caimingxia Date: Wed, 29 Jun 2022 15:58:12 +0800 Subject: [PATCH] add arm64 helm chart, update verison from 1.6.0 to 1.6.1 Signed-off-by: caimingxia --- Makefile | 4 +- .../chaosblade-operator-arm64/.helmignore | 21 +++ .../helm/chaosblade-operator-arm64/Chart.yaml | 6 + .../chaosblade-operator-arm64/crds/crd.yaml | 155 ++++++++++++++++++ .../templates/NOTES.txt | 1 + .../templates/_helpers.tpl | 1 + .../templates/daemonset.yaml | 109 ++++++++++++ .../templates/deployment.yaml | 74 +++++++++ .../templates/rbac.yaml | 61 +++++++ .../templates/secret.yaml | 53 ++++++ .../templates/service.yaml | 11 ++ .../chaosblade-operator-arm64/values.yaml | 35 ++++ deploy/helm/chaosblade-operator/Chart.yaml | 4 +- deploy/helm/chaosblade-operator/values.yaml | 4 +- 14 files changed, 533 insertions(+), 6 deletions(-) create mode 100644 deploy/helm/chaosblade-operator-arm64/.helmignore create mode 100644 deploy/helm/chaosblade-operator-arm64/Chart.yaml create mode 100644 deploy/helm/chaosblade-operator-arm64/crds/crd.yaml create mode 100644 deploy/helm/chaosblade-operator-arm64/templates/NOTES.txt create mode 100644 deploy/helm/chaosblade-operator-arm64/templates/_helpers.tpl create mode 100644 deploy/helm/chaosblade-operator-arm64/templates/daemonset.yaml create mode 100644 deploy/helm/chaosblade-operator-arm64/templates/deployment.yaml create mode 100644 deploy/helm/chaosblade-operator-arm64/templates/rbac.yaml create mode 100644 deploy/helm/chaosblade-operator-arm64/templates/secret.yaml create mode 100644 deploy/helm/chaosblade-operator-arm64/templates/service.yaml create mode 100644 deploy/helm/chaosblade-operator-arm64/values.yaml diff --git a/Makefile b/Makefile index c41bac3..965d41e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ GO=env $(GO_ENV) $(GO_MODULE) go UNAME := $(shell uname) ifeq ($(BLADE_VERSION), ) - BLADE_VERSION=1.6.0 + BLADE_VERSION=1.6.1 endif ifeq ($(BLADE_VENDOR), ) BLADE_VENDOR=community @@ -45,7 +45,7 @@ build_image: operator-sdk build --go-build-args="$(GO_FLAGS)" chaosblade-operator:${BLADE_VERSION} build_image_arm64: - GOOS="linux" GOARCH="arm64" operator-sdk build --go-build-args="$(GO_FLAGS)" chaosblade-operator:${BLADE_VERSION} + GOOS="linux" GOARCH="arm64" operator-sdk build --go-build-args="$(GO_FLAGS)" chaosblade-operator-arm64:${BLADE_VERSION} # only build_fuse and yaml build_linux: diff --git a/deploy/helm/chaosblade-operator-arm64/.helmignore b/deploy/helm/chaosblade-operator-arm64/.helmignore new file mode 100644 index 0000000..f0c1319 --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/.helmignore @@ -0,0 +1,21 @@ +# 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 +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/deploy/helm/chaosblade-operator-arm64/Chart.yaml b/deploy/helm/chaosblade-operator-arm64/Chart.yaml new file mode 100644 index 0000000..618a2c5 --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v1 +appVersion: "1.6.1" +description: ChaosBlade Operator +name: chaosblade-operator-arm64 +version: 1.6.1 +home: https://github.com/chaosblade-io diff --git a/deploy/helm/chaosblade-operator-arm64/crds/crd.yaml b/deploy/helm/chaosblade-operator-arm64/crds/crd.yaml new file mode 100644 index 0000000..a4cfc21 --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/crds/crd.yaml @@ -0,0 +1,155 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + name: chaosblades.chaosblade.io +spec: + group: chaosblade.io + names: + kind: ChaosBlade + listKind: ChaosBladeList + plural: chaosblades + singular: chaosblade + shortNames: [blade] + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ChaosBlade is the Schema for the chaosblades 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: ChaosBladeSpec defines the desired state of ChaosBlade + properties: + experiments: + description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + Important: Run "operator-sdk generate k8s" to regenerate code after + modifying this file Add custom validation using kubebuilder tags: + https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html' + items: + properties: + action: + description: Action is the experiment scenario of the target, + such as delay, load + type: string + desc: + description: Desc is the experiment description + type: string + matchers: + description: Matchers is the experiment rules + items: + properties: + name: + description: Name is the name of flag + type: string + value: + description: 'TODO: Temporarily defined as an array for + all flags Value is the value of flag' + items: + type: string + type: array + required: + - name + - value + type: object + type: array + scope: + description: Scope is the area of the experiments, currently support + node, pod and container + type: string + target: + description: Target is the experiment target, such as cpu, network + type: string + required: + - action + - scope + - target + type: object + type: array + required: + - experiments + type: object + status: + description: ChaosBladeStatus defines the observed state of ChaosBlade + properties: + expStatuses: + description: 'Important: Run "operator-sdk generate k8s" to regenerate + code after modifying this file Add custom validation using kubebuilder + tags: https://book-v1.book.kubebuilder.io/beyond_basics/generating_crd.html' + items: + properties: + action: + type: string + error: + type: string + resStatuses: + description: ResStatuses is the details of the experiment + items: + properties: + error: + description: experiment error + type: string + id: + description: experiment uid in chaosblade + type: string + identifier: + description: 'Resource identifier, rules as following: container: + Namespace/NodeName/PodName/ContainerName pod: Namespace/NodeName/PodName' + type: string + kind: + description: Kind + type: string + state: + description: experiment state + type: string + success: + description: success + type: boolean + required: + - kind + - state + - success + type: object + type: array + scope: + description: experiment scope for cache + type: string + state: + description: State is used to describe the experiment result + type: string + success: + description: Success is used to judge the experiment result + type: boolean + target: + type: string + required: + - action + - scope + - state + - success + - target + type: object + type: array + phase: + description: Phase indicates the state of the experiment Initial -> + Running -> Updating -> Destroying -> Destroyed + type: string + required: + - expStatuses + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/deploy/helm/chaosblade-operator-arm64/templates/NOTES.txt b/deploy/helm/chaosblade-operator-arm64/templates/NOTES.txt new file mode 100644 index 0000000..b8daef2 --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/templates/NOTES.txt @@ -0,0 +1 @@ +Thank you for using chaosblade. \ No newline at end of file diff --git a/deploy/helm/chaosblade-operator-arm64/templates/_helpers.tpl b/deploy/helm/chaosblade-operator-arm64/templates/_helpers.tpl new file mode 100644 index 0000000..5b0982c --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/templates/_helpers.tpl @@ -0,0 +1 @@ +{{/* vim: set filetype=mustache: */}} diff --git a/deploy/helm/chaosblade-operator-arm64/templates/daemonset.yaml b/deploy/helm/chaosblade-operator-arm64/templates/daemonset.yaml new file mode 100644 index 0000000..a7f0448 --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/templates/daemonset.yaml @@ -0,0 +1,109 @@ +{{- if .Values.daemonset.enable }} +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: chaosblade-tool + labels: + name: chaosblade-tool + app: chaosblade-tool +spec: + selector: + matchLabels: + name: chaosblade-tool + app: chaosblade-tool + updateStrategy: + type: RollingUpdate + template: + metadata: + labels: + name: chaosblade-tool + app: chaosblade-tool + spec: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: type + operator: NotIn + values: + - virtual-kubelet + containers: + - name: chaosblade-tool + image: {{ .Values.blade.repository }}:{{ .Values.blade.version }} + imagePullPolicy: {{ .Values.blade.pullPolicy }} + env: + - name: KUBERNETES_NODENAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: DOCKER_API_VERSION + value: "1.14.0" + securityContext: + privileged: true + volumeMounts: + - mountPath: /var/run/docker.sock + name: docker-socket + - mountPath: /opt/chaosblade/chaosblade.dat + name: chaosblade-db-volume + - mountPath: /etc/hosts + name: hosts + - mountPath: /var/log/audit + name: audit + - mountPath: /var/lib/docker + name: docker-lib + - mountPath: /etc/docker + name: docker-etc + - mountPath: /run/containerd + name: containerd + - mountPath: /var/lib/containerd + name: containerd-lib + - mountPath: /etc/containerd + name: containerd-etc + - mountPath: /var/run/netns + name: netns + - mountPath: /host-sys + name: sys + dnsPolicy: ClusterFirstWithHostNet + hostNetwork: true + hostPID: true + tolerations: + - effect: NoSchedule + operator: Exists + volumes: + - hostPath: + path: /var/run/docker.sock + name: docker-socket + - hostPath: + path: /var/run/chaosblade.dat + type: FileOrCreate + name: chaosblade-db-volume + - hostPath: + path: /etc/hosts + name: hosts + - hostPath: + path: /var/lib/docker + name: docker-lib + - hostPath: + path: /etc/docker + name: docker-etc + - hostPath: + path: /var/log/audit + name: audit + - hostPath: + path: /run/containerd + name: containerd + - hostPath: + path: /var/lib/containerd + name: containerd-lib + - hostPath: + path: /etc/containerd + name: containerd-etc + - hostPath: + path: /var/run/netns + name: netns + - hostPath: + path: /sys + name: sys + serviceAccountName: chaosblade +{{- end }} \ No newline at end of file diff --git a/deploy/helm/chaosblade-operator-arm64/templates/deployment.yaml b/deploy/helm/chaosblade-operator-arm64/templates/deployment.yaml new file mode 100644 index 0000000..ed9f4de --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/templates/deployment.yaml @@ -0,0 +1,74 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: chaosblade-operator + namespace: {{ .Release.Namespace }} +spec: + replicas: 1 + selector: + matchLabels: + name: chaosblade-operator + template: + metadata: + labels: + name: chaosblade-operator + part-of: chaosblade + spec: + dnsPolicy: {{ .Values.network.dns.policy }} + hostNetwork: {{ .Values.network.host }} + serviceAccountName: chaosblade + containers: + - name: chaosblade-operator + image: {{ .Values.operator.repository }}:{{ .Values.operator.version }} + command: ["chaosblade-operator"] + args: + {{- if .Values.blade.repository }} + - '--chaosblade-image-repository={{ .Values.blade.repository }}' + {{- end }} + {{- if .Values.blade.version }} + - '--chaosblade-version={{ .Values.blade.version }}' + {{- end }} + {{- if .Values.blade.pullPolicy }} + - '--chaosblade-image-pull-policy={{ .Values.blade.pullPolicy }}' + {{- end }} + {{- if .Values.env.zapLevel }} + - '--zap-level={{ .Values.env.zapLevel }}' + {{- end }} + {{- if .Values.env.logLevel }} + - '--log-level={{ .Values.env.logLevel }}' + {{- end }} + {{- if .Values.webhook.enable }} + - '--webhook-enable' + {{- end }} + {{- if .Values.daemonset.enable }} + - '--daemonset-enable' + {{- end }} + {{- if .Values.remove.blade.interval }} + - '--remove-blade-interval={{ .Values.remove.blade.interval }}' + {{- end }} + {{- if .Values.blade.downloadUrl }} + - '--chaosblade-download-url={{ .Values.blade.downloadUrl }}' + {{- end }} + - '--chaosblade-namespace={{ .Release.Namespace }}' + imagePullPolicy: {{ .Values.operator.pullPolicy }} + env: + - name: WATCH_NAMESPACE + value: "" + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "chaosblade-operator" + ports: + - containerPort: 9443 + protocol: TCP + volumeMounts: + - mountPath: /tmp/k8s-webhook-server/serving-certs + name: cert + readOnly: true + volumes: + - name: cert + secret: + defaultMode: 420 + secretName: chaosblade-webhook-server-cert diff --git a/deploy/helm/chaosblade-operator-arm64/templates/rbac.yaml b/deploy/helm/chaosblade-operator-arm64/templates/rbac.yaml new file mode 100644 index 0000000..ce73a94 --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/templates/rbac.yaml @@ -0,0 +1,61 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: chaosblade + labels: + name: chaosblade + namespace: {{ .Release.Namespace }} + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: chaosblade + labels: + name: chaosblade +rules: + - apiGroups: + - '' + resources: + - pods + - pods/exec + - configmaps + verbs: + - "*" + - apiGroups: + - '' + resources: + - nodes + verbs: + - get + - list + - watch + - apiGroups: + - apps + resources: + - daemonsets + - deployments + verbs: + - "*" + - apiGroups: + - chaosblade.io + resources: + - chaosblades + - chaosblades/status + verbs: + - "*" +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: chaosblade + labels: + name: chaosblade +roleRef: + kind: ClusterRole + name: chaosblade + apiGroup: rbac.authorization.k8s.io +subjects: + - kind: ServiceAccount + name: chaosblade + namespace: {{ .Release.Namespace }} diff --git a/deploy/helm/chaosblade-operator-arm64/templates/secret.yaml b/deploy/helm/chaosblade-operator-arm64/templates/secret.yaml new file mode 100644 index 0000000..09cb833 --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/templates/secret.yaml @@ -0,0 +1,53 @@ +{{- $ca := genCA "chaosblade-webhook-server-ca" 3650 }} +{{- $cn := "chaosblade-webhook-server" }} +{{- $dns1 := printf "%s.%s" $cn .Release.Namespace }} +{{- $dns2 := printf "%s.%s.svc" $cn .Release.Namespace }} +{{- $cert := genSignedCert $cn nil (list $dns1 $dns2) 3650 $ca }} + +apiVersion: admissionregistration.k8s.io/v1 +kind: MutatingWebhookConfiguration +metadata: + name: chaosblade-operator + namespace: {{ .Release.Namespace }} + labels: + app: chaosblade-operator + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +webhooks: + - clientConfig: + caBundle: {{ $ca.Cert | b64enc | quote }} + service: + name: chaosblade-webhook-server + namespace: {{ .Release.Namespace }} + path: /mutating-pods + name: "{{ .Chart.Name }}.{{ .Release.Namespace }}.svc" + failurePolicy: Ignore + rules: + - apiGroups: + - "" + apiVersions: + - v1 + operations: + - CREATE + - UPDATE + resources: + - pods + sideEffects: None + admissionReviewVersions: ["v1beta1"] +--- +apiVersion: v1 +kind: Secret +metadata: + name: chaosblade-webhook-server-cert + namespace: {{ .Release.Namespace }} + labels: + app: chaosblade-operator + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} +type: kubernetes.io/tls +data: + tls.crt: {{ $cert.Cert | b64enc | quote }} + tls.key: {{ $cert.Key | b64enc | quote }} + ca.crt: {{ $ca.Cert | b64enc | quote }} diff --git a/deploy/helm/chaosblade-operator-arm64/templates/service.yaml b/deploy/helm/chaosblade-operator-arm64/templates/service.yaml new file mode 100644 index 0000000..45588bb --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/templates/service.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: Service +metadata: + name: chaosblade-webhook-server + namespace: {{ .Release.Namespace }} +spec: + ports: + - port: 443 + targetPort: 9443 + selector: + name: chaosblade-operator diff --git a/deploy/helm/chaosblade-operator-arm64/values.yaml b/deploy/helm/chaosblade-operator-arm64/values.yaml new file mode 100644 index 0000000..a434bcc --- /dev/null +++ b/deploy/helm/chaosblade-operator-arm64/values.yaml @@ -0,0 +1,35 @@ +# Default values for chaosblade. + +# chaosblade-operator +operator: + repository: chaosbladeio/chaosblade-operator-arm64 + version: 1.6.1 + # image.pullPolicy: must be Always|IfNotPresent|Never + pullPolicy: IfNotPresent + # qps of kubernetes client + qps: 20 + reconcileCount: 20 + +blade: + repository: chaosbladeio/chaosblade-tool-arm64 + version: 1.6.1 + pullPolicy: IfNotPresent + downloadUrl: "" + +env: + logLevel: info + +webhook: + enable: true + +daemonset: + enable: true + +remove: + blade: + interval: 72h + +network: + host: false + dns: + policy: ClusterFirst diff --git a/deploy/helm/chaosblade-operator/Chart.yaml b/deploy/helm/chaosblade-operator/Chart.yaml index 0239c63..b397bb5 100644 --- a/deploy/helm/chaosblade-operator/Chart.yaml +++ b/deploy/helm/chaosblade-operator/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 -appVersion: "1.6.0" +appVersion: "1.6.1" description: ChaosBlade Operator name: chaosblade-operator -version: 1.6.0 +version: 1.6.1 home: https://github.com/chaosblade-io diff --git a/deploy/helm/chaosblade-operator/values.yaml b/deploy/helm/chaosblade-operator/values.yaml index e403cc5..29c7147 100644 --- a/deploy/helm/chaosblade-operator/values.yaml +++ b/deploy/helm/chaosblade-operator/values.yaml @@ -3,7 +3,7 @@ # chaosblade-operator operator: repository: chaosbladeio/chaosblade-operator - version: 1.6.0 + version: 1.6.1 # image.pullPolicy: must be Always|IfNotPresent|Never pullPolicy: IfNotPresent # qps of kubernetes client @@ -12,7 +12,7 @@ operator: blade: repository: chaosbladeio/chaosblade-tool - version: 1.6.0 + version: 1.6.1 pullPolicy: IfNotPresent downloadUrl: ""