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