Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

device manager tests + kustomize support for end-users #473

Merged
merged 7 commits into from
Nov 26, 2019
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -159,26 +159,6 @@ pipeline {
}
}

stage('make dm-test') {
options {
timeout(time: 30, unit: "MINUTES")
}

steps {
sh "docker run --rm ${DockerBuildArgs()} \
--privileged=true \
-e TEST_CHECK_SIGNED_FILES=false \
-e TEST_DISTRO=clear \
-e TEST_DISTRO_VERSION=${env.CLEAR_LINUX_VERSION_1_15} \
-v `pwd`:`pwd`:rshared \
-w `pwd` \
${env.BUILD_IMAGE} bash -c 'set -x; \
swupd bundle-add openssh-client && \
make run_dm_tests; \
make stop'"
}
}

stage('Build test image') {
options {
timeout(time: 60, unit: "MINUTES")
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ _work/kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz:

_work/kustomize: _work/kustomize_${KUSTOMIZE_VERSION}_linux_amd64.tar.gz
tar xzf $< -C _work
touch $@

# We generate deployment files with kustomize and include the output
# in the git repo because not all users will have kustomize or it
Expand Down Expand Up @@ -172,6 +173,12 @@ KUSTOMIZATION_deploy/common/pmem-storageclass-late-binding.yaml = deploy/kustomi
kustomize: $(KUSTOMIZE_OUTPUT)
$(KUSTOMIZE_OUTPUT): _work/kustomize $(KUSTOMIZE_INPUT)
$< build --load_restrictor none $(KUSTOMIZATION_$@) >$@
if echo "$@" | grep -q '/pmem-csi-'; then \
dir=$$(echo "$@" | tr - / | sed -e 's;kubernetes/;kubernetes-;' -e 's/.yaml//' -e 's;/pmem/csi/;/;') && \
mkdir -p $$dir && \
cp $@ $$dir/pmem-csi.yaml && \
echo 'resources: [ pmem-csi.yaml ]' > $$dir/kustomization.yaml; \
fi

# Always re-generate the output files because "git rebase" might have
# left us with an inconsistent state.
Expand Down
72 changes: 53 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -614,20 +614,49 @@ For example, to deploy for production with LVM device mode onto Kubernetes 1.14,
```

These variants were generated with
`[kustomize](https://github.com/kubernetes-sigs/kustomize)`. It is
possible to customize these variants further with `kustomize`, but one
has to use a version which supports the `--load_restrictor none` parameter.
The `Makefile` can be used to build a suitable `kustomize`:

``` sh
$ make kustomize # builds the binary and re-generates .yaml files
...
go get sigs.k8s.io/kustomize@e42933ec54ce9a65f65e125a1ccf482927f0e515 && \
go build -o /work/gopath/src/github.com/intel/pmem-csi/_work/kustomize-e42933ec54ce9a65f65e125a1ccf482927f0e515 sigs.k8s.io/kustomize
...
$ _work/kustomize build --load_restrictor none deploy/kustomize/kubernetes-1.14-lvm |
kubectl create -f -
```
`[kustomize](https://github.com/kubernetes-sigs/kustomize)`.
`kubectl` >= 1.14 includes some support for that. The sub-directories
of `deploy/kubernetes-<kubernetes version>` can be used as bases
for `kubectl kustomize`. For example:

- Change namespace:
```
$ mkdir -p my-pmem-csi-deployment
$ cat >my-pmem-csi-deployment/kustomization.yaml <<EOF
namespace: pmem-csi
bases:
- ../deploy/kubernetes-1.14/lvm
EOF
$ kubectl create namespace pmem-csi
$ kubectl create --kustomize my-pmem-csi-deployment
```

- Configure how much PMEM is used by PMEM-CSI for LVM
(see [Namespace modes in LVM device mode](#namespace-modes-in-lvm-device-mode)):
```
$ mkdir -p my-pmem-csi-deployment
$ cat >my-pmem-csi-deployment/kustomization.yaml <<EOF
bases:
- ../deploy/kubernetes-1.14/lvm
patchesJson6902:
- target:
group: apps
version: v1
kind: DaemonSet
name: pmem-csi-node
path: lvm-parameters-patch.yaml
EOF
$ cat >my-pmem-csi-deployment/lvm-parameters-patch.yaml <<EOF
# pmem-ns-init is in the init container #0. Append arguments at the end.
- op: add
path: /spec/template/spec/initContainers/0/args/-
value: "--useforfsdax=90"
- op: add
path: /spec/template/spec/initContainers/0/args/-
value: "--useforsector=0"
EOF
$ kubectl create --kustomize my-pmem-csi-deployment
```

- **Wait until all pods reach 'Running' status**

Expand Down Expand Up @@ -721,23 +750,28 @@ one with ext4-format and another with xfs-format file system.
PMEM-CSI can create a namespace in the *sector* (alias safe) mode instead of default *fsdax* mode. See [Persistent Memory Programming](https://pmem.io/ndctl/ndctl-create-namespace.html) for more details about namespace modes. The main difference in PMEM-CSI context is that a sector-mode volume will not get 'dax' mount option. The deployment examples do not describe sector mode to keep the amount of combinations smaller. Here are the changes to be made to deploy volumes in sector mode:

- add `nsmode: "sector"` line in parameters section in the storageclass definition file pmem-storageclass-XYZ.yaml:
```
```
parameters:
csi.storage.k8s.io/fstype: ext4
eraseafter: "true"
nsmode: "sector" <-- add this
```
```

* Only if using LVM device mode: Modify pmem-ns-init options to create sector-mode pools in addition to fsdax-mode pools. Add `-useforfsdax` and `-useforsector` options to pmem-ns-init arguments in pmem-csi-lvm.yaml: (select the percentage values that fit your needs)
```
* Only if using LVM device mode: Modify pmem-ns-init options to create sector-mode pools in addition to fsdax-mode pools. Add `-useforfsdax` and `-useforsector` options to pmem-ns-init arguments in pmem-csi-lvm.yaml (select the percentage values that fit your needs):
```
initContainers:
- args:
- -v=3
- -useforfsdax=60 <-- add this
- -useforsector=40 <-- add this
command:
- /go/bin/pmem-ns-init
```
```

This change can be made either by copying and editing a deployment
yaml file or on-the-fly with `kustomize` as explained in [Run
PMEM-CSI on Kubernetes](#run-pmem-csi-on-kubernetes).


#### Note about raw block volumes

Expand Down
1 change: 1 addition & 0 deletions deploy/kubernetes-1.14/direct/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resources: [ pmem-csi.yaml ]
Loading