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

[local-path-provisioner] Update and build from source #478

Merged
merged 1 commit into from
Dec 31, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 {