Skip to content

Commit 5d63532

Browse files
authored
Merge pull request #441 from rawmind0/rancher25
Updating provider to support rancher 2.5
2 parents 2250909 + a0a798a commit 5d63532

3,992 files changed

Lines changed: 2935 additions & 845159 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.

.drone.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ steps:
1010
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/go/bin
1111
commands:
1212
- /usr/local/bin/dockerd-entrypoint.sh &
13-
- apk add -U bash make gcc musl-dev git wget go curl
13+
- apk add -U bash make gcc musl-dev git wget go curl
1414
- mkdir -p /go/src/github.com/rancher
1515
- ln -s /drone/src /go/src/github.com/rancher/terraform-provider-rancher2
1616
- cd /go/src/github.com/rancher/terraform-provider-rancher2
17-
- make build-rancher
18-
- make testacc
17+
- make docker-build
18+
- make docker-testacc
1919
- kill %1
2020
privileged: true
2121

2222
- name: build-all-binaries
23-
image: golang:1.13.14
23+
image: golang:1.14.9
2424
environment:
2525
CROSS: 1
2626
VERSION: ${DRONE_TAG}
@@ -72,4 +72,4 @@ steps:
7272
when:
7373
event: tag
7474
ref:
75-
exclude: [ refs/tags/*rc* ]
75+
exclude: [ refs/tags/*rc* ]

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@
33
FEATURES:
44

55
* **New Argument:** `rancher2_cluster.oke_config` - (Optional) Oracle OKE configuration
6+
* **New Argument:** `rancher2_node_template.openstack_config.application_credential_id` - (Optional) OpenStack application credential id
7+
* **New Argument:** `rancher2_node_template.openstack_config.application_credential_name` - (Optional) OpenStack application credential name
8+
* **New Argument:** `rancher2_node_template.openstack_config.application_credential_secret` - (Optional) OpenStack application credential secret
9+
* **New Argument:** `rancher2_cluster.eks_import` - (Optional) EKS cluster import and new management support. Just for Rancher v2.5.0 and above
10+
* **New Argument:** `rancher2_bootstrap.ui_default_landing` - (Optional) Set default ui landing on Rancher bootstrap. Just for Rancher v2.5.0 and above
11+
* **New Data Source:** `rancher2_catalog_v2` - Support new Rancher catalog V2 datasource. Just for Rancher v2.5.0 and above
12+
* **New Resource:** `rancher2_catalog_v2` - Support new Rancher catalog V2 resource. Just for Rancher v2.5.0 and above
613

714
ENHANCEMENTS:
815

916
* Added new computed `ca_cert` argument at `rancher2_cluster` resource and datasource
1017
* Updated acceptance tests to use k3s `v1.18.9-k3s1` and cert-manager `v1.0.1`
1118
* Delete `rancher2_app` if created and got timeout to be active
19+
* Updated golang to v1.14.9 and removing vendor folder
20+
* Updated go mod to support Rancher `v2.5.0`
1221

1322
BUG FIXES:
1423

GNUmakefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ default: build
88
build: validate
99
@sh -c "'$(CURDIR)/scripts/gobuild.sh'"
1010

11+
docker-build:
12+
@sh -c "'$(CURDIR)/scripts/gobuild_docker.sh'"
13+
1114
build-rancher: validate-rancher
1215
@sh -c "'$(CURDIR)/scripts/gobuild.sh'"
1316

@@ -64,8 +67,9 @@ fmtcheck:
6467
errcheck:
6568
@sh -c "'$(CURDIR)/scripts/errcheck.sh'"
6669

67-
vendor-status:
68-
@govendor status
70+
vendor:
71+
@echo "==> Updating vendor modules..."
72+
@GO111MODULE=on go mod vendor
6973

7074
test-compile:
7175
@if [ "$(TEST)" = "./..." ]; then \
@@ -75,5 +79,4 @@ test-compile:
7579
fi
7680
go test -c $(TEST) $(TESTARGS)
7781

78-
.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile bin
79-
82+
.PHONY: build test testacc vet fmt fmtcheck errcheck vendor-status test-compile bin vendor

docs/data-sources/catalog_v2.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
page_title: "rancher2_catalog_v2 Data Source"
3+
---
4+
5+
# rancher2\_catalog\_v2 Data Source
6+
7+
Use this data source to retrieve information about a Rancher2 catalog v2.
8+
9+
## Example Usage
10+
11+
```
12+
data "rancher2_catalog_v2" "foo" {
13+
cluster_id = "<CLUSTER_ID>"
14+
name = "foo"
15+
}
16+
```
17+
18+
## Argument Reference
19+
20+
* `cluster_id` - (Required) The cluster id of the catalog (string)
21+
* `name` - (Required) The name of the catalog v2 (string)
22+
23+
## Attributes Reference
24+
25+
* `id` - (Computed) The ID of the resource (string)
26+
* `ca_bundle` - (Computed) PEM encoded CA bundle which will be used to validate the repo's certificate (string)
27+
* `enabled` - (Computed) If disabled the repo clone will not be updated or allowed to be installed from. Default: `true` (bool)
28+
* `git_branch` - (Computed) Git Repository branch containing Helm chart definitions. Default `master` (string)
29+
* `git_repo` - (Computed) The url of the catalog v2 repo (string)
30+
* `insecure` - (Computed) Use insecure HTTPS to download the repo's index. Default: `false` (bool)
31+
* `secret_name` - (Computed) K8s secret name to be used to connect to the repo (string)
32+
* `secret_namespace` - (Computed) K8s secret namespace (string)
33+
* `service_account` - (Computed) K8s service account used to deploy charts instead of the end users credentials (string)
34+
* `service_account_namespace` - (Computed) The username to access the catalog if needed (string)
35+
* `url` - (Computed) URL to an index generated by Helm (string)
36+
* `annotations` - (Computed) Annotations for the catalog v2 (map)
37+
* `labels` - (Computed) Labels for the catalog v2 (map)

docs/resources/bootstrap.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ The following arguments are supported:
6161
* `telemetry` - (Optional) Send telemetry anonymous data. Default: `false` (bool)
6262
* `token_ttl` - (Optional) TTL in seconds for generated admin token. Default: `0` (int)
6363
* `token_update` - (Optional) Regenerate admin token. Default: `false` (bool)
64+
* `ui_default_landing` - (Optional) Default UI landing for k8s clusters. Available options: `ember` (cluster manager ui) and `vue` (cluster explorer ui). Default: `ember` (string)
6465

6566
## Attributes Reference
6667

docs/resources/catalog_v2.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
page_title: "Rancher2: rancher2_catalog_v2 Resource"
3+
---
4+
5+
# rancher2\_catalog\_v2 Resource
6+
7+
Provides a Rancher Catalog v2 resource. This can be used to create cluster helm catalogs for Rancher v2 environments and retrieve their information. Catalog v2 resource is available at Rancher v2.5.x and above.
8+
9+
## Example Usage
10+
11+
```hcl
12+
# Create a new Rancher2 Catalog V2 using git repo and branch
13+
resource "rancher2_catalog_v2" "foo" {
14+
cluster_id = "<CLUSTER_ID>"
15+
name = "foo"
16+
git_repo = "<GIT_REPO_URL>"
17+
git_branch = "<GIT_BRANCH>"
18+
}
19+
# Create a new Rancher2 Catalog V2 using url
20+
resource "rancher2_catalog_v2" "foo-url" {
21+
cluster_id = "<CLUSTER_ID>"
22+
name = "foo-url"
23+
url = "https://<CATALOG_URL>"
24+
}
25+
```
26+
27+
## Argument Reference
28+
29+
The following arguments are supported:
30+
31+
* `cluster_id` - (Required/ForceNew) The cluster id of the catalog (string)
32+
* `name` - (Required) The name of the catalog v2 (string)
33+
* `ca_bundle` - (Optional) PEM encoded CA bundle which will be used to validate the repo's certificate (string)
34+
* `enabled` - (Optional) If disabled the repo clone will not be updated or allowed to be installed from. Default: `true` (bool)
35+
* `git_branch` - (Optional) Git Repository branch containing Helm chart definitions. Default `master` (string)
36+
* `git_repo` - (Optional) The url of the catalog v2 repo (string)
37+
* `insecure` - (Optional) Use insecure HTTPS to download the repo's index. Default: `false` (bool)
38+
* `secret_name` - (Optional) K8s secret name to be used to connect to the repo (string)
39+
* `secret_namespace` - (Optional) K8s secret namespace (string)
40+
* `service_account` - (Optional) K8s service account used to deploy charts instead of the end users credentials (string)
41+
* `service_account_namespace` - (Optional) The username to access the catalog if needed (string)
42+
* `url` - (Optional) URL to an index generated by Helm (string)
43+
* `annotations` - (Optional/Computed) Annotations for the catalog v2 (map)
44+
* `labels` - (Optional/Computed) Labels for the catalog v2 (map)
45+
46+
## Attributes Reference
47+
48+
The following attributes are exported:
49+
50+
* `id` - (Computed) The ID of the resource (string)
51+
* `resource_version` - (Computed) The k8s resource version (string)
52+
53+
## Timeouts
54+
55+
`rancher2_catalog` provides the following
56+
[Timeouts](https://www.terraform.io/docs/configuration/resources.html#operation-timeouts) configuration options:
57+
58+
- `create` - (Default `10 minutes`) Used for creating v2 catalogs.
59+
- `update` - (Default `10 minutes`) Used for v2 catalog modifications.
60+
- `delete` - (Default `10 minutes`) Used for deleting v2 catalogs.
61+
62+
## Import
63+
64+
V2 catalogs can be imported using the Rancher Catalog V2 cluster ID and name.
65+
66+
```
67+
$ terraform import rancher2_catalog_v2.foo &lt;CLUSTER_ID&gt;.&lt;CATALOG_V2_NAME&gt;
68+
```

docs/resources/cluster.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,17 +346,40 @@ resource "rancher2_cluster" "foo" {
346346
}
347347
```
348348

349+
Importing EKS cluster to Rancher v2. For Rancher v2.5.x or above.
350+
351+
```hcl
352+
resource "rancher2_cloud_credential" "foo" {
353+
name = "foo"
354+
description = "foo test"
355+
amazonec2_credential_config {
356+
access_key = "<AWS_ACCESS_KEY>"
357+
secret_key = "<AWS_SECRET_KEY>"
358+
}
359+
}
360+
resource "rancher2_cluster" "foo" {
361+
name = "foo"
362+
description = "Terraform EKS cluster"
363+
eks_import {
364+
cloud_credential = rancher2_cloud_credential.foo.id
365+
name = "<CLUSTER_NAME>"
366+
region = "<EKS_REGION>"
367+
}
368+
}
369+
```
370+
349371
## Argument Reference
350372

351373
The following arguments are supported:
352374

353375
* `name` - (Required) The name of the Cluster (string)
354376
* `rke_config` - (Optional/Computed) The RKE configuration for `rke` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config` and `k3s_config` (list maxitems:1)
355377
* `k3s_config` - (Optional/Computed) The K3S configuration for `k3s` imported Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config` and `rke_config` (list maxitems:1)
356-
* `aks_config` - (Optional) The Azure AKS configuration for `aks` Clusters. Conflicts with `eks_config`, `gke_config`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
357-
* `eks_config` - (Optional) The Amazon EKS configuration for `eks` Clusters. Conflicts with `aks_config`, `gke_config`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
358-
* `gke_config` - (Optional) The Google GKE configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
359-
* `oke_config` - (Optional) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config` `k3s_config` and `rke_config` (list maxitems:1)
378+
* `aks_config` - (Optional) The Azure AKS configuration for `aks` Clusters. Conflicts with `eks_config`, `eks_import`, `gke_config`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
379+
* `eks_config` - (Optional) The Amazon EKS configuration for `eks` Clusters. Conflicts with `aks_config`, `eks_import`, `gke_config`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
380+
* `eks_import` - (Optional) The Amazon EKS configuration to import `eks` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
381+
* `gke_config` - (Optional) The Google GKE configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
382+
* `oke_config` - (Optional) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `gke_config` `k3s_config` and `rke_config` (list maxitems:1)
360383
* `description` - (Optional) The description for Cluster (string)
361384
* `cluster_auth_endpoint` - (Optional/Computed) Enabling the [local cluster authorized endpoint](https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/#local-cluster-auth-endpoint) allows direct communication with the cluster, bypassing the Rancher API proxy. (list maxitems:1)
362385
* `cluster_monitoring_input` - (Optional) Cluster monitoring config. Any parameter defined in [rancher-monitoring charts](https://github.com/rancher/system-charts/tree/dev/charts/rancher-monitoring) could be configured (list maxitems:1)
@@ -1010,6 +1033,16 @@ The following arguments are supported:
10101033
* `user_data` - (Optional/Computed) Pass user-data to the nodes to perform automated configuration tasks (string)
10111034
* `virtual_network` - (Optional) The name of the virtual network to use. If it's not specified Rancher will create a new VPC (string)
10121035

1036+
### `eks_import`
1037+
1038+
#### Arguments
1039+
1040+
The following arguments are supported:
1041+
1042+
* `cloud_credential` - (Required) The EKS cloud_credential id (string)
1043+
* `name` - (Required) The EKS cluster name to import (string)
1044+
* `region` - (Required) The EKS cluster region (string)
1045+
10131046
### `gke_config`
10141047

10151048
#### Arguments

go.mod

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,51 @@
11
module github.com/terraform-providers/terraform-provider-rancher2
22

3-
go 1.13
3+
go 1.14
44

55
require (
66
github.com/ghodss/yaml v1.0.0
77
github.com/hashicorp/go-version v1.2.0
88
github.com/hashicorp/terraform-plugin-sdk v1.14.0
9-
github.com/rancher/norman v0.0.0-20200806175025-f974dbfb2734
10-
github.com/rancher/types v0.0.0-20200812201428-42b3abe8e39e
9+
github.com/rancher/client-go v11.0.0+incompatible // indirect
10+
github.com/rancher/lasso v0.0.0-20200905045615-7fcb07d6a20b
11+
github.com/rancher/norman v0.0.0-20200930000340-693d65aaffe3
12+
github.com/rancher/rancher v0.0.0-20201006004413-65f3525cdc11
13+
github.com/rancher/rancher/pkg/apis v0.0.0
14+
github.com/rancher/rancher/pkg/client v0.0.0
15+
github.com/rancher/wrangler v0.7.2
1116
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
12-
gopkg.in/yaml.v2 v2.2.8
13-
k8s.io/apimachinery v0.18.8
14-
k8s.io/apiserver v0.18.8
17+
gopkg.in/yaml.v2 v2.3.0
18+
k8s.io/api v0.19.0
19+
k8s.io/apimachinery v0.19.0
20+
k8s.io/apiserver v0.19.0
21+
k8s.io/client-go v12.0.0+incompatible
1522
)
1623

1724
replace (
18-
k8s.io/api => k8s.io/api v0.18.8
19-
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.8
20-
k8s.io/apimachinery => k8s.io/apimachinery v0.18.8
21-
k8s.io/apiserver => k8s.io/apiserver v0.18.8
22-
k8s.io/cli-runtime => k8s.io/cli-runtime v0.18.8
23-
k8s.io/client-go => github.com/rancher/client-go v1.18.8-rancher.1
24-
k8s.io/cloud-provider => k8s.io/cloud-provider v0.18.8
25-
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.18.8
26-
k8s.io/code-generator => k8s.io/code-generator v0.18.8
27-
k8s.io/component-base => k8s.io/component-base v0.18.8
28-
k8s.io/cri-api => k8s.io/cri-api v0.18.8
29-
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.8
30-
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.8
31-
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.8
32-
k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.8
33-
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.8
34-
k8s.io/kubectl => k8s.io/kubectl v0.18.8
35-
k8s.io/kubelet => k8s.io/kubelet v0.18.8
36-
k8s.io/kubernetes => k8s.io/kubernetes v1.18.8
37-
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.18.8
38-
k8s.io/metrics => k8s.io/metrics v0.18.8
39-
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.18.8
25+
github.com/crewjam/saml => github.com/crewjam/saml v0.4.1
26+
github.com/rancher/rancher/pkg/apis => github.com/rancher/rancher/pkg/apis v0.0.0-20201006004413-65f3525cdc11
27+
github.com/rancher/rancher/pkg/client => github.com/rancher/rancher/pkg/client v0.0.0-20201006004413-65f3525cdc11
28+
k8s.io/api => k8s.io/api v0.19.0
29+
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.19.0
30+
k8s.io/apimachinery => github.com/rancher/apimachinery v0.19.0-rancher1
31+
k8s.io/apiserver => k8s.io/apiserver v0.19.0
32+
k8s.io/cli-runtime => k8s.io/cli-runtime v0.19.0
33+
k8s.io/client-go => github.com/rancher/client-go v1.19.0-rancher.1
34+
k8s.io/cloud-provider => k8s.io/cloud-provider v0.19.0
35+
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.19.0
36+
k8s.io/code-generator => k8s.io/code-generator v0.19.0
37+
k8s.io/component-base => k8s.io/component-base v0.19.0
38+
k8s.io/cri-api => k8s.io/cri-api v0.19.0
39+
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.19.0
40+
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.19.0
41+
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.19.0
42+
k8s.io/kube-proxy => k8s.io/kube-proxy v0.19.0
43+
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.19.0
44+
k8s.io/kubectl => k8s.io/kubectl v0.19.0
45+
k8s.io/kubelet => k8s.io/kubelet v0.19.0
46+
k8s.io/kubernetes => k8s.io/kubernetes v0.19.0
47+
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.19.0
48+
k8s.io/metrics => k8s.io/metrics v0.19.0
49+
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.19.0
4050
launchpad.net/gocheck => github.com/go-check/check v0.0.0-20200227125254-8fa46927fb4f
4151
)

0 commit comments

Comments
 (0)