Skip to content

Commit

Permalink
Update local-path-provisioner
Browse files Browse the repository at this point in the history
  • Loading branch information
kvaps committed Dec 27, 2021
1 parent ff4fb09 commit 7c06eb4
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
ARG BASE_ALPINE
FROM rancher/local-path-provisioner:v0.0.20@sha256:d5999b20a1b180940061677db3bdb48dd7eb432cd48147c4ff15469fb74ade80 as artifact
FROM $BASE_ALPINE as artifact

ARG VERSION=0.0.21
ARG COMMIT_REF=755e331a276d4dd26f84377db5504a38109df8fb

RUN apk add --no-cache go git
RUN git clone https://github.com/rancher/local-path-provisioner.git
WORKDIR /local-path-provisioner
RUN git checkout "${COMMIT_REF}"

# Do not create directory if not found (GH: #224)
COPY patches/fix-directory-or-create.patch /
RUN git apply /fix-directory-or-create.patch

RUN CGO_ENABLED=0 go build -ldflags "-X main.VERSION=${VERSION} -extldflags -static -s -w" -o /local-path-provisioner

FROM $BASE_ALPINE

Expand All @@ -10,6 +24,6 @@ RUN apk add --no-cache ca-certificates \
blkid \
e2fsprogs-extra

COPY --from=artifact /usr/bin/local-path-provisioner /usr/bin/local-path-provisioner
COPY --from=artifact /local-path-provisioner /usr/bin/local-path-provisioner

ENTRYPOINT ["/usr/bin/local-path-provisioner"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Patches

## Fix DirectoryOrCreate

Use `type: Directory` instead of `type: DirectoryOrCreate` for created PVs
to avoid the situations when initial storage is broken and unmounted.
https://github.com/rancher/local-path-provisioner/pull/224
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/provisioner.go b/provisioner.go
index b6591d0..be1aa9b 100644
--- a/provisioner.go
+++ b/provisioner.go
@@ -215,7 +215,7 @@ func (p *LocalPathProvisioner) Provision(opts pvController.ProvisionOptions) (*v
}

fs := v1.PersistentVolumeFilesystem
- hostPathType := v1.HostPathDirectoryOrCreate
+ hostPathType := v1.HostPathDirectory

valueNode, ok := node.GetLabels()[KeyNode]
if !ok {

0 comments on commit 7c06eb4

Please sign in to comment.