Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize chaosblade resource state flow in k8s experiments #22

Merged
merged 2 commits into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ UNAME := $(shell uname)
ifeq ($(BLADE_VERSION), )
BLADE_VERSION=0.6.0
endif
ifeq ($(BLADE_VENDOR), )
BLADE_VENDOR=community
endif

BUILD_TARGET=target
BUILD_TARGET_DIR_NAME=chaosblade-$(BLADE_VERSION)
Expand All @@ -24,8 +27,12 @@ BUILD_TARGET_CACHE=$(BUILD_TARGET)/cache
OS_YAML_FILE_NAME=chaosblade-k8s-spec-$(BLADE_VERSION).yaml
OS_YAML_FILE_PATH=$(BUILD_TARGET_BIN)/$(OS_YAML_FILE_NAME)

VERSION_PKG=github.com/chaosblade-io/chaosblade-operator/version
GO_X_FLAGS=-X $(VERSION_PKG).Ver=$(BLADE_VERSION) -X $(VERSION_PKG).Vendor=$(BLADE_VENDOR)
GO_FLAGS=-ldflags="$(GO_X_FLAGS)"

ifeq ($(GOOS), linux)
GO_FLAGS=-ldflags="-linkmode external -extldflags -static"
GO_FLAGS=-ldflags="-linkmode external -extldflags -static $(GO_X_FLAGS)"
endif

build: pre_build build_yaml build_fuse
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
appVersion: "0.5.1"
appVersion: "0.6.0"
description: ChaosBlade Operator
name: chaosblade-operator
version: 0.5.1
version: 0.6.0
home: https://github.com/chaosblade-io
45 changes: 45 additions & 0 deletions deploy/helm/chaosblade-operator-for-v2/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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:
serviceAccountName: chaosblade
containers:
- name: chaosblade-operator
image: {{ .Values.operator.repository }}:{{ .Values.operator.version }}
command: ["chaosblade-operator"]
args:
{{- if .Values.env.zapLevel }}
- '--zap-level={{ .Values.env.zapLevel }}'
{{- end }}
{{- if .Values.blade.version }}
- '--blade-version={{ .Values.blade.version }}'
{{- end }}
{{- if .Values.blade.repository }}
- '--image-repo={{ .Values.blade.repository }}'
{{- end }}
{{- if .Values.blade.pullPolicy }}
- '--pull-policy={{ .Values.blade.pullPolicy }}'
{{- end }}
- '--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"
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ rbac:
# chaosblade-operator
operator:
repository: "registry.cn-hangzhou.aliyuncs.com/chaosblade/chaosblade-operator"
version: 0.5.1
version: 0.6.0
# image.pullPolicy: must be Always|IfNotPresent|Never
pullPolicy: IfNotPresent

# chaosblade-tool
blade:
repository: registry.cn-hangzhou.aliyuncs.com/chaosblade/chaosblade-tool
version: 0.5.0
version: 0.6.0
# image.pullPolicy: must be Always|IfNotPresent|Never
pullPolicy: IfNotPresent

Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/chaosblade-operator-for-v3/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
appVersion: "0.5.1"
appVersion: "0.6.0"
description: ChaosBlade Operator
name: chaosblade-operator
version: 0.5.1
version: 0.6.0
home: https://github.com/chaosblade-io
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: chaosblades.chaosblade.io
annotations:
helm.sh/hook-delete-policy: before-hook-creation
spec:
group: chaosblade.io
names:
Expand Down Expand Up @@ -60,8 +58,8 @@ spec:
type: string
type: array
required:
- name
- value
- name
- value
type: object
type: array
scope:
Expand All @@ -72,13 +70,13 @@ spec:
description: Target is the experiment target, such as cpu, network
type: string
required:
- scope
- target
- action
- scope
- target
- action
type: object
type: array
required:
- experiments
- experiments
type: object
status:
properties:
Expand Down Expand Up @@ -121,9 +119,9 @@ spec:
description: resource uid
type: string
required:
- state
- kind
- success
- state
- kind
- success
type: object
type: array
scope:
Expand All @@ -138,22 +136,22 @@ spec:
target:
type: string
required:
- scope
- target
- action
- success
- state
- scope
- target
- action
- success
- state
type: object
type: array
phase:
description: Phase indicates the state of the experiment Initial ->
Running -> Updating -> Destroying -> Destroyed
type: string
required:
- expStatuses
- expStatuses
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
- name: v1alpha1
served: true
storage: true
63 changes: 0 additions & 63 deletions deploy/helm/chaosblade-operator-for-v3/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,66 +1,3 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: chaosblade-tool
namespace: {{ .Release.Namespace }}
spec:
minReadySeconds: 5
selector:
matchLabels:
app: chaosblade-tool
template:
metadata:
labels:
app: chaosblade-tool
part-of: chaosblade
name: chaosblade-tool
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: type
operator: NotIn
values:
- virtual-kubelet
containers:
- image: {{ .Values.blade.repository }}:{{ .Values.blade.version }}
imagePullPolicy: {{ .Values.blade.pullPolicy }}
name: chaosblade-tool
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
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
hostPID: true
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
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
updateStrategy:
type: RollingUpdate
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
4 changes: 2 additions & 2 deletions deploy/helm/chaosblade-operator-for-v3/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ rbac:
# chaosblade-operator
operator:
repository: "registry.cn-hangzhou.aliyuncs.com/chaosblade/chaosblade-operator"
version: 0.5.1
version: 0.6.0
# image.pullPolicy: must be Always|IfNotPresent|Never
pullPolicy: IfNotPresent

# chaosblade-tool
blade:
repository: registry.cn-hangzhou.aliyuncs.com/chaosblade/chaosblade-tool
version: 0.5.0
version: 0.6.0
# image.pullPolicy: must be Always|IfNotPresent|Never
pullPolicy: IfNotPresent

Expand Down
108 changes: 0 additions & 108 deletions deploy/helm/chaosblade-operator/templates/deployment.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion deploy/olm/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: build clean

BLADE_VERSION=0.5.1
BLADE_VERSION=0.6.0

# Build [OLM](https://github.com/operator-framework/operator-lifecycle-manager)
build:
Expand Down
Loading