Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Fix Deployment apiVersion #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore

This file was deleted.

14 changes: 11 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
FROM scratch
COPY hostpath-provisioner /
CMD ["/hostpath-provisioner"]
FROM golang:1.16-alpine as builder
RUN apk add --no-cache git
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY ./hostpath-provisioner.go ./hpp.go
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -ldflags '-extldflags "-static" -s -w' -o ./hpp

FROM alpine
COPY --from=builder /build/hpp /
ENTRYPOINT [ "/hpp" ]
15 changes: 3 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

REPOSITORY ?= torchbox/k8s-hostpath-provisioner
REPOSITORY ?= owps/k8s-hostpath-provisioner
TAG ?= latest
IMAGE = ${REPOSITORY}:${TAG}

image: hostpath-provisioner
image:
docker build -t $(IMAGE) -f Dockerfile .

vendor:
glide install -v

hostpath-provisioner: hostpath-provisioner.go
CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o hostpath-provisioner .

clean:
rm hostpath-provisioner

.PHONY: clean vendor image
.PHONY: image
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
Kubernetes hostpath provisioner
===============================

SOURCES
----------

The source of project is https://github.com/torchbox/k8s-hostpath-provisioner, The above project is deprecated and uses libraries that no longer work with newer versions of k8s

Changes based on:
* https://github.com/RoRu/k8s-hostpath-provisioner
* https://github.com/xplodwild/k8s-hostpath-provisioner

Changes implements using sigs.k8s.io/sig-storage-lib-external-provisioner according to example examples/hostpath-provisioner/hostpath-provisioner.go

I changed the sig-storage-lib-external-provisioner version to v7, the newest one at the moment, and added the code to it and changed storage.k8s.io/v1beta1 to storage.k8s.io/v1 (p.client.StorageV1 ())

Image pusher to owps/k8s-hostpath-provisioner on dockerhub.com

Example deployment manifest in example-deployment.yaml

Original documentation below:

ORGINAL
----------

This is a Persistent Volume Claim (PVC) provisioner for Kubernetes. It
dynamically provisions hostPath volumes to provide storage for PVCs. It is
based on the
Expand Down
111 changes: 0 additions & 111 deletions deployment.yaml

This file was deleted.

112 changes: 112 additions & 0 deletions example-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
apiVersion: v1
kind: Namespace
metadata:
name: ps-gfs
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: hostpath-provisioner
namespace: ps-gfs
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: hostpath-provisioner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
verbs: ["get", "list", "watch"]
- apiGroups: ["storage.k8s.io"]
resources: ["storageclasses"]
verbs: ["get", "list", "watch"]
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "update", "patch"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: hostpath-provisioner
subjects:
- kind: ServiceAccount
name: hostpath-provisioner
namespace: ps-gfs
roleRef:
kind: ClusterRole
name: hostpath-provisioner
apiGroup: rbac.authorization.k8s.io
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-hostpath-provisioner
namespace: ps-gfs
rules:
- apiGroups: [""]
resources: ["endpoints"]
verbs: ["get", "update", "patch", "list", "watch", "create"]
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: leader-locking-hostpath-provisioner
namespace: ps-gfs
subjects:
- kind: ServiceAccount
name: hostpath-provisioner
namespace: ps-gfs
roleRef:
kind: Role
name: leader-locking-hostpath-provisioner
apiGroup: rbac.authorization.k8s.io

---

apiVersion: apps/v1
kind: Deployment
metadata:
name: hostpath-provisioner
namespace: ps-gfs
spec:
replicas: 1
selector:
matchLabels:
app: hostpath-provisioner
strategy:
type: Recreate
template:
metadata:
labels:
app: hostpath-provisioner
spec:
serviceAccountName: hostpath-provisioner
volumes:
- name: volumes
hostPath:
path: /mnt/gfs
containers:
- name: hostpath-provisioner
imagePullPolicy: Always
image: owps/k8s-hostpath-provisioner
volumeMounts:
- name: volumes
mountPath: /mnt/gfs
resources:
limits:
cpu: 100m
memory: 64Mi
requests:
cpu: 100m
memory: 64Mi
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gfs
provisioner: torchbox.com/hostpath
parameters:
pvDir: /mnt/gfs
Loading