Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to rke2 and k3s #737

Merged
merged 6 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
## 1.20.0 (Unreleased)
## 1.20.0 (September 17, 2021)

FEATURES:

* **New Argument:** `rancher2_cluster.aks_config_v2` - (Optional) The Azure AKS v2 configuration for creating/import `aks` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` `k3s_config` and `rke_config`. Just for Rancher v2.6.0 and above (list maxitems:1)
* **New Argument:** `rancher2_cloud_credential.azure_credential_config.environment` - (Optional/Computed) Azure environment (e.g. AzurePublicCloud, AzureChinaCloud) (string)
* **New Argument:** `rancher2_cloud_credential.azure_credential_config.tenant_id` - (Optional/Computed) Azure Tenant ID (string)
* **New Attribute:** `rancher2_cluster.cluster_registration_token.insecure_node_command` - (Computed) Insecure node command to execute in a imported k8s cluster (string)
* **New Attribute:** `rancher2_cluster.cluster_registration_token.insecure_windows_node_command` - (Computed) Insecure windows command to execute in a imported k8s cluster (string)
* **New Attribute:** `rancher2_cloud_credential.amazonec2_credential_config.default_region` - (Optional) AWS default region (string)
* **New Resource:** `rancher2_machine_config_v2` - Provides a Rancher v2 Machine config v2 resource. Available as tech preview at Rancher v2.6.0 and above.
* **New Resource:** `rancher2_cluster_v2` - Provides Rancher cluster v2 resource to manage RKE2 and K3S cluster. Available as tech preview at Rancher v2.6.0 and above.
* **New Data Source:** `rancher2_cluster_v2` - Provides Rancher cluster v2 resource to manage RKE2 and K3S cluster. Available at Rancher v2.6.0 and above.

ENHANCEMENTS:

Expand All @@ -13,6 +19,7 @@ ENHANCEMENTS:
* Updated `rancher2_cluster.gke_config_v2` schema to support rancher v2.6.0 https://github.com/rancher/gke-operator/pull/49
* Updated `rancher2_cluster.eks_config_v2` schema to support rancher v2.6.0 https://github.com/rancher/eks-operator/pull/38
* Updated `rancher2_cluster.gke_config_v2` schema to support rancher v2.6.0 https://github.com/rancher/rancher/issues/34291
* Updated docs, adding note to use `rancher2_bootstrap` resource on Rancher v2.6.0 and above

BUG FIXES:

Expand Down
40 changes: 40 additions & 0 deletions docs/data-sources/cluster_v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
page_title: "rancher2_cluster_v2 Data Source"
---

# rancher2\_cluster\_v2 Data Source

Use this data source to retrieve information about a Rancher v2 cluster.

## Example Usage

```hcl
data "rancher2_cluster_v2" "foo" {
name = "foo"
fleet_namespace = "fleet-ns"
}
```

## Argument Reference

The following arguments are supported:

* `name` - (Required) The name of the Cluster v2 (string)
* `fleet_namespace` - (Optional) The fleet namespace of the Cluster v2. Default: `\"fleet-default\"` (string)

## Attributes Reference

The following attributes are exported:

* `id` - (Computed) The ID of the resource (string)
* `cluster_registration_token` - (Computed/Sensitive) Cluster Registration Token generated for the cluster v2 (list maxitems:1)
* `kube_config` - (Computed/Sensitive) Kube Config generated for the cluster v2 (string)
* `cluster_v1_id` - (Computed) Cluster v1 id for cluster v2 (string)
* `resource_version` - (Computed) Cluster v2 k8s resource version (string)
* `kubernetes_version` - (Computed) The kubernetes version of the Cluster v2 (list maxitems:1)
* `agent_env_vars` - (Computed) Optional Agent Env Vars for Rancher agent (list)
* `rke_config` - (Computed) The RKE configuration for `k3s` and `rke2` Clusters v2. (list maxitems:1)
* `cloud_credential_secret_name` - (Computed) Cluster V2 cloud credential secret name (string)
* `default_pod_security_policy_template_name` - (Computed) Cluster V2 default pod security policy template name (string)
* `default_cluster_role_for_project_members` - (Computed) Cluster V2 default cluster role for project members (string)
* `enable_network_policy` - (Computed) Enable k8s network policy at Cluster V2 (bool)
2 changes: 2 additions & 0 deletions docs/resources/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Rancher2 admin `token` can also be regenerated if `token_update` is set to true.

Login to Rancher2 is done by trying to use `token` first. If it fails, it uses admin `current_password`. If admin password has been changed outside of terraform and the terraform `token` is expired, `current_password` field can be specified to allow terraform to manage admin password and token again.

**Note** Starting from Rancher v2.6.0, the Rancher installation is setting a random admin password by default. To be able to still use the `rancher2_bootstrap` resource, the Rancher admin password should be set on installation time, using helm chart [`bootstrapPassword`](https://github.com/rancher/rancher/blob/release/v2.6/chart/values.yaml#L157) value for HA installation or docker env variable [`CATTLE_BOOTSTRAP_PASSWORD`](https://github.com/rancher/rancher/blob/release/v2.6/chart/templates/deployment.yaml#L135) for single node installation. If the Rancher admin password is set to something distinct than `admin` (previous default admin password), the `rancher2_bootstrap.current_password` argument should also be set with same value at tf file.

## Example Usage

```hcl
Expand Down
1 change: 1 addition & 0 deletions docs/resources/cloud_credential.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ The following attributes are exported:

* `access_key` - (Required/Sensitive) AWS access key (string)
* `secret_key` - (Required/Sensitive) AWS secret key (string)
* `default_region` - (Optional) AWS default region (string)

### `azure_credential_config`

Expand Down
2 changes: 2 additions & 0 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -1749,6 +1749,8 @@ The following arguments are supported:
* `name` - (Computed) Name of cluster registration token (string)
* `command` - (Computed) Command to execute in a imported k8s cluster (string)
* `insecure_command` - (Computed) Insecure command to execute in a imported k8s cluster (string)
* `insecure_node_command` - (Computed) Insecure node command to execute in a imported k8s cluster (string)
* `insecure_windows_node_command` - (Computed) Insecure windows command to execute in a imported k8s cluster (string)
* `manifest_url` - (Computed) K8s manifest url to execute with `kubectl` to import an existing k8s cluster (string)
* `node_command` - (Computed) Node command to execute in linux nodes for custom k8s cluster (string)
* `token` - (Computed) Token for cluster registration token object (string)
Expand Down
Loading