| 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 | 42a2ccd | 2017-11-01 13:55:49 -0400 | [diff] [blame^] | 94 | See the [default reclass pillar configuration](metadata/service/client.yml) for  | 
 | 95 | a documented example pillar file. | 
| tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 96 |  | 
 | 97 | Example Configurations | 
 | 98 | ====================== | 
 | 99 |  | 
 | 100 | _The following examples demonstrate configuring the formula for different | 
 | 101 | use cases._ | 
 | 102 |  | 
| tmeneau | 0f7e6d4 | 2017-10-16 17:18:29 -0400 | [diff] [blame] | 103 | The default pillar configuration will install the helm client on the target  | 
 | 104 | node, and Tiller to the Kubernetes cluster (assuming kubectl config or local  | 
 | 105 | cluster endpoint have already been configured. | 
| Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 106 |  | 
 | 107 | Change version of helm being downloaded and installed: | 
 | 108 |  | 
 | 109 | .. code-block:: yaml | 
 | 110 |  | 
 | 111 |     helm: | 
 | 112 |       client: | 
| tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 113 |         version: 2.6.0  # defaults to 2.6.2 currently | 
| Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 114 |         download_hash: sha256=youneedtocalculatehashandputithere | 
 | 115 |  | 
 | 116 | Don't install tiller and use existing one exposed on some well-known address: | 
 | 117 |  | 
 | 118 | .. code-block:: yaml | 
 | 119 |  | 
 | 120 |     helm: | 
 | 121 |       client: | 
 | 122 |         tiller: | 
 | 123 |           install: false | 
 | 124 |           host: 10.11.12.13:14151 | 
 | 125 |  | 
 | 126 | Change namespace where tiller is isntalled and looked for: | 
 | 127 |  | 
 | 128 | .. code-block:: yaml | 
 | 129 |  | 
 | 130 |     helm: | 
 | 131 |       client: | 
 | 132 |         tiller: | 
 | 133 |           namespace: not-kube-system  # kube-system is default | 
 | 134 |  | 
 | 135 | Install Mirantis repository and deploy zookeper chart from it: | 
 | 136 |  | 
 | 137 | .. code-block:: yaml | 
 | 138 |  | 
 | 139 |     helm: | 
 | 140 |       client: | 
 | 141 |         repos: | 
 | 142 |           mirantisworkloads: https://mirantisworkloads.storage.googleapis.com/ | 
 | 143 |         releases: | 
 | 144 |           zoo1: | 
 | 145 |             name: my-zookeeper | 
 | 146 |             chart: mirantisworkloads/zookeeper  # we reference installed repo | 
 | 147 |             version: 1.2.0  # select any available version | 
 | 148 |             values: | 
 | 149 |               logLevel: INFO  # any values used by chart can specified here | 
 | 150 |  | 
 | 151 | Delete that release: | 
 | 152 |  | 
 | 153 | .. code-block:: yaml | 
 | 154 |  | 
 | 155 |     helm: | 
 | 156 |       client: | 
 | 157 |         repos: | 
 | 158 |           mirantisworkloads: https://mirantisworkloads.storage.googleapis.com/ | 
 | 159 |         releases: | 
 | 160 |           zoo1: | 
 | 161 |             enabled: false | 
 | 162 |  | 
 | 163 | Install kubectl and manage remote cluster: | 
 | 164 |  | 
 | 165 | .. code-block:: yaml | 
 | 166 |  | 
 | 167 |     helm: | 
 | 168 |       client: | 
 | 169 |         kubectl: | 
 | 170 |           install: true  # installs kubectl 1.6.7 by default | 
 | 171 |           config: | 
| tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 172 |             # directly translated to cluster definition in kubeconfig | 
 | 173 |             cluster:  | 
| Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 174 |               server: https://kubernetes.example.com | 
 | 175 |               certificate-authority-data: base64_of_ca_certificate | 
| tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 176 |             cluster_name: kubernetes.example | 
 | 177 |             # directly translated to user definition in kubeconfig | 
 | 178 |             user: | 
| Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 179 |               username: admin | 
 | 180 |               password: uberadminpass | 
| tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 181 |             user_name: admin  | 
| Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 182 |  | 
 | 183 | Change kubectl download URL and use it with GKE-based cluster: | 
 | 184 |  | 
 | 185 | .. code-block:: yaml | 
 | 186 |  | 
 | 187 |     helm: | 
 | 188 |       client: | 
 | 189 |         kubectl: | 
 | 190 |           install: true | 
 | 191 |           download_url: https://dl.k8s.io/v1.6.7/kubernetes-client-linux-amd64.tar.gz | 
 | 192 |           download_hash: sha256=calculate_hash_here | 
 | 193 |           config: | 
| tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 194 |             # directly translated to cluster definition in kubeconfig | 
 | 195 |             cluster: | 
| Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 196 |               server: https://3.141.59.265 | 
 | 197 |               certificate-authority-data: base64_of_ca_certificate | 
| tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 198 |             # directly translated to user definition in kubeconfig | 
| Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 199 |             user: | 
 | 200 |               auth-provider: | 
 | 201 |                 name: gcp | 
| tmeneau | cf41dc3 | 2017-10-16 15:23:05 -0400 | [diff] [blame] | 202 |             user_name: gce_user | 
| Yuriy Taraday | 434490c | 2017-08-22 17:40:01 +0400 | [diff] [blame] | 203 |             gce_service_token: base64_of_json_token_downloaded_from_cloud_console | 
| Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 204 |  | 
| tmeneau | d92f474 | 2017-10-18 09:57:19 -0400 | [diff] [blame] | 205 | Known Issues | 
 | 206 | ============ | 
 | 207 |  | 
 | 208 | 1. Unable to remove all user supplied values | 
 | 209 |  | 
 | 210 | If a release previously has had user supplied value overrides (via the  | 
 | 211 | release's `values` key in the pillar), subsequently removing all `values` | 
 | 212 | overrides (so that there is no more `values` key for the release in the  | 
 | 213 | pillar) will not actually update the Helm deployment. To get around this, | 
 | 214 | specify a fake key/value pair in the release's pillar; Tiller will override | 
 | 215 | all previously user-supplied values with the new fake key and value. For  | 
 | 216 | example: | 
 | 217 |  | 
 | 218 |  | 
 | 219 | .. code-block:: yaml | 
 | 220 |     helm: | 
 | 221 |       client: | 
 | 222 |         releases: | 
 | 223 |           zoo1: | 
 | 224 |             enabled: true | 
 | 225 |             ... | 
 | 226 |             values: | 
 | 227 |               fake_key: fake_value | 
 | 228 |  | 
| Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 229 |  | 
| Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 230 | More Information | 
 | 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 | * https://github.com/kubernetes/charts | 
 | 234 | * https://fabric8.io/helm/ | 
| Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 235 |  | 
 | 236 |  | 
| Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 237 | Documentation and Bugs | 
 | 238 | ====================== | 
| Yuriy Taraday | 131227e | 2017-06-22 15:09:34 +0400 | [diff] [blame] | 239 |  | 
| Ales Komarek | ba18038 | 2017-09-14 09:42:03 +0200 | [diff] [blame] | 240 | To learn how to install and update salt-formulas, consult the documentation | 
 | 241 | available online at: | 
| 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 |     http://salt-formulas.readthedocs.io/ | 
 | 244 |  | 
 | 245 | In the unfortunate event that bugs are discovered, they should be reported to | 
 | 246 | the appropriate issue tracker. Use Github issue tracker for specific salt | 
 | 247 | formula: | 
 | 248 |  | 
 | 249 |     https://github.com/salt-formulas/salt-formula-helm/issues | 
 | 250 |  | 
 | 251 | For feature requests, bug reports or blueprints affecting entire ecosystem, | 
 | 252 | use Launchpad salt-formulas project: | 
 | 253 |  | 
 | 254 |     https://launchpad.net/salt-formulas | 
 | 255 |  | 
 | 256 | You can also join salt-formulas-users team and subscribe to mailing list: | 
 | 257 |  | 
 | 258 |     https://launchpad.net/~salt-formulas-users | 
 | 259 |  | 
 | 260 | Developers wishing to work on the salt-formulas projects should always base | 
 | 261 | their work on master branch and submit pull request against specific formula. | 
 | 262 |  | 
 | 263 |     https://github.com/salt-formulas/salt-formula-home-assistant | 
 | 264 |  | 
 | 265 | Any questions or feedback is always welcome so feel free to join our IRC | 
 | 266 | channel: | 
 | 267 |  | 
 | 268 |     #salt-formulas @ irc.freenode.net |