Skip to content

Commit

Permalink
deploy: remove cluster-driver-registrar, use kustomize
Browse files Browse the repository at this point in the history
Developers are expected to modify the files under deploy/kustomize
instead of deploy/kubernetes-1.13/pmem-csi-direct.yaml and
deploy/kubernetes-1.13/pmem-csi-lvm.yaml, then run "make kustomize".
Users deploy exactly as before.

This solves several issues:
- the RBAC rules are derived automatically from the upstream files,
  with documented transformations
- reduced code duplication
- clear definition of what distinguishes the different variants
- opens the path towards adding more variants or kustomization (sic!)
  by admins

"pmem-csi-" is used as prefix more often than just "pmem-". The goal
is reserve "pmem-" for anything related to PMEM and "pmem-csi-" for
the driver.

cluster-driver-registrar gets removed. It has been deprecated
upstream in favor of creating the CRD objects as part of the
installation.
  • Loading branch information
pohly committed Apr 18, 2019
1 parent 91969e8 commit 6037be5
Show file tree
Hide file tree
Showing 24 changed files with 1,207 additions and 388 deletions.
35 changes: 35 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,38 @@ clean:
include test/clear-kvm.make
include test/start-stop.make
include test/test.make



# We generate deployment files with kustomize and include the output
# in the git repo because not all users will have kustomize or it
# might be an unsuitable version. When any file changes, update the
# output.
KUSTOMIZE_INPUT := $(shell find deploy/kustomize -type f)
KUSTOMIZE_OUTPUT :=
KUSTOMIZE_OUTPUT += deploy/kubernetes-1.13/pmem-csi-direct.yaml
KUSTOMIZATION_deploy/kubernetes-1.13/pmem-csi-direct.yaml = deploy/kustomize/kubernetes-1.13-direct
KUSTOMIZE_OUTPUT += deploy/kubernetes-1.13/pmem-csi-lvm.yaml
KUSTOMIZATION_deploy/kubernetes-1.13/pmem-csi-lvm.yaml = deploy/kustomize/kubernetes-1.13-lvm
kustomize: $(KUSTOMIZE_OUTPUT)
$(KUSTOMIZE_OUTPUT): _work/kustomize $(KUSTOMIZE_INPUT)
$< build $(KUSTOMIZATION_$@) >$@

# Build kustomize at a certain revision. Depends on go >= 1.12
# because we use module support.
KUSTOMIZE_VERSION=177297c0efb92ec2d7eea8f20c65c1d11c6ae7ef
_work/kustomize: _work/.kustomize-$(KUSTOMIZE_VERSION)-stamp
_work/.kustomize-$(KUSTOMIZE_VERSION)-stamp:
tmpdir=`mktemp -d` && \
trap 'rm -r $$tmpdir' EXIT && \
cd $$tmpdir && \
echo "module foo" >go.mod && \
go get sigs.k8s.io/kustomize@$(KUSTOMIZE_VERSION) && \
go build -o $(abspath _work/kustomize) sigs.k8s.io/kustomize && \
touch --reference=$(abspath _work/kustomize) $(abspath $@)

PHONY: clean-kustomize
clean: clean-kustomize
clean-kustomize:
rm -f _work/kustomize
rm -f _work/.kustomize-$(KUSTOMIZE_VERSION)-stamp
Loading

0 comments on commit 6037be5

Please sign in to comment.