Skip to content

Commit

Permalink
Refactor Makefile (fluid-cloudnative#783)
Browse files Browse the repository at this point in the history
* Refactor Makefile, To #33889330

Refactor Makefile, To #33889330

* Refactor Makefile, To #33889330
  • Loading branch information
cheyang authored May 16, 2021
1 parent bf9127e commit c56c851
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.webhook
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM golang:1.14.2 as builder
WORKDIR /go/src/github.com/fluid-cloudnative/fluid
COPY . .

RUN make fluid-webhook-build && \
RUN make webhook-build && \
cp bin/fluid-webhook /go/bin/fluid-webhook

FROM alpine:3.10
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ alluxioruntime-controller-build: generate fmt vet
jindoruntime-controller-build: generate fmt vet
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=off go build -gcflags="-N -l" -a -o bin/jindoruntime-controller -ldflags '${LDFLAGS}' cmd/jindo/main.go

fluid-webhook-build:
webhook-build: generate fmt vet
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=off go build -gcflags="-N -l" -a -o bin/fluid-webhook -ldflags '${LDFLAGS}' cmd/webhook/main.go

# Debug against the configured Kubernetes cluster in ~/.kube/config, add debug
Expand Down Expand Up @@ -131,7 +131,7 @@ docker-build-loader:
docker-build-init-users:
docker build --no-cache charts/alluxio/docker/init-users -t ${INIT_USERS_IMG}:${GIT_VERSION}

docker-build-fluid-webhook:
docker-build-webhook:
docker build --no-cache . -f Dockerfile.webhook -t ${WEBHOOK_IMG}:${GIT_VERSION}

# Push the docker image
Expand All @@ -153,8 +153,11 @@ docker-push-loader: docker-build-loader
docker-push-init-users: docker-build-init-users
docker push ${INIT_USERS_IMG}:${GIT_VERSION}

docker-build-all: docker-build-dataset-controller docker-build-alluxioruntime-controller docker-build-jindoruntime-controller docker-build-csi docker-build-init-users
docker-push-all: docker-push-dataset-controller docker-push-alluxioruntime-controller docker-push-jindoruntime-controller docker-push-csi docker-push-init-users
docker-push-webhook: docker-build-webhook
docker push ${WEBHOOK_IMG}:${GIT_VERSION}

docker-build-all: docker-build-dataset-controller docker-build-alluxioruntime-controller docker-build-jindoruntime-controller docker-build-csi docker-build-init-users fluid-build-webhook
docker-push-all: docker-push-dataset-controller docker-push-alluxioruntime-controller docker-push-jindoruntime-controller docker-push-csi docker-push-init-users docker-push-webhook

# find or download controller-gen
# download controller-gen if necessary
Expand Down
2 changes: 1 addition & 1 deletion charts/fluid/fluid/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ version: 0.6.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 0.6.0-db75dcf
appVersion: 0.6.0-ab90914
home: https://github.com/fluid-cloudnative/fluid
keywords:
- category:data
Expand Down
12 changes: 6 additions & 6 deletions charts/fluid/fluid/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ workdir: /tmp

dataset:
controller:
image: registry.aliyuncs.com/fluid/dataset-controller:v0.6.0-db75dcf
image: registry.aliyuncs.com/fluid/dataset-controller:v0.6.0-2602784

csi:
registrar:
image: registry.aliyuncs.com/acs/csi-node-driver-registrar:v1.2.0
plugins:
image: registry.aliyuncs.com/fluid/fluid-csi:v0.6.0-db75dcf
image: registry.aliyuncs.com/fluid/fluid-csi:v0.6.0-2602784
kubelet:
rootDir: /var/lib/kubelet

Expand All @@ -22,9 +22,9 @@ runtime:
portRange: 20000-26000
enabled: true
init:
image: registry.aliyuncs.com/fluid/init-users:v0.6.0-db75dcf
image: registry.aliyuncs.com/fluid/init-users:v0.6.0-2602784
controller:
image: registry.aliyuncs.com/fluid/alluxioruntime-controller:v0.6.0-db75dcf
image: registry.aliyuncs.com/fluid/alluxioruntime-controller:v0.6.0-2602784
runtime:
image: registry.aliyuncs.com/alluxio/alluxio:release-2.5.0-2-SNAPSHOT-52ad95c
fuse:
Expand All @@ -37,9 +37,9 @@ runtime:
fuse:
image: registry.cn-shanghai.aliyuncs.com/jindofs/jindo-fuse:3.5.0
controller:
image: registry.aliyuncs.com/fluid/jindoruntime-controller:v0.6.0-db75dcf
image: registry.aliyuncs.com/fluid/jindoruntime-controller:v0.6.0-2602784

webhook:
enabled: true
image: registry.aliyuncs.com/fluid/fluid-webhook:v0.6.0-2ecf3ec
image: registry.aliyuncs.com/fluid/fluid-webhook:v0.6.0-2602784

11 changes: 6 additions & 5 deletions pkg/webhook/mutatingwebhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package webhook
import (
"context"
"encoding/json"
"net/http"

"github.com/fluid-cloudnative/fluid/pkg/ddc/base"
"github.com/fluid-cloudnative/fluid/pkg/utils/kubeclient"
"github.com/fluid-cloudnative/fluid/pkg/webhook/plugins"
"net/http"
ctrl "sigs.k8s.io/controller-runtime"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -56,12 +57,12 @@ func (a *MutatingHandler) Handle(ctx context.Context, req admission.Request) adm

// check whether should inject
if pod.Labels["Fluid-Injection"] == "disabled" {
setupLog.Info("injection is disabled, will not inject", "Pod", pod.Name, "Namespace", pod.Namespace)
return admission.Allowed("injection is disabled, will not inject")
setupLog.Info("skip mutating the pod because injection is disabled", "Pod", pod.Name, "Namespace", pod.Namespace)
return admission.Allowed("skip mutating the pod because injection is disabled")
}
if pod.Labels["app"] == "alluxio" || pod.Labels["app"] == "jindofs" {
setupLog.Info("fluid Pods, will not inject", "Pod", pod.Name, "Namespace", pod.Namespace)
return admission.Allowed("fluid Pods, will not inject")
setupLog.Info("skip mutating the pod because it's fluid Pods", "Pod", pod.Name, "Namespace", pod.Namespace)
return admission.Allowed("skip mutating the pod because it's fluid Pods")
}

// inject affinity info into pod
Expand Down

0 comments on commit c56c851

Please sign in to comment.