Skip to content

Commit 6c5b292

Browse files
authored
Merge pull request #737 from rawmind0/rke2v2
Add support to rke2 and k3s
2 parents 3bf2deb + 4da9910 commit 6c5b292

65 files changed

Lines changed: 7785 additions & 36 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
## 1.20.0 (Unreleased)
1+
## 1.20.0 (September 17, 2021)
22

33
FEATURES:
44

55
* **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)
66
* **New Argument:** `rancher2_cloud_credential.azure_credential_config.environment` - (Optional/Computed) Azure environment (e.g. AzurePublicCloud, AzureChinaCloud) (string)
77
* **New Argument:** `rancher2_cloud_credential.azure_credential_config.tenant_id` - (Optional/Computed) Azure Tenant ID (string)
8+
* **New Attribute:** `rancher2_cluster.cluster_registration_token.insecure_node_command` - (Computed) Insecure node command to execute in a imported k8s cluster (string)
9+
* **New Attribute:** `rancher2_cluster.cluster_registration_token.insecure_windows_node_command` - (Computed) Insecure windows command to execute in a imported k8s cluster (string)
10+
* **New Attribute:** `rancher2_cloud_credential.amazonec2_credential_config.default_region` - (Optional) AWS default region (string)
11+
* **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.
12+
* **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.
13+
* **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.
814

915
ENHANCEMENTS:
1016

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

1724
BUG FIXES:
1825

docs/data-sources/cluster_v2.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
page_title: "rancher2_cluster_v2 Data Source"
3+
---
4+
5+
# rancher2\_cluster\_v2 Data Source
6+
7+
Use this data source to retrieve information about a Rancher v2 cluster.
8+
9+
## Example Usage
10+
11+
```hcl
12+
data "rancher2_cluster_v2" "foo" {
13+
name = "foo"
14+
fleet_namespace = "fleet-ns"
15+
}
16+
```
17+
18+
## Argument Reference
19+
20+
The following arguments are supported:
21+
22+
* `name` - (Required) The name of the Cluster v2 (string)
23+
* `fleet_namespace` - (Optional) The fleet namespace of the Cluster v2. Default: `\"fleet-default\"` (string)
24+
25+
## Attributes Reference
26+
27+
The following attributes are exported:
28+
29+
* `id` - (Computed) The ID of the resource (string)
30+
* `cluster_registration_token` - (Computed/Sensitive) Cluster Registration Token generated for the cluster v2 (list maxitems:1)
31+
* `kube_config` - (Computed/Sensitive) Kube Config generated for the cluster v2 (string)
32+
* `cluster_v1_id` - (Computed) Cluster v1 id for cluster v2 (string)
33+
* `resource_version` - (Computed) Cluster v2 k8s resource version (string)
34+
* `kubernetes_version` - (Computed) The kubernetes version of the Cluster v2 (list maxitems:1)
35+
* `agent_env_vars` - (Computed) Optional Agent Env Vars for Rancher agent (list)
36+
* `rke_config` - (Computed) The RKE configuration for `k3s` and `rke2` Clusters v2. (list maxitems:1)
37+
* `cloud_credential_secret_name` - (Computed) Cluster V2 cloud credential secret name (string)
38+
* `default_pod_security_policy_template_name` - (Computed) Cluster V2 default pod security policy template name (string)
39+
* `default_cluster_role_for_project_members` - (Computed) Cluster V2 default cluster role for project members (string)
40+
* `enable_network_policy` - (Computed) Enable k8s network policy at Cluster V2 (bool)

docs/resources/bootstrap.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Rancher2 admin `token` can also be regenerated if `token_update` is set to true.
1818

1919
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.
2020

21+
**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.
22+
2123
## Example Usage
2224

2325
```hcl

docs/resources/cloud_credential.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ The following attributes are exported:
5353

5454
* `access_key` - (Required/Sensitive) AWS access key (string)
5555
* `secret_key` - (Required/Sensitive) AWS secret key (string)
56+
* `default_region` - (Optional) AWS default region (string)
5657

5758
### `azure_credential_config`
5859

docs/resources/cluster.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,8 @@ The following arguments are supported:
17491749
* `name` - (Computed) Name of cluster registration token (string)
17501750
* `command` - (Computed) Command to execute in a imported k8s cluster (string)
17511751
* `insecure_command` - (Computed) Insecure command to execute in a imported k8s cluster (string)
1752+
* `insecure_node_command` - (Computed) Insecure node command to execute in a imported k8s cluster (string)
1753+
* `insecure_windows_node_command` - (Computed) Insecure windows command to execute in a imported k8s cluster (string)
17521754
* `manifest_url` - (Computed) K8s manifest url to execute with `kubectl` to import an existing k8s cluster (string)
17531755
* `node_command` - (Computed) Node command to execute in linux nodes for custom k8s cluster (string)
17541756
* `token` - (Computed) Token for cluster registration token object (string)

0 commit comments

Comments
 (0)