Skip to content

Commit

Permalink
chore: update deps (#1168)
Browse files Browse the repository at this point in the history
* chore: update deps
---------

Signed-off-by: Xuhui zhang <[email protected]>
  • Loading branch information
zxh326 authored Nov 8, 2024
1 parent 1746a1f commit e36798c
Show file tree
Hide file tree
Showing 38 changed files with 446 additions and 1,182 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
strategy:
fail-fast: false
steps:
- name: Set up Go 1.20.x
uses: actions/setup-go@v2
- name: Set up Go 1.22.x
uses: actions/setup-go@v5
with:
go-version: '1.20.x'
go-version: '1.22'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ uninstall: yaml
# build dev image
.PHONY: image-dev
image-dev: juicefs-csi-driver dashboard
docker build --build-arg TARGETARCH=$(TARGETARCH) -t $(IMAGE):$(DEV_TAG) -f docker/dev.Dockerfile bin
docker build --build-arg TARGETARCH=$(TARGETARCH) -t $(REGISTRY)/$(IMAGE):$(DEV_TAG) -f docker/dev.Dockerfile bin
docker build --build-context project=. --build-context ui=dashboard-ui-v2/ -f docker/dashboard.Dockerfile \
-t $(REGISTRY)/$(DASHBOARD_IMAGE):$(DEV_TAG) .

Expand Down
24 changes: 14 additions & 10 deletions cmd/app/mount_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
"k8s.io/klog/v2"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

"github.com/juicedata/juicefs-csi-driver/pkg/common"
"github.com/juicedata/juicefs-csi-driver/pkg/config"
Expand Down Expand Up @@ -61,24 +63,26 @@ func NewMountManager(
return nil, err
}
mgr, err := ctrl.NewManager(conf, ctrl.Options{
Scheme: scheme,
Port: 9443,
MetricsBindAddress: "0.0.0.0:8083",
LeaderElection: leaderElection,
LeaderElectionNamespace: leaderElectionNamespace,
LeaderElectionID: "mount.juicefs.com",
LeaseDuration: &leaderElectionLeaseDuration,
NewCache: cache.BuilderWithOptions(cache.Options{
Scheme: scheme,
Metrics: metricsserver.Options{
BindAddress: "0.0.0.0:8083",
},
LeaderElection: leaderElection,
LeaderElectionNamespace: leaderElectionNamespace,
LeaderElectionResourceLock: "leases",
LeaderElectionID: "mount.juicefs.com",
LeaseDuration: &leaderElectionLeaseDuration,
Cache: cache.Options{
Scheme: scheme,
SelectorsByObject: cache.SelectorsByObject{
ByObject: map[client.Object]cache.ByObject{
&corev1.Pod{}: {
Label: labels.SelectorFromSet(labels.Set{common.PodTypeKey: common.PodTypeValue}),
},
&batchv1.Job{}: {
Label: labels.SelectorFromSet(labels.Set{common.PodTypeKey: common.JobTypeValue}),
},
},
}),
},
})
if err != nil {
log.Error(err, "New mount controller error")
Expand Down
18 changes: 11 additions & 7 deletions cmd/app/pod_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"

"github.com/juicedata/juicefs-csi-driver/pkg/common"
mountctrl "github.com/juicedata/juicefs-csi-driver/pkg/controller"
Expand All @@ -47,18 +49,20 @@ func NewPodManager() (*PodManager, error) {
return nil, err
}
mgr, err := ctrl.NewManager(conf, ctrl.Options{
Scheme: scheme,
Port: 9442,
MetricsBindAddress: "0.0.0.0:8082",
LeaderElectionID: "pod.juicefs.com",
NewCache: cache.BuilderWithOptions(cache.Options{
Scheme: scheme,
Metrics: metricsserver.Options{
BindAddress: "0.0.0.0:8082",
},
LeaderElectionResourceLock: "leases",
LeaderElectionID: "pod.juicefs.com",
Cache: cache.Options{
Scheme: scheme,
SelectorsByObject: cache.SelectorsByObject{
ByObject: map[client.Object]cache.ByObject{
&corev1.Pod{}: {
Label: labels.SelectorFromSet(labels.Set{common.PodTypeKey: common.PodTypeValue}),
},
},
}),
},
})
if err != nil {
log.Error(err, "New pod controller error")
Expand Down
21 changes: 14 additions & 7 deletions cmd/app/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/juicedata/juicefs-csi-driver/pkg/common"
"github.com/juicedata/juicefs-csi-driver/pkg/config"
Expand All @@ -49,22 +52,26 @@ func NewWebhookManager(certDir string, webhookPort int, leaderElection bool,
}

mgr, err := ctrl.NewManager(cfg, ctrl.Options{
Scheme: scheme,
Port: webhookPort,
CertDir: certDir,
MetricsBindAddress: "0.0.0.0:8084",
WebhookServer: webhook.NewServer(webhook.Options{
Port: webhookPort,
CertDir: certDir,
}),
Scheme: scheme,
Metrics: metricsserver.Options{
BindAddress: "0.0.0.0:8084",
},
LeaderElection: leaderElection,
LeaderElectionID: "webhook.juicefs.com",
LeaderElectionNamespace: leaderElectionNamespace,
LeaseDuration: &leaderElectionLeaseDuration,
NewCache: cache.BuilderWithOptions(cache.Options{
Cache: cache.Options{
Scheme: scheme,
SelectorsByObject: cache.SelectorsByObject{
ByObject: map[client.Object]cache.ByObject{
&corev1.Pod{}: {
Label: labels.SelectorFromSet(labels.Set{common.InjectSidecarDone: common.True}),
},
},
}),
},
})

if err != nil {
Expand Down
12 changes: 7 additions & 5 deletions cmd/dashboard/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/cache"

"github.com/juicedata/juicefs-csi-driver/pkg/dashboard"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
)

func init() {
Expand Down Expand Up @@ -201,15 +202,16 @@ func getLocalConfig() (*rest.Config, error) {

func newManager(conf *rest.Config) (ctrl.Manager, error) {
return ctrl.NewManager(conf, ctrl.Options{
Scheme: scheme,
Port: 9442,
MetricsBindAddress: "0.0.0.0:8082",
Scheme: scheme,
Metrics: metricsserver.Options{
BindAddress: "0.0.0.0:8082",
},
LeaderElection: leaderElection,
LeaderElectionID: "dashboard.juicefs.com",
LeaderElectionNamespace: leaderElectionNamespace,
LeaseDuration: &leaderElectionLeaseDuration,
NewCache: cache.BuilderWithOptions(cache.Options{
Cache: cache.Options{
Scheme: scheme,
}),
},
})
}
2 changes: 1 addition & 1 deletion dashboard-ui-v2/src/components/upgrade-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const UpgradeModal: React.FC<{
onMessage: async (msg) => {
setData((prev) => prev + msg.data)
if (msg.data.includes('SUCCESS Upgrade mount pod and recreate one: ')) {
const regex = /SUCCESS Upgrade mount pod and recreate one: (.+)"/
const regex = /SUCCESS Upgrade mount pod and recreate one: ([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)"/
const match = msg.data.match(regex)

if (match && match[1]) {
Expand Down
30 changes: 17 additions & 13 deletions docker/csi.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.20-buster AS builder
FROM golang:1.22-alpine AS csi-builder
ARG GOPROXY
ARG TARGETARCH

WORKDIR /workspace
COPY --from=project **/*.go ./
COPY --from=project cmd ./cmd
COPY --from=project pkg ./pkg
COPY --from=project go.mod .
COPY --from=project go.sum .
COPY --from=project .git .
COPY --from=project Makefile .
ENV GOPROXY=${GOPROXY:-https://proxy.golang.org}
RUN make

FROM golang:1.20-buster AS juicefs-builder
ARG GOPROXY
ARG TARGETARCH
ARG JUICEFS_REPO_URL=https://github.com/juicedata/juicefs
Expand All @@ -28,18 +42,8 @@ RUN bash -c "if [[ '${TARGETARCH}' == amd64 ]]; then mkdir -p /home/travis/.m2 &
wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add - && \
echo deb https://download.ceph.com/debian-15.2.17/ buster main | tee /etc/apt/sources.list.d/ceph.list && \
apt-get update && apt-get install -y uuid-dev libglusterfs-dev glusterfs-common librados2 librados-dev upx-ucl; fi"

WORKDIR /workspace
COPY --from=project **/*.go ./
COPY --from=project cmd ./cmd
COPY --from=project pkg ./pkg
COPY --from=project go.mod .
COPY --from=project go.sum .
COPY --from=project .git .
COPY --from=project Makefile .
ENV GOPROXY=${GOPROXY:-https://proxy.golang.org}
RUN apt-get update && apt-get install -y musl-tools
RUN make
# build juicefs
RUN cd /workspace && git clone --branch=$JUICEFS_REPO_BRANCH $JUICEFS_REPO_URL && \
cd juicefs && git checkout $JUICEFS_REPO_REF && \
Expand Down Expand Up @@ -85,8 +89,8 @@ RUN jfs_mount_path=${JFS_MOUNT_PATH} && \
bash -c "mkdir -p /usr/local/juicefs/mount; if [[ '${TARGETARCH}' == amd64 ]]; then cp Linux/mount.ceph $jfs_mount_path; else cp Linux/mount.aarch64 $jfs_mount_path; fi;" && \
chmod +x ${jfs_mount_path} && cp juicefs.py ${JUICEFS_CLI} && chmod +x ${JUICEFS_CLI}

COPY --from=builder /workspace/bin/juicefs-csi-driver /usr/local/bin/
COPY --from=builder /workspace/juicefs/juicefs /usr/local/bin/
COPY --from=csi-builder /workspace/bin/juicefs-csi-driver /usr/local/bin/
COPY --from=juicefs-builder /workspace/juicefs/juicefs /usr/local/bin/

RUN ln -s /usr/local/bin/juicefs /bin/mount.juicefs

Expand Down
2 changes: 1 addition & 1 deletion docker/dashboard.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM golang:1.20-alpine as builder
FROM golang:1.22-alpine as builder
ARG GOPROXY
ARG HTTPS_PROXY
ARG HTTP_PROXY
Expand Down
Loading

0 comments on commit e36798c

Please sign in to comment.