-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
177 additions
and
1 deletion.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,27 @@ | ||
# Workspace `kind` | ||
|
||
> This directory contains [kind Provider](https://registry.terraform.io/providers/kyma-incubator/kind/latest) Resources. | ||
## Requirements | ||
|
||
* Terraform CLI `1.0.9` or newer | ||
* ``` | ||
## Downstream Consumption | ||
The Kubernetes Cluster can be consumed via the [attributes reference](https://registry.terraform.io/providers/kyma-incubator/kind/latest/docs/resources/cluster#attributes-reference): | ||
```hcl | ||
output "cluster_config" { | ||
description = "Kind Cluster Config." | ||
value = kind_cluster.cluster.kubeconfig | ||
} | ||
``` | ||
|
||
## Execution Mode | ||
|
||
Upon terraform initialization, make sure to: | ||
|
||
1. YOUR_ORGANIZATION_NAME > Workspaces >YOUR_WORKSPACE_NAME > Settings > General | ||
1. Switch `Execution Mode`from `Remote` to `Local` | ||
1. Save the settings |
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,46 @@ | ||
# see https://registry.terraform.io/providers/kyma-incubator/kind/latest | ||
resource "kind_cluster" "cluster" { | ||
name = var.tfe_workspaces_prefix | ||
kubeconfig_path = pathexpand(var.kind_cluster_config_path) | ||
wait_for_ready = true | ||
|
||
# see https://github.com/kubernetes-sigs/kind/releases | ||
# ex: v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad | ||
node_image = "kindest/node:${var.kind_kubernetes_version}" | ||
|
||
# see https://github.com/kyma-incubator/terraform-provider-kind/blob/master/kind/structure_kind_config.go | ||
kind_config { | ||
kind = "Cluster" | ||
api_version = "kind.x-k8s.io/v1alpha4" | ||
|
||
node { | ||
role = "control-plane" | ||
|
||
kubeadm_config_patches = [ | ||
"kind: InitConfiguration\nnodeRegistration:\n kubeletExtraArgs:\n node-labels: \"ingress-ready=true\"\n" | ||
] | ||
|
||
extra_port_mappings { | ||
container_port = 80 | ||
host_port = 80 | ||
} | ||
|
||
extra_port_mappings { | ||
container_port = 443 | ||
host_port = 443 | ||
} | ||
} | ||
|
||
node { | ||
role = "worker" | ||
} | ||
|
||
node { | ||
role = "worker" | ||
} | ||
|
||
node { | ||
role = "worker" | ||
} | ||
} | ||
} |
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,36 @@ | ||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "cluster_config" { | ||
description = "Kind Cluster Config." | ||
value = kind_cluster.cluster.kubeconfig | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "cluster_client_certificate" { | ||
description = "Kind Cluster Client Certificate." | ||
value = kind_cluster.cluster.client_certificate | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "cluster_client_key" { | ||
description = "Kind Cluster Client Key." | ||
value = kind_cluster.cluster.client_key | ||
sensitive = true | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "cluster_ca_certificate" { | ||
description = "Kind Cluster CA Certificate." | ||
value = kind_cluster.cluster.cluster_ca_certificate | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "cluster_endpoint" { | ||
description = "Kind Cluseter Endpoint." | ||
value = kind_cluster.cluster.endpoint | ||
} | ||
|
||
# this variable is used for testing purposes and has no bearing on the demo | ||
# see https://www.terraform.io/docs/language/values/outputs.html | ||
output "workspace_url" { | ||
value = "https://app.terraform.io/app/a-demo-organization/workspaces/${var.tfe_workspaces_prefix}-kind" | ||
} |
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,2 @@ | ||
# see https://registry.terraform.io/providers/kyma-incubator/kind/latest | ||
provider "kind" {} |
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,23 @@ | ||
terraform { | ||
# see https://www.terraform.io/docs/language/settings/backends/remote.html | ||
backend "remote" { | ||
hostname = "app.terraform.io" | ||
organization = "a-demo-organization" | ||
|
||
workspaces { | ||
name = "multi-cloud-k8s-kind" | ||
} | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/settings/index.html#specifying-provider-requirements | ||
required_providers { | ||
# see https://registry.terraform.io/providers/kyma-incubator/kind/0.0.9 | ||
kind = { | ||
source = "kyma-incubator/kind" | ||
version = "0.0.9" | ||
} | ||
} | ||
|
||
# see https://www.terraform.io/docs/language/settings/index.html#specifying-a-required-terraform-version | ||
required_version = "1.0.9" | ||
} |
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,2 @@ | ||
kind_kubernetes_version = "v1.21.1" | ||
kind_cluster_config_path = "~/.kube/config" |
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,18 @@ | ||
variable "tfe_workspaces_prefix" { | ||
type = string | ||
description = "Prefix for TFE Workspaces." | ||
default = "multi-cloud-k8s" | ||
} | ||
|
||
# see https://github.com/kubernetes-sigs/kind/releases | ||
variable "kind_kubernetes_version" { | ||
type = string | ||
description = "Kubernetes version to use with Kind Cluster." | ||
default = "v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad" | ||
} | ||
|
||
variable "kind_cluster_config_path" { | ||
type = string | ||
description = "The location where this cluster's kubeconfig will be saved to." | ||
default = "~/.kube/config" | ||
} |
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 |
---|---|---|
|
@@ -7,7 +7,8 @@ variable "tfe_workspaces" { | |
"aks", | ||
"eks", | ||
"doks", | ||
"gke" | ||
"gke", | ||
"kind" | ||
] | ||
} | ||
|
||
|
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