-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #473 from rawmind0/appv2
Add new Rancher 2.5 app v2 support
- Loading branch information
Showing
30 changed files
with
1,938 additions
and
518 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,227 @@ | ||
--- | ||
page_title: "Apps & Marketplace" | ||
--- | ||
|
||
# Apps & Marketplace | ||
|
||
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: | ||
|
||
* 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. | ||
* 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 | ||
|
||
More info at [Rancher Apps & Marketplace](https://rancher.com/docs/rancher/v2.x/en/helm-charts/apps-marketplace/) | ||
|
||
## New provider resources | ||
|
||
To support this new feature on this terraform provider, 2 new resources has been added: | ||
* `rancher2_catalog_v2` - To support repository object | ||
* `rancher2_app_v2` - To support chart object | ||
|
||
|
||
## rancher2_catalog_v2 | ||
|
||
This resource has the following arguments definition: | ||
|
||
* `cluster_id` - (Required/ForceNew) The cluster id of the catalog V2 (string) | ||
* `name` - (Required) The name of the catalog v2 (string) | ||
* `ca_bundle` - (Optional) PEM encoded CA bundle which will be used to validate the repo's certificate (string) | ||
* `enabled` - (Optional) If disabled the repo clone will not be updated or allowed to be installed from. Default: `true` (bool) | ||
* `git_branch` - (Optional) Git Repository branch containing Helm chart definitions. Default `master` (string) | ||
* `git_repo` - (Optional) The url of the catalog v2 repo (string) | ||
* `insecure` - (Optional) Use insecure HTTPS to download the repo's index. Default: `false` (bool) | ||
* `secret_name` - (Optional) K8s secret name to be used to connect to the repo (string) | ||
* `secret_namespace` - (Optional) K8s secret namespace (string) | ||
* `service_account` - (Optional) K8s service account used to deploy charts instead of the end users credentials (string) | ||
* `service_account_namespace` - (Optional) The username to access the catalog if needed (string) | ||
* `url` - (Optional) URL to an index generated by Helm (string) | ||
* `annotations` - (Optional/Computed) Annotations for the catalog v2 (map) | ||
* `labels` - (Optional/Computed) Labels for the catalog v2 (map) | ||
|
||
### Examples | ||
|
||
These are some examples how to use a new catalog v2: | ||
|
||
* Create new repository using git repo and branch | ||
``` | ||
resource "rancher2_catalog_v2" "foo" { | ||
cluster_id = "<CLUSTER_ID>"" | ||
name = "foo" | ||
git_repo = "<GIT_REPO_URL>" | ||
git_branch = "<GIT_BRANCH>" | ||
} | ||
``` | ||
|
||
* Create new repository using http url | ||
``` | ||
resource "rancher2_catalog_v2" "foo-url" { | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "foo-url" | ||
url = "https://<CATALOG_URL>" | ||
} | ||
``` | ||
|
||
* Import existing repository | ||
|
||
``` | ||
## Define catalog at tf file | ||
resource "rancher2_catalog_v2" "rancher-charts" { | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "rancher-charts" | ||
git_repo = "https://git.rancher.io/charts" | ||
git_branch = "main" | ||
} | ||
## Import the catalog v2 data to tfstate | ||
# terraform import rancher2_catalog_v2.rancher-charts rancher-charts | ||
``` | ||
|
||
* Using datasource | ||
|
||
``` | ||
data "rancher2_catalog_v2" "foo" { | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "foo" | ||
} | ||
``` | ||
|
||
## rancher2_app_v2 | ||
|
||
This resource has the following arguments definition: | ||
|
||
* `cluster_id` - (Required/ForceNew) The cluster id of the app (string) | ||
* `name` - (Required/ForceNew) The name of the app v2 (string) | ||
* `namespace` - (Required/ForceNew) The namespace of the app v2 (string) | ||
* `repo_name` - (Required) Repo name (string) | ||
* `chart_name` - (Required) The app v2 chart name (string) | ||
* `chart_version` - (Optional) The app v2 chart version (string) | ||
* `project_id` - (Optional) Deploy the app v2 within project ID (string) | ||
* `values` - (Optional) The app v2 values yaml. Yaml format is required (string) | ||
* `cleanup_on_fail` - (Optional) Cleanup app v2 on failed chart upgrade. Default: `false` (bool) | ||
* `disable_hooks` - (Optional) Disable app v2 chart hooks. Default: `false` (bool) | ||
* `disable_open_api_validation` - (Optional) Disable app V2 Open API Validation. Default: `false` (bool) | ||
* `force_upgrade` - (Optional) Force app V2 chart upgrade. Default: `false` (bool) | ||
* `wait` - (Optional) Wait until app is deployed. Default: `false` (bool) | ||
* `annotations` - (Optional/Computed) Annotations for the app v2 (map) | ||
* `labels` - (Optional/Computed) Labels for the app v2 (map) | ||
|
||
### Examples | ||
|
||
These are some examples how to deploy some Rancher cerfified apps v2: | ||
|
||
* Deploy Rancher monitoring | ||
|
||
``` | ||
resource "rancher2_app_v2" "rancher-monitoring" { | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "rancher-monitoring" | ||
namespace = "cattle-monitoring-system" | ||
repo_name = "rancher-charts" | ||
chart_name = "rancher-monitoring" | ||
chart_version = "9.4.200" | ||
values = <<EOF | ||
prometheus: | ||
prometheusSpec: | ||
requests: | ||
cpu: "250m" | ||
memory: "250Mi" | ||
EOF | ||
} | ||
``` | ||
|
||
** tip ** If you are reinstalling `rancher-monitoring` and the deployment is failing, try adding this values to app v2 | ||
``` | ||
alertmanager: | ||
alertmanagerSpec: | ||
enabled: false | ||
useExistingSecret: true | ||
configSecret: alertmanager-rancher-monitoring-alertmanager | ||
``` | ||
|
||
* Deploy Rancher istio and Rancher monitoring as requirement | ||
|
||
``` | ||
resource "rancher2_app_v2" "rancher-monitoring" { | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "rancher-monitoring" | ||
namespace = "cattle-monitoring-system" | ||
repo_name = "rancher-charts" | ||
chart_name = "rancher-monitoring" | ||
chart_version = "9.4.200" | ||
values = <<EOF | ||
prometheus: | ||
prometheusSpec: | ||
requests: | ||
cpu: "250m" | ||
memory: "250Mi" | ||
EOF | ||
} | ||
resource "rancher2_app_v2" "rancher-istio" { | ||
depends_on = [rancher2_app_v2.rancher-monitoring] # Rancher-istio requires rancher-monitoring | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "rancher-istio" | ||
namespace = "istio-system" | ||
repo_name = "rancher-charts" | ||
chart_name = "rancher-istio" | ||
chart_version = "1.7.100" | ||
} | ||
``` | ||
|
||
* Deploy Rancher cis benchmark | ||
|
||
``` | ||
resource "rancher2_app_v2" "rancher-cis-benchmark" { | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "rancher-cis-benchmark" | ||
namespace = "istio-system" | ||
repo_name = "rancher-charts" | ||
chart_name = "rancher-cis-benchmark" | ||
chart_version = "1.0.100" | ||
wait = true | ||
} | ||
``` | ||
|
||
* Deploy Rancher backup | ||
|
||
``` | ||
resource "rancher2_app_v2" "rancher-backup" { | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "rancher-backup" | ||
namespace = "cattle-resources-system" | ||
repo_name = "rancher-charts" | ||
chart_name = "rancher-backup" | ||
chart_version = "1.0.200" | ||
values = <<EOF | ||
persistence: | ||
enabled: false | ||
size: 2Gi | ||
storageClass: '-' | ||
volumeName: "" | ||
s3: | ||
bucketName: "" | ||
credentialSecretName: "" | ||
credentialSecretNamespace: "" | ||
enabled: false | ||
endpoint: "" | ||
endpointCA: "" | ||
folder: "" | ||
insecureTLSSkipVerify: false | ||
region: "" | ||
EOF | ||
wait = true | ||
} | ||
``` | ||
|
||
* Deploy Rancher logging | ||
|
||
``` | ||
resource "rancher2_app_v2" "rancher-logging" { | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "rancher-logging" | ||
namespace = "cattle-logging-system" | ||
repo_name = "rancher-charts" | ||
chart_name = "rancher-logging" | ||
chart_version = "3.6.000" | ||
wait = true | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
page_title: "Rancher2: rancher2_catalog_v2 Resource" | ||
--- | ||
|
||
# rancher2\_app\_v2 Resource | ||
|
||
Provides a Rancher App v2 resource. This can be used to manage helm charts for Rancher v2 environments and retrieve their information. App v2 resource is available at Rancher v2.5.x and above. | ||
|
||
## Example Usage | ||
|
||
```hcl | ||
# Create a new Rancher2 App V2 using | ||
resource "rancher2_app_v2" "foo" { | ||
cluster_id = "<CLUSTER_ID>" | ||
name = "rancher-monitoring" | ||
namespace = "cattle-monitoring-system" | ||
repo_name = "rancher-charts" | ||
chart_name = "rancher-monitoring" | ||
chart_version = "9.4.200" | ||
values = file("values.yaml") | ||
} | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
* `cluster_id` - (Required/ForceNew) The cluster id of the app (string) | ||
* `name` - (Required/ForceNew) The name of the app v2 (string) | ||
* `namespace` - (Required/ForceNew) The namespace of the app v2 (string) | ||
* `repo_name` - (Required) Repo name (string) | ||
* `chart_name` - (Required) The app v2 chart name (string) | ||
* `chart_version` - (Optional) The app v2 chart version (string) | ||
* `project_id` - (Optional) Deploy the app v2 within project ID (string) | ||
* `values` - (Optional) The app v2 values yaml. Yaml format is required (string) | ||
* `cleanup_on_fail` - (Optional) Cleanup app v2 on failed chart upgrade. Default: `false` (bool) | ||
* `disable_hooks` - (Optional) Disable app v2 chart hooks. Default: `false` (bool) | ||
* `disable_open_api_validation` - (Optional) Disable app V2 Open API Validation. Default: `false` (bool) | ||
* `force_upgrade` - (Optional) Force app V2 chart upgrade. Default: `false` (bool) | ||
* `wait` - (Optional) Wait until app is deployed. Default: `false` (bool) | ||
* `annotations` - (Optional/Computed) Annotations for the app v2 (map) | ||
* `labels` - (Optional/Computed) Labels for the app v2 (map) | ||
|
||
## Attributes Reference | ||
|
||
The following attributes are exported: | ||
|
||
* `id` - (Computed) The ID of the resource (string) | ||
* `cluster_name` - (Computed) The cluster name of the app (string) | ||
|
||
## Timeouts | ||
|
||
`rancher2_catalog` provides the following | ||
[Timeouts](https://www.terraform.io/docs/configuration/resources.html#operation-timeouts) configuration options: | ||
|
||
- `create` - (Default `10 minutes`) Used for creating v2 catalogs. | ||
- `update` - (Default `10 minutes`) Used for v2 catalog modifications. | ||
- `delete` - (Default `10 minutes`) Used for deleting v2 catalogs. | ||
|
||
## Import | ||
|
||
V2 apps can be imported using the Rancher cluster ID and App V2 name. | ||
|
||
``` | ||
$ terraform import rancher2_app_v2.foo <CLUSTER_ID>.<APP_V2_NAME> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.