|
| 1 | +--- |
| 2 | +page_title: "Apps & Marketplace" |
| 3 | +--- |
| 4 | + |
| 5 | +# Apps & Marketplace |
| 6 | + |
| 7 | +Apps & Marketplace is a new Rancher 2.5 feature, to manage Helm chart repositories and applications in Rancher. The feature is available at Rancher `Cluster Explorer` UI, and is controlled by 2 objects: |
| 8 | + |
| 9 | +* Repositories: These object represent helm repositories, and can be either traditional helm endpoints which have an index.yaml, or git repositories which will be cloned and can point to a specific branch. |
| 10 | +* Charts: These object represent helm charts contained at all Rancher, Partner and Custom repositories. Rancher tools such as Logging or Monitoring are included under the Rancher label |
| 11 | + |
| 12 | +More info at [Rancher Apps & Marketplace](https://rancher.com/docs/rancher/v2.x/en/helm-charts/apps-marketplace/) |
| 13 | + |
| 14 | +## New provider resources |
| 15 | + |
| 16 | +To support this new feature on this terraform provider, 2 new resources has been added: |
| 17 | +* `rancher2_catalog_v2` - To support repository object |
| 18 | +* `rancher2_app_v2` - To support chart object |
| 19 | + |
| 20 | + |
| 21 | +## rancher2_catalog_v2 |
| 22 | + |
| 23 | +This resource has the following arguments definition: |
| 24 | + |
| 25 | +* `cluster_id` - (Required/ForceNew) The cluster id of the catalog V2 (string) |
| 26 | +* `name` - (Required) The name of the catalog v2 (string) |
| 27 | +* `ca_bundle` - (Optional) PEM encoded CA bundle which will be used to validate the repo's certificate (string) |
| 28 | +* `enabled` - (Optional) If disabled the repo clone will not be updated or allowed to be installed from. Default: `true` (bool) |
| 29 | +* `git_branch` - (Optional) Git Repository branch containing Helm chart definitions. Default `master` (string) |
| 30 | +* `git_repo` - (Optional) The url of the catalog v2 repo (string) |
| 31 | +* `insecure` - (Optional) Use insecure HTTPS to download the repo's index. Default: `false` (bool) |
| 32 | +* `secret_name` - (Optional) K8s secret name to be used to connect to the repo (string) |
| 33 | +* `secret_namespace` - (Optional) K8s secret namespace (string) |
| 34 | +* `service_account` - (Optional) K8s service account used to deploy charts instead of the end users credentials (string) |
| 35 | +* `service_account_namespace` - (Optional) The username to access the catalog if needed (string) |
| 36 | +* `url` - (Optional) URL to an index generated by Helm (string) |
| 37 | +* `annotations` - (Optional/Computed) Annotations for the catalog v2 (map) |
| 38 | +* `labels` - (Optional/Computed) Labels for the catalog v2 (map) |
| 39 | + |
| 40 | +### Examples |
| 41 | + |
| 42 | +These are some examples how to use a new catalog v2: |
| 43 | + |
| 44 | +* Create new repository using git repo and branch |
| 45 | +``` |
| 46 | +resource "rancher2_catalog_v2" "foo" { |
| 47 | + cluster_id = "<CLUSTER_ID>"" |
| 48 | + name = "foo" |
| 49 | + git_repo = "<GIT_REPO_URL>" |
| 50 | + git_branch = "<GIT_BRANCH>" |
| 51 | +} |
| 52 | +``` |
| 53 | + |
| 54 | +* Create new repository using http url |
| 55 | +``` |
| 56 | +resource "rancher2_catalog_v2" "foo-url" { |
| 57 | + cluster_id = "<CLUSTER_ID>" |
| 58 | + name = "foo-url" |
| 59 | + url = "https://<CATALOG_URL>" |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +* Import existing repository |
| 64 | + |
| 65 | +``` |
| 66 | +## Define catalog at tf file |
| 67 | +resource "rancher2_catalog_v2" "rancher-charts" { |
| 68 | + cluster_id = "<CLUSTER_ID>" |
| 69 | + name = "rancher-charts" |
| 70 | + git_repo = "https://git.rancher.io/charts" |
| 71 | + git_branch = "main" |
| 72 | +} |
| 73 | +## Import the catalog v2 data to tfstate |
| 74 | +# terraform import rancher2_catalog_v2.rancher-charts rancher-charts |
| 75 | +``` |
| 76 | + |
| 77 | +* Using datasource |
| 78 | + |
| 79 | +``` |
| 80 | +data "rancher2_catalog_v2" "foo" { |
| 81 | + cluster_id = "<CLUSTER_ID>" |
| 82 | + name = "foo" |
| 83 | +} |
| 84 | +``` |
| 85 | + |
| 86 | +## rancher2_app_v2 |
| 87 | + |
| 88 | +This resource has the following arguments definition: |
| 89 | + |
| 90 | +* `cluster_id` - (Required/ForceNew) The cluster id of the app (string) |
| 91 | +* `name` - (Required/ForceNew) The name of the app v2 (string) |
| 92 | +* `namespace` - (Required/ForceNew) The namespace of the app v2 (string) |
| 93 | +* `repo_name` - (Required) Repo name (string) |
| 94 | +* `chart_name` - (Required) The app v2 chart name (string) |
| 95 | +* `chart_version` - (Optional) The app v2 chart version (string) |
| 96 | +* `project_id` - (Optional) Deploy the app v2 within project ID (string) |
| 97 | +* `values` - (Optional) The app v2 values yaml. Yaml format is required (string) |
| 98 | +* `cleanup_on_fail` - (Optional) Cleanup app v2 on failed chart upgrade. Default: `false` (bool) |
| 99 | +* `disable_hooks` - (Optional) Disable app v2 chart hooks. Default: `false` (bool) |
| 100 | +* `disable_open_api_validation` - (Optional) Disable app V2 Open API Validation. Default: `false` (bool) |
| 101 | +* `force_upgrade` - (Optional) Force app V2 chart upgrade. Default: `false` (bool) |
| 102 | +* `wait` - (Optional) Wait until app is deployed. Default: `false` (bool) |
| 103 | +* `annotations` - (Optional/Computed) Annotations for the app v2 (map) |
| 104 | +* `labels` - (Optional/Computed) Labels for the app v2 (map) |
| 105 | + |
| 106 | +### Examples |
| 107 | + |
| 108 | +These are some examples how to deploy some Rancher cerfified apps v2: |
| 109 | + |
| 110 | +* Deploy Rancher monitoring |
| 111 | + |
| 112 | +``` |
| 113 | +resource "rancher2_app_v2" "rancher-monitoring" { |
| 114 | + cluster_id = "<CLUSTER_ID>" |
| 115 | + name = "rancher-monitoring" |
| 116 | + namespace = "cattle-monitoring-system" |
| 117 | + repo_name = "rancher-charts" |
| 118 | + chart_name = "rancher-monitoring" |
| 119 | + chart_version = "9.4.200" |
| 120 | + values = <<EOF |
| 121 | +prometheus: |
| 122 | + prometheusSpec: |
| 123 | + requests: |
| 124 | + cpu: "250m" |
| 125 | + memory: "250Mi" |
| 126 | +EOF |
| 127 | +} |
| 128 | +``` |
| 129 | + |
| 130 | +** tip ** If you are reinstalling `rancher-monitoring` and the deployment is failing, try adding this values to app v2 |
| 131 | +``` |
| 132 | +alertmanager: |
| 133 | + alertmanagerSpec: |
| 134 | + enabled: false |
| 135 | + useExistingSecret: true |
| 136 | + configSecret: alertmanager-rancher-monitoring-alertmanager |
| 137 | +``` |
| 138 | + |
| 139 | +* Deploy Rancher istio and Rancher monitoring as requirement |
| 140 | + |
| 141 | +``` |
| 142 | +resource "rancher2_app_v2" "rancher-monitoring" { |
| 143 | + cluster_id = "<CLUSTER_ID>" |
| 144 | + name = "rancher-monitoring" |
| 145 | + namespace = "cattle-monitoring-system" |
| 146 | + repo_name = "rancher-charts" |
| 147 | + chart_name = "rancher-monitoring" |
| 148 | + chart_version = "9.4.200" |
| 149 | + values = <<EOF |
| 150 | +prometheus: |
| 151 | + prometheusSpec: |
| 152 | + requests: |
| 153 | + cpu: "250m" |
| 154 | + memory: "250Mi" |
| 155 | +EOF |
| 156 | +} |
| 157 | +
|
| 158 | +resource "rancher2_app_v2" "rancher-istio" { |
| 159 | + depends_on = [rancher2_app_v2.rancher-monitoring] # Rancher-istio requires rancher-monitoring |
| 160 | + |
| 161 | + cluster_id = "<CLUSTER_ID>" |
| 162 | + name = "rancher-istio" |
| 163 | + namespace = "istio-system" |
| 164 | + repo_name = "rancher-charts" |
| 165 | + chart_name = "rancher-istio" |
| 166 | + chart_version = "1.7.100" |
| 167 | +} |
| 168 | +``` |
| 169 | + |
| 170 | +* Deploy Rancher cis benchmark |
| 171 | + |
| 172 | +``` |
| 173 | +resource "rancher2_app_v2" "rancher-cis-benchmark" { |
| 174 | + cluster_id = "<CLUSTER_ID>" |
| 175 | + name = "rancher-cis-benchmark" |
| 176 | + namespace = "istio-system" |
| 177 | + repo_name = "rancher-charts" |
| 178 | + chart_name = "rancher-cis-benchmark" |
| 179 | + chart_version = "1.0.100" |
| 180 | + wait = true |
| 181 | +} |
| 182 | +``` |
| 183 | + |
| 184 | +* Deploy Rancher backup |
| 185 | + |
| 186 | +``` |
| 187 | +resource "rancher2_app_v2" "rancher-backup" { |
| 188 | + cluster_id = "<CLUSTER_ID>" |
| 189 | + name = "rancher-backup" |
| 190 | + namespace = "cattle-resources-system" |
| 191 | + repo_name = "rancher-charts" |
| 192 | + chart_name = "rancher-backup" |
| 193 | + chart_version = "1.0.200" |
| 194 | + values = <<EOF |
| 195 | +persistence: |
| 196 | + enabled: false |
| 197 | + size: 2Gi |
| 198 | + storageClass: '-' |
| 199 | + volumeName: "" |
| 200 | +s3: |
| 201 | + bucketName: "" |
| 202 | + credentialSecretName: "" |
| 203 | + credentialSecretNamespace: "" |
| 204 | + enabled: false |
| 205 | + endpoint: "" |
| 206 | + endpointCA: "" |
| 207 | + folder: "" |
| 208 | + insecureTLSSkipVerify: false |
| 209 | + region: "" |
| 210 | +EOF |
| 211 | + wait = true |
| 212 | +} |
| 213 | +``` |
| 214 | + |
| 215 | +* Deploy Rancher logging |
| 216 | + |
| 217 | +``` |
| 218 | +resource "rancher2_app_v2" "rancher-logging" { |
| 219 | + cluster_id = "<CLUSTER_ID>" |
| 220 | + name = "rancher-logging" |
| 221 | + namespace = "cattle-logging-system" |
| 222 | + repo_name = "rancher-charts" |
| 223 | + chart_name = "rancher-logging" |
| 224 | + chart_version = "3.6.000" |
| 225 | + wait = true |
| 226 | +} |
| 227 | +``` |
0 commit comments