This repository has been archived by the owner on Apr 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding docs folder and acceptance tests (#18)
* release binaries in commit script * rewrite of resource, adding acceptance tests * add make target for acceptance tests * make targets * remove import block, as update resource is not implemented yet * add documentation and more tests * update docs * proper check destroy method * make for ci
- Loading branch information
Daniel Roth
authored
Aug 5, 2020
1 parent
cc37ab9
commit ad2500c
Showing
14 changed files
with
536 additions
and
241 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
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,25 @@ | ||
# Development Environment Setup | ||
|
||
## Requirements | ||
|
||
- [Terraform](https://www.terraform.io/downloads.html) 0.12+ | ||
- [Go](https://golang.org/doc/install) 1.13 or higher | ||
- Make sure that your Docker Engine has enough memory assigned to run multi-node kind clusters. | ||
|
||
## Development | ||
|
||
Perform the following steps to build the providers: | ||
|
||
1. Build the provider: | ||
```bash | ||
go build -o terraform-provider-kind | ||
``` | ||
2. Move the provider binary into the terraform plugins folder. | ||
|
||
>**NOTE**: For details on Terraform plugins see [this](https://www.terraform.io/docs/plugins/basics.html#installing-plugins) document. | ||
|
||
## Testing | ||
|
||
In order to test the provider you can run `go test ./...` for the unit tests as well as `make testacc` for the Acceptance Tests. If you prefer to only run tests and skip linting and formatting when running Acceptance Tests start them by running `TF_ACC=1 go test ./kind -v -count 1 -parallel 20 -timeout 120m`. | ||
|
||
*Note:* Acceptance tests create real resources, and will consume significant resources on the machine they run on. |
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,3 @@ | ||
# Frequently Asked Questions | ||
|
||
Add questions as they arise... |
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,64 @@ | ||
# Using The Provider | ||
|
||
## Usage | ||
|
||
Perform the following steps to use the provider: | ||
|
||
1. Go to the provider [example](https://github.com/kyma-incubator/terraform-provider-kind/tree/master/example) folder: | ||
```bash | ||
cd example | ||
``` | ||
2. Edit the `main.tf` file and provide the following kind configuration: | ||
|
||
```hcl | ||
provider "kind" {} | ||
# creating a cluster with kind of the name "test-cluster" with kubernetes version hardcoded in kind defaults https://github.com/kubernetes-sigs/kind/blob/master/pkg/apis/config/defaults/image.go#L21 | ||
resource "kind_cluster" "default" { | ||
name = "test-cluster" | ||
} | ||
``` | ||
|
||
To override the node image used, you can specify the `node_image` like so: | ||
|
||
```hcl | ||
provider "kind" {} | ||
# creating a cluster with kind of the name "test-cluster" with kubernetes version v1.16.1 | ||
resource "kind_cluster" "default" { | ||
name = "test-cluster" | ||
node_image = "kindest/node:v1.16.1" | ||
} | ||
``` | ||
|
||
To override the default kind config, you can specify the `kind_config` with HEREDOC: | ||
|
||
```hcl | ||
provider "kind" {} | ||
# creating a cluster with kind of the name "test-cluster" with kubernetes version v1.18.4 and two nodes | ||
resource "kind_cluster" "default" { | ||
name = "test-cluster" | ||
node_image = "kindest/node:v1.18.4" | ||
kind_config =<<KIONF | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
- role: worker | ||
KIONF | ||
} | ||
``` | ||
|
||
1. Initialize Terraform: | ||
```bash | ||
terraform init | ||
``` | ||
2. Plan the provisioning: | ||
```bash | ||
terraform plan | ||
``` | ||
3. Deploy the cluster: | ||
```bash | ||
terraform apply | ||
``` |
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.