Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 1 | |
Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 2 | ============ |
| 3 | Helm formula |
| 4 | ============ |
Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 5 | |
Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 6 | This formula installs Helm client, installs Tiller on Kubernetes cluster and |
tmeneau | d92f474 | 2017-10-18 09:57:19 -0400 | [diff] [blame] | 7 | manages releases in it. |
| 8 | |
Omer Katz | dc445fb | 2017-11-21 16:03:44 +0200 | [diff] [blame] | 9 | Available States |
tmeneau | d92f474 | 2017-10-18 09:57:19 -0400 | [diff] [blame] | 10 | =============== |
| 11 | |
| 12 | The default state applied by this formula (e.g. if just applying `helm`) will |
| 13 | apply the `helm.releases_managed` state. |
| 14 | |
Petr Michalec | 2d9dca9 | 2017-11-14 09:00:09 +0100 | [diff] [blame] | 15 | .. note:: For backward compatibility till release 2.0 was kept the state client.sls, |
| 16 | which just re-call the helm.release_managed |
| 17 | |
tmeneau | d92f474 | 2017-10-18 09:57:19 -0400 | [diff] [blame] | 18 | `kubectl_installed` |
| 19 | ------------------ |
| 20 | |
| 21 | Optionally installs the kubectl binary per the configured pillar values, |
Petr Michalec | 2d9dca9 | 2017-11-14 09:00:09 +0100 | [diff] [blame] | 22 | such as the version of `kubectl` to install and the path where the binary should |
tmeneau | d92f474 | 2017-10-18 09:57:19 -0400 | [diff] [blame] | 23 | be installed. |
| 24 | |
| 25 | `kubectl_configured` |
| 26 | ------------------ |
| 27 | |
| 28 | Manages a kubectl configuration file and gce_token json file per the configured |
| 29 | pillar values. Note that the available configuration values allow the path of |
| 30 | the kube config file to be placed at a different location than the default |
| 31 | installation path; this is recommended to avoid confusion if the kubectl |
| 32 | binary on the minion might be manually used with multiple contexts. |
| 33 | |
| 34 | **includes**: |
| 35 | * `kubectl_installed` |
| 36 | |
| 37 | `client_installed` |
| 38 | ------------------ |
| 39 | |
| 40 | Installs the helm client binary per the configured pillar values, such as where |
| 41 | helm home should be, which version of the helm binary to install and that path |
| 42 | for the helm binary. |
| 43 | |
| 44 | **includes**: |
| 45 | * `kubectl_installed |
| 46 | |
| 47 | `tiller_installed` |
| 48 | ------------------ |
| 49 | |
Petr Michalec | 2d9dca9 | 2017-11-14 09:00:09 +0100 | [diff] [blame] | 50 | Optionally installs a Tiller deployment to the Kubernetes cluster per the |
tmeneau | d92f474 | 2017-10-18 09:57:19 -0400 | [diff] [blame] | 51 | `helm:client:tiller:install` pillar value. If the pillar value is set to |
| 52 | install tiller to the cluster, the version of the tiller installation will |
| 53 | match the version of the Helm client installed per the `helm:client:version` |
| 54 | configuration parameter |
| 55 | |
| 56 | **includes**: |
| 57 | * `client_installed` |
| 58 | * `kubectl_configured` |
| 59 | |
| 60 | `repos_managed` |
| 61 | ------------------ |
| 62 | |
| 63 | Ensures the repositories configured per the pillar (and only those repositories) |
| 64 | are registered at the configured helm home, and synchronizes the local cache |
| 65 | with the remote repository with each state execution. |
| 66 | |
| 67 | **includes**: |
| 68 | * `client_installed` |
| 69 | |
| 70 | `releases_managed` |
| 71 | ------------------ |
| 72 | |
| 73 | Ensures the releases configured with the pillar are in the expected state with |
| 74 | the Kubernetes cluster. This state includes change detection to determine |
| 75 | whether the pillar configurations match the release's state in the cluster. |
| 76 | |
| 77 | Note that changes to an existing release's namespace will trigger a deletion and |
| 78 | re-installation of the release to the cluster. |
| 79 | |
| 80 | **includes**: |
| 81 | * `client_installed` |
| 82 | * `tiller_installed` |
| 83 | * `kubectl_configured` |
| 84 | * `repos_managed` |
| 85 | |
| 86 | Availale Modules |
| 87 | =============== |
| 88 | |
| 89 | To view documentation on the available modules, run: |
| 90 | |
| 91 | `salt '{{ tgt }}' sys.doc helm` |
Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 92 | |
Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 93 | |
Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 94 | Sample pillars |
| 95 | ============== |
| 96 | |
tmeneau | 42a2ccd | 2017-11-01 13:55:49 -0400 | [diff] [blame] | 97 | See the [default reclass pillar configuration](metadata/service/client.yml) for |
| 98 | a documented example pillar file. |
tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 99 | |
| 100 | Example Configurations |
| 101 | ====================== |
| 102 | |
| 103 | _The following examples demonstrate configuring the formula for different |
| 104 | use cases._ |
| 105 | |
tmeneau | 0f7e6d4 | 2017-10-16 17:18:29 -0400 | [diff] [blame] | 106 | The default pillar configuration will install the helm client on the target |
| 107 | node, and Tiller to the Kubernetes cluster (assuming kubectl config or local |
| 108 | cluster endpoint have already been configured. |
Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 109 | |
| 110 | Change version of helm being downloaded and installed: |
| 111 | |
| 112 | .. code-block:: yaml |
| 113 | |
| 114 | helm: |
| 115 | client: |
tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 116 | version: 2.6.0 # defaults to 2.6.2 currently |
Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 117 | download_hash: sha256=youneedtocalculatehashandputithere |
| 118 | |
| 119 | Don't install tiller and use existing one exposed on some well-known address: |
| 120 | |
| 121 | .. code-block:: yaml |
| 122 | |
| 123 | helm: |
| 124 | client: |
| 125 | tiller: |
| 126 | install: false |
| 127 | host: 10.11.12.13:14151 |
| 128 | |
| 129 | Change namespace where tiller is isntalled and looked for: |
| 130 | |
| 131 | .. code-block:: yaml |
| 132 | |
| 133 | helm: |
| 134 | client: |
| 135 | tiller: |
| 136 | namespace: not-kube-system # kube-system is default |
| 137 | |
| 138 | Install Mirantis repository and deploy zookeper chart from it: |
| 139 | |
| 140 | .. code-block:: yaml |
| 141 | |
| 142 | helm: |
| 143 | client: |
| 144 | repos: |
| 145 | mirantisworkloads: https://mirantisworkloads.storage.googleapis.com/ |
| 146 | releases: |
| 147 | zoo1: |
| 148 | name: my-zookeeper |
| 149 | chart: mirantisworkloads/zookeeper # we reference installed repo |
| 150 | version: 1.2.0 # select any available version |
| 151 | values: |
| 152 | logLevel: INFO # any values used by chart can specified here |
| 153 | |
| 154 | Delete that release: |
| 155 | |
| 156 | .. code-block:: yaml |
| 157 | |
| 158 | helm: |
| 159 | client: |
| 160 | repos: |
| 161 | mirantisworkloads: https://mirantisworkloads.storage.googleapis.com/ |
| 162 | releases: |
| 163 | zoo1: |
| 164 | enabled: false |
| 165 | |
| 166 | Install kubectl and manage remote cluster: |
| 167 | |
| 168 | .. code-block:: yaml |
| 169 | |
| 170 | helm: |
| 171 | client: |
| 172 | kubectl: |
| 173 | install: true # installs kubectl 1.6.7 by default |
| 174 | config: |
tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 175 | # directly translated to cluster definition in kubeconfig |
| 176 | cluster: |
Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 177 | server: https://kubernetes.example.com |
| 178 | certificate-authority-data: base64_of_ca_certificate |
tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 179 | cluster_name: kubernetes.example |
| 180 | # directly translated to user definition in kubeconfig |
| 181 | user: |
Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 182 | username: admin |
| 183 | password: uberadminpass |
tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 184 | user_name: admin |
Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 185 | |
| 186 | Change kubectl download URL and use it with GKE-based cluster: |
| 187 | |
| 188 | .. code-block:: yaml |
| 189 | |
| 190 | helm: |
| 191 | client: |
| 192 | kubectl: |
| 193 | install: true |
| 194 | download_url: https://dl.k8s.io/v1.6.7/kubernetes-client-linux-amd64.tar.gz |
| 195 | download_hash: sha256=calculate_hash_here |
| 196 | config: |
tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 197 | # directly translated to cluster definition in kubeconfig |
| 198 | cluster: |
Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 199 | server: https://3.141.59.265 |
| 200 | certificate-authority-data: base64_of_ca_certificate |
tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 201 | # directly translated to user definition in kubeconfig |
Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 202 | user: |
| 203 | auth-provider: |
| 204 | name: gcp |
tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 205 | user_name: gce_user |
Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 206 | gce_service_token: base64_of_json_token_downloaded_from_cloud_console |
Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 207 | |
tmeneau | d92f474 | 2017-10-18 09:57:19 -0400 | [diff] [blame] | 208 | Known Issues |
| 209 | ============ |
| 210 | |
| 211 | 1. Unable to remove all user supplied values |
| 212 | |
| 213 | If a release previously has had user supplied value overrides (via the |
| 214 | release's `values` key in the pillar), subsequently removing all `values` |
| 215 | overrides (so that there is no more `values` key for the release in the |
| 216 | pillar) will not actually update the Helm deployment. To get around this, |
| 217 | specify a fake key/value pair in the release's pillar; Tiller will override |
| 218 | all previously user-supplied values with the new fake key and value. For |
| 219 | example: |
| 220 | |
| 221 | |
| 222 | .. code-block:: yaml |
| 223 | helm: |
| 224 | client: |
| 225 | releases: |
| 226 | zoo1: |
| 227 | enabled: true |
| 228 | ... |
| 229 | values: |
| 230 | fake_key: fake_value |
| 231 | |
Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 232 | |
Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 233 | More Information |
| 234 | ================ |
Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 235 | |
Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 236 | * https://github.com/kubernetes/charts |
| 237 | * https://fabric8.io/helm/ |
Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 238 | |
| 239 | |
Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 240 | Documentation and Bugs |
| 241 | ====================== |
Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 242 | |
Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 243 | To learn how to install and update salt-formulas, consult the documentation |
| 244 | available online at: |
Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 245 | |
Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 246 | http://salt-formulas.readthedocs.io/ |
| 247 | |
| 248 | In the unfortunate event that bugs are discovered, they should be reported to |
| 249 | the appropriate issue tracker. Use Github issue tracker for specific salt |
| 250 | formula: |
| 251 | |
| 252 | https://github.com/salt-formulas/salt-formula-helm/issues |
| 253 | |
| 254 | For feature requests, bug reports or blueprints affecting entire ecosystem, |
| 255 | use Launchpad salt-formulas project: |
| 256 | |
| 257 | https://launchpad.net/salt-formulas |
| 258 | |
| 259 | You can also join salt-formulas-users team and subscribe to mailing list: |
| 260 | |
| 261 | https://launchpad.net/~salt-formulas-users |
| 262 | |
| 263 | Developers wishing to work on the salt-formulas projects should always base |
| 264 | their work on master branch and submit pull request against specific formula. |
| 265 | |
| 266 | https://github.com/salt-formulas/salt-formula-home-assistant |
| 267 | |
| 268 | Any questions or feedback is always welcome so feel free to join our IRC |
| 269 | channel: |
| 270 | |
| 271 | #salt-formulas @ irc.freenode.net |