diff --git a/Dockerfile b/Dockerfile index de1c29e..c54f887 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,14 +18,8 @@ ARG SRC=github.com/k8snetworkplumbingwg/multus-cni ARG PKG=github.com/k8snetworkplumbingwg/multus-cni RUN git clone --depth=1 https://${SRC}.git $GOPATH/src/${PKG} WORKDIR $GOPATH/src/${PKG} -# patch to solve https://github.com/rancher/rke2/issues/4568 -# to be removed once upstream merges the fix -# https://github.com/k8snetworkplumbingwg/multus-cni/pull/1137 -COPY self_delegation_bug.patch /tmp - RUN git fetch --all --tags --prune && \ - git checkout tags/${TAG} -b ${TAG} && \ - git apply /tmp/self_delegation_bug.patch + git checkout tags/${TAG} -b ${TAG} RUN go mod download # cross-compilation setup ARG TARGETARCH diff --git a/self_delegation_bug.patch b/self_delegation_bug.patch deleted file mode 100644 index 7e07b13..0000000 --- a/self_delegation_bug.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/cmd/thin_entrypoint/main.go b/cmd/thin_entrypoint/main.go -index ac721518..3f0e835f 100644 ---- a/cmd/thin_entrypoint/main.go -+++ b/cmd/thin_entrypoint/main.go -@@ -23,7 +23,9 @@ import ( - "fmt" - "io" - "os" -+ "path" - "path/filepath" -+ "regexp" - "strings" - "text/template" - "time" -@@ -294,7 +296,20 @@ func (o *Options) createMultusConfig() (string, error) { - return "", fmt.Errorf("cannot find master CNI config in %q: %v", o.MultusAutoconfigDir, err) - } - -- masterConfigPath := files[0] -+ var masterConfigPath string -+ // skip existing multus configuration file to avoid creating a situation -+ // where multus delegates to itself and breaks pod networking -+ multusRegexp, err := regexp.Compile("multus") -+ if err != nil { -+ return "", fmt.Errorf("regexp compilation failed: %v", err) -+ } -+ for _, filename := range files { -+ if !multusRegexp.MatchString(path.Base(filename)) { -+ masterConfigPath = filename -+ break -+ } -+ } -+ - masterConfigBytes, err := os.ReadFile(masterConfigPath) - if err != nil { - return "", fmt.Errorf("cannot read master CNI config file %q: %v", masterConfigPath, err)