Skip to content

Commit

Permalink
deploy: sidecar versions from .yaml
Browse files Browse the repository at this point in the history
Picking the RBAC rules from a release branch is not quite accurate (we
want the rules released together with the tagged version) and is
something that must be kept in sync manually.

It is better to not hard-code this in the script and instead get the
exact versions from the .yaml files.

There should be no need for users to pass parameters to the script, so
let's just mention that this is possible without going into details in
the README.md. The previous instructions were out-dated, too.
  • Loading branch information
pohly committed Jan 21, 2019
1 parent 76766f1 commit 557d126
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
21 changes: 7 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ The easiest way to test the Hostpath driver is to run `deploy/deploy-hostpath.sh
$ sh deploy/deploy-hostpath.sh
```

Or, if you want to override the version

```shell
$ K8S_RELEASE=1.14 CSI_RELEASE=1.0.1 sh deploy/deploy-hostpath.sh
```

You should see an output similar to the following printed on the terminal showing the application of rbac rules and the result of deploying the hostpath driver, external privisioner and external attacher components:

```shell
customresourcedefinition.apiextensions.k8s.io/csidrivers.csi.storage.k8s.io created
customresourcedefinition.apiextensions.k8s.io/csinodeinfos.csi.storage.k8s.io created
applying RBAC rules
serviceaccount/csi-provisioner created
clusterrole.rbac.authorization.k8s.io/external-provisioner-runner created
clusterrolebinding.rbac.authorization.k8s.io/csi-provisioner-role created
Expand All @@ -35,19 +28,19 @@ clusterrole.rbac.authorization.k8s.io/external-attacher-runner created
clusterrolebinding.rbac.authorization.k8s.io/csi-attacher-role created
role.rbac.authorization.k8s.io/external-attacher-cfg created
rolebinding.rbac.authorization.k8s.io/csi-attacher-role-cfg created
serviceaccount/csi-driver-registrar created
clusterrole.rbac.authorization.k8s.io/driver-registrar-runner created
clusterrolebinding.rbac.authorization.k8s.io/csi-driver-registrar-role created
deploying hostpath components
service/csi-hostpath-attacher created
statefulset.apps/csi-hostpath-attacher created
daemonset.apps/csi-hostpathplugin created
service/csi-hostpath-provisioner created
statefulset.apps/csi-hostpath-provisioner created
serviceaccount/csi-node-sa created
clusterrole.rbac.authorization.k8s.io/csi-node-sa created
clusterrolebinding.rbac.authorization.k8s.io/csi-node-sa created
```

The script can also install CRDs that are needed for alpha features,
but as this is something that should be done by the cluster
provisioning tool it is disabled in the script by default. For this
and other customizations see the source code of the deploy script.

## Run example application and validate

Next, validate the deployment. First, ensure all expected pods are running properly including the external attacher, provisioner, and the actual hostpath driver plugin:
Expand Down
17 changes: 14 additions & 3 deletions deploy/deploy-hostpath.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,22 @@
# The script assumes that kubectl is available on the OS path
# where it is executed.

set -e
set -o pipefail

function image_version () {
yaml="$1"
image="$2"

# get version from `image: quay.io/k8scsi/csi-attacher:v1.0.1`
grep "image:.*$image" "$yaml" | sed -e 's/.*:v/v/'
}

BASE_DIR=$(dirname "$0")
K8S_RELEASE=${K8S_RELEASE:-"release-1.13"}
PROVISIONER_RELEASE=${PROVISIONER_RELEASE:-"release-1.0"}
ATTACHER_RELEASE=${ATTACHER_RELEASE:-"release-1.0"}
PROVISIONER_RELEASE=${PROVISIONER_RELEASE:-$(image_version "${BASE_DIR}/hostpath/csi-hostpath-provisioner.yaml" csi-provisioner)}
ATTACHER_RELEASE=${ATTACHER_RELEASE:-$(image_version "${BASE_DIR}/hostpath/csi-hostpath-attacher.yaml" csi-attacher)}
INSTALL_CRD=${INSTALL_CRD:-"false"}
BASE_DIR=$(dirname "$0")

# apply CSIDriver and CSINodeInfo API objects
if [[ "${INSTALL_CRD}" =~ ^(y|Y|yes|true)$ ]] ; then
Expand Down

0 comments on commit 557d126

Please sign in to comment.