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

local volume provisioner: improve helm chart #789

Merged
merged 2 commits into from
Jun 13, 2018

Conversation

cofyc
Copy link
Contributor

@cofyc cofyc commented Jun 4, 2018

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 4, 2018
@cofyc cofyc force-pushed the refactor_heml_chart branch 3 times, most recently from 45ad26d to 9d704dd Compare June 4, 2018 07:54
@cofyc
Copy link
Contributor Author

cofyc commented Jun 4, 2018

/assign @msau42
/area local-volume

@cofyc cofyc force-pushed the refactor_heml_chart branch 2 times, most recently from 1a8b012 to 1db9336 Compare June 4, 2018 08:14
| common.useJobForCleaning | Is set to true, provisioner will use jobs-based block cleaning. | bool | `false` |
| common.configMapName | Provisioner ConfigMap name. | str | `local-provisioner-config` |
| classes.[n].name | StorageClass name. | str | `-` |
| classes.[n].hostDir | Path on the host where local volume of this storage class are mounted. | str | `-` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local volumes of this storage class are mounted under

| classes.[n].storageClass.reclaimPolicy | Specify reclaimPolicy of storage class, available: Delete/Retain. | str | `Delete` |
| daemonset.name | Provisioner DaemonSet name. | str | `local-volume-provisioner` |
| daemonset.image | Provisioner image. | str | `quay.io/external_storage/local-volume-provisioner:v2.1.0` |
| daemonset.imagePullPolicy | Provisioner DaemonSet image pull policy. | str | `Always` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking it may be better to just use the default imagePullPolicy if not set.

classes:
- name: local-scsi
hostDir: "/mnt/disks/by-uuid/google-local-ssds-scsi-fs"
blockCleanerCommand:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On gce/gke, we actually separate block and preformatted volumes into different directories. So this block cleaning config doesn't do anything. It may be better to put this in a baremetal example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I remove all blockCleanerCommand sections from other gce/gke example yamls? I never run kubernetes on gce/gke, could you help test these examples if possible?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I would leave it out for now and add it to the baremetal example instead. I have an issue open on me to integrate and test the block feature on gce/gke

Copy link
Contributor Author

@cofyc cofyc Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in d1d0ef9.

blockCleanerCommand:
- "/scripts/quick_reset.sh"
storageClass:
reclaimPolicy: Delete
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave out reclaim policy if you're going to use the default

@cofyc cofyc force-pushed the refactor_heml_chart branch 3 times, most recently from 7c36e01 to 616d77d Compare June 5, 2018 03:20
@cofyc
Copy link
Contributor Author

cofyc commented Jun 5, 2018

Updated in 616d77d.

  • Update docs.
  • By default, don't set imagePullPolicy (will use default kubernetes imagePullPolicy).
  • Remove gce-cleanbyjobs.yaml, add baremetal-cleanbyjobs.yaml.
  • Comment other avaialbe block cleaner commands in baremetal.yaml.
  • Leave out reclaimPolicy: Delete if we're going to use the default.

@cofyc cofyc force-pushed the refactor_heml_chart branch from 427e967 to d1d0ef9 Compare June 5, 2018 05:21
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 5, 2018
@cofyc
Copy link
Contributor Author

cofyc commented Jun 5, 2018

Add update-helm-values utility in b210c6c.

There is a problem vendoring "k8s.io/helm/pkg/chartutil" package with glide, so I simply copied utilities I need into this repo. They are all k8s code, I think it's fine to copy here. How about fixing it later?

glide up -v always fails with this error:

...
[ERROR]	Error scanning github.com/digitalocean/godo/context: cannot find package "." in:
	/home/vagrant/.glide/cache/src/https-git.luolix.top-digitalocean-godo/context
...

found a related issue here: Masterminds/glide#968

@cofyc cofyc force-pushed the refactor_heml_chart branch from 8613b32 to b210c6c Compare June 5, 2018 08:25
@@ -0,0 +1,9 @@
## update helm values
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make this directory name be explicit about the before/after versions that this tool supports?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It supports its first version to local-volume-provisioner-v2.1.0, so I renamed it to update-helm-values-pre-v2.2.0. If you have a better name, let me change to it.

common:
# Beta PV.NodeAffinity field is used by default. If running against pre-1.10
# k8s version, the `useAlphaAPI` flag must be enabled in the configMap.
useAlphaAPI: false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave out any default values.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: jobsrole
name: local-storage-provisioner
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more descriptive name could be "local-storage-provisioner-jobs-role"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

{{- range $tmp, $val := $classPath }}
{{- range $storageClass, $classConfig := $val }}
{{ $storageClass }}:
{{- range $classConfig := . -}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to put all this inline with the rest of the spec template instead of at the beginning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, I removed variables aliases which I found not necessary too. It's hard to read diff of provisioner.yaml now, you can simply check final version of provisioner.

I also added a helm chart test script here: https://github.com/cofyc/external-storage/tree/refactor_heml_chart/local-volume/helm/test

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 6, 2018
@cofyc
Copy link
Contributor Author

cofyc commented Jun 6, 2018

Updated in e6f6fe9:

  • Rename update-helm-values to update-helm-values-pre-v2.2.0
  • Add more tests in update-helm-values-pre-v2.2.0
  • Leave out any default values in examples
  • Rename role local-storage-provisioner to local-storage-provisioner-jobs-role
  • Rename rolebinding local-storage-provisioner to local-storage-provisioner-jobs-rolebinding
  • Inline all template definitions
  • Remove all template varaibles aliases
  • Add helm tests and make test-local-volume/helm

@cofyc cofyc force-pushed the refactor_heml_chart branch 4 times, most recently from 036a77f to e6f6fe9 Compare June 6, 2018 06:43
@cofyc
Copy link
Contributor Author

cofyc commented Jun 6, 2018

I missed daemonset.kubeConfigEnv configuration, pushed a new commit 3958fb0.

Copy link
Contributor

@msau42 msau42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lgtm! Please squash


{{- if $kubeConfigEnv }}
value: "{{ .Values.daemonset.image }}"
{{- if .Values.daemonset.kubeConfigEnv }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be indented?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course.

… for different environments

- Create job RBAC when necessary
- Able to create StorageClass object and configure it
- Add docs and examples for helm chart
- By default, don't set imagePullPolicy (will use default kubernetes imagePullPolicy)
- Add update-helm-values-pre-v2.2.0 for migrating helm chart values
- Inline all template definitions and remove all template varaibles aliases
@cofyc cofyc force-pushed the refactor_heml_chart branch from 3958fb0 to 4ac87aa Compare June 7, 2018 03:59
@cofyc
Copy link
Contributor Author

cofyc commented Jun 7, 2018

@msau42 Done. I squashed it into two commits:

@msau42
Copy link
Contributor

msau42 commented Jun 7, 2018

/retest

@cofyc cofyc force-pushed the refactor_heml_chart branch from 4ac87aa to cc6db8a Compare June 8, 2018 01:17
@cofyc
Copy link
Contributor Author

cofyc commented Jun 8, 2018

seems like /retest does not trigger travis rebuild, I pushed again.

@msau42
Copy link
Contributor

msau42 commented Jun 8, 2018

/lgtm
/assign @childsb

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 8, 2018
@childsb childsb merged commit b05b770 into kubernetes-retired:master Jun 13, 2018
@cofyc cofyc deleted the refactor_heml_chart branch June 14, 2018 02:14
cofyc pushed a commit to cofyc/external-storage that referenced this pull request Dec 17, 2018
local volume provisioner: improve helm chart
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/local-volume cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants