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

Build and deploy optimize #115

Merged
merged 5 commits into from
Nov 30, 2021
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
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ endif

build: build_yaml build_fuse

build_all: pre_build pre_chaosblade build build_image
build_all: pre_build pre_chaosblade build docker-build

docker-build:
GOOS="linux" GOARCH="amd64" go build $(GO_FLAGS) -o build/_output/bin/chaosblade-operator cmd/manager/main.go
docker build -f build/Dockerfile -t chaosblade-operator:${BLADE_VERSION} .

#operator-sdk 0.19.0 build
build_all_operator: pre_build pre_chaosblade build build_image
build_image:
operator-sdk build --go-build-args="$(GO_FLAGS)" chaosblade-operator:${BLADE_VERSION}

Expand All @@ -68,11 +74,13 @@ pre_build:

build_spec_yaml: build/spec.go
$(GO) run $< $(OS_YAML_FILE_PATH) $(CHAOSBLADE_PATH)/yaml/chaosblade-jvm-spec-$(BLADE_VERSION).yaml
cp $(OS_YAML_FILE_PATH) $(CHAOSBLADE_PATH)/yaml/

build_yaml: pre_build build_spec_yaml
build_yaml: pre_build pre_chaosblade build_spec_yaml

build_fuse:
$(GO) build $(GO_FLAGS) -o $(BUILD_TARGET_BIN)/chaos_fuse cmd/hookfs/main.go
$(GO) build $(GO_FLAGS) -o $(BUILD_TARGET_BIN)/chaos_fuse cmd/hookfs/main.go
cp $(BUILD_TARGET_BIN)/chaos_fuse $(CHAOSBLADE_PATH)/bin/

# test
test:
Expand Down
3 changes: 2 additions & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM alpine:3.8 as builder
ENV OPERATOR=/usr/local/bin/chaosblade-operator
COPY build/_output/bin/chaosblade-operator /usr/local/bin/

FROM registry.access.redhat.com/ubi7/ubi-minimal:latest
FROM centos:latest

ENV OPERATOR=/usr/local/bin/chaosblade-operator \
CHAOSBLADE_HOME=/opt/chaosblade
Expand All @@ -12,6 +12,7 @@ COPY --from=builder ${OPERATOR} /usr/local/bin/
COPY build/cache/chaosblade ${CHAOSBLADE_HOME}
COPY build/bin /usr/local/bin

RUN yum install net-tools -y
RUN /usr/local/bin/user_setup

ENTRYPOINT ["/usr/local/bin/entrypoint"]
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ spec:
name: chaosblade-operator
part-of: chaosblade
spec:
dnsPolicy: {{ .Values.network.dns.policy }}
hostNetwork: {{ .Values.network.host }}
serviceAccountName: chaosblade
containers:
- name: chaosblade-operator
Expand Down Expand Up @@ -69,4 +71,4 @@ spec:
- name: cert
secret:
defaultMode: 420
secretName: chaosblade-webhook-server-cert
secretName: chaosblade-webhook-server-cert
5 changes: 5 additions & 0 deletions deploy/helm/chaosblade-operator-for-v2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ daemonset:
remove:
blade:
interval: 72h

network:
host: false
dns:
policy: ClusterFirst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ spec:
name: chaosblade-operator
part-of: chaosblade
spec:
dnsPolicy: {{ .Values.network.dns.policy }}
hostNetwork: {{ .Values.network.host }}
serviceAccountName: chaosblade
containers:
- name: chaosblade-operator
Expand Down Expand Up @@ -69,4 +71,4 @@ spec:
- name: cert
secret:
defaultMode: 420
secretName: chaosblade-webhook-server-cert
secretName: chaosblade-webhook-server-cert
5 changes: 5 additions & 0 deletions deploy/helm/chaosblade-operator-for-v3/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,8 @@ daemonset:
remove:
blade:
interval: 72h

network:
host: false
dns:
policy: ClusterFirst