Closed invidian closed 4 years ago
On it
So this is what I was talking about. Steps to reproduce
0.1.0+git
version with no files changed and below config filelokoctl health
and they were ready
Node Ready Reason Message
kautilya-controller-0 True KubeletReady kubelet is posting ready status kautilya-kautilya-pool-1-worker-0 True KubeletReady kubelet is posting ready status Name Status Message Error
etcd-0 True {"health":"true"}
- Then build the code with below changes
<details>
<summary>Diff changes</summary>
<br>
```diff
diff --git a/pkg/platform/packet/template.go b/pkg/platform/packet/template.go
index d4da1ad0..ff2a4315 100644
--- a/pkg/platform/packet/template.go
+++ b/pkg/platform/packet/template.go
@@ -18,14 +18,6 @@ var terraformConfigTmpl = `
module "packet-{{.Config.ClusterName}}" {
source = "../lokomotive-kubernetes/packet/flatcar-linux/kubernetes"
- providers = {
- local = local.default
- null = null.default
- template = template.default
- tls = tls.default
- packet = packet.default
- }
-
dns_zone = "{{.Config.DNS.Zone}}"
ssh_keys = {{.SSHPublicKeys}}
diff --git a/pkg/platform/packet/template.go b/pkg/platform/packet/template.go
diff --git a/pkg/platform/packet/template.go b/pkg/platform/packet/template.go
index d4da1ad0..ff2a4315 100644
--- a/pkg/platform/packet/template.go
+++ b/pkg/platform/packet/template.go
@@ -18,14 +18,6 @@ var terraformConfigTmpl = `
module "packet-{{.Config.ClusterName}}" {
source = "../lokomotive-kubernetes/packet/flatcar-linux/kubernetes"
- providers = {
- local = local.default
- null = null.default
- template = template.default
- tls = tls.default
- packet = packet.default
- }
-
dns_zone = "{{.Config.DNS.Zone}}"
ssh_keys = {{.SSHPublicKeys}}
@@ -124,13 +116,6 @@ EOF
module "worker-{{ $pool.Name }}" {
source = "../lokomotive-kubernetes/packet/flatcar-linux/kubernetes/workers"
- providers = {
- local = local.default
- template = template.default
- tls = tls.default
- packet = packet.default
- }
-
dns_zone = "{{$.Config.DNS.Zone}}"
ssh_keys = {{$.SSHPublicKeys}}
@@ -236,12 +221,6 @@ EOF
module "dns" {
source = "../lokomotive-kubernetes/dns/{{.Config.DNS.Provider}}"
- {{ if eq .Config.DNS.Provider "route53" -}}
- providers = {
- aws = aws.default
- }
-
- {{ end -}}
cluster_name = "{{ .Config.ClusterName }}"
controllers_public_ipv4 = module.packet-{{.Config.ClusterName}}.controllers_public_ipv4
controllers_private_ipv4 = module.packet-{{.Config.ClusterName}}.controllers_private_ipv4
@@ -258,7 +237,6 @@ output "dns_entries" {
{{- if eq .Config.DNS.Provider "route53" }}
provider "aws" {
version = "2.48.0"
- alias = "default"
# The Route 53 service doesn't need a specific region to operate, however
# the AWS Terraform provider needs it and the documentation suggests to use
# "us-east-1": https://docs.aws.amazon.com/general/latest/gr/r53.html.
@@ -272,27 +250,22 @@ provider "ct" {
provider "local" {
version = "1.4.0"
- alias = "default"
}
provider "null" {
version = "~> 2.1"
- alias = "default"
}
provider "template" {
version = "~> 2.1"
- alias = "default"
}
provider "tls" {
version = "~> 2.0"
- alias = "default"
}
provider "packet" {
version = "~> 2.7.3"
- alias = "default"
{{- if .Config.AuthToken }}
auth_token = "{{.Config.AuthToken}}"
lokoclt
from above changes and same config fileAfter this, I get this error when I redeploy and apply new terraform changes
It makes 18 retries and exits.
0.1.0+git
version but still encounter the same error. It sometimes make 18 retries or fail between checking healthIs this the expected outcome? Is the cluster supposed to give timeout error?
Hm, I was not able to reproduce it, though I didn't start with v0.1.0
, but from fa3278af, then applied following patch:
diff --git a/assets/lokomotive-kubernetes/aws/flatcar-linux/kubernetes/workers/versions.tf b/assets/lokomotive-kubernetes/aws/flatcar-linux/kubernetes/workers/versions.tf
new file mode 100644
index 00000000..3ff518e7
--- /dev/null
+++ b/assets/lokomotive-kubernetes/aws/flatcar-linux/kubernetes/workers/versions.tf
@@ -0,0 +1,11 @@
+# Terraform version and plugin versions
+
+terraform {
+ required_version = ">= 0.12.0"
+
+ required_providers {
+ aws = "2.48.0"
+ ct = "0.5.0"
+ template = "~> 2.1"
+ }
+}
diff --git a/pkg/platform/aws/template.go b/pkg/platform/aws/template.go
index 828c2da4..4d90616f 100644
--- a/pkg/platform/aws/template.go
+++ b/pkg/platform/aws/template.go
@@ -18,14 +18,6 @@ var terraformConfigTmpl = `
module "aws-{{.Config.ClusterName}}" {
source = "../lokomotive-kubernetes/aws/flatcar-linux/kubernetes"
- providers = {
- aws = aws.default
- local = local.default
- null = null.default
- template = template.default
- tls = tls.default
- }
-
cluster_name = "{{.Config.ClusterName}}"
tags = {{.Tags}}
dns_zone = "{{.Config.DNSZone}}"
@@ -108,10 +100,6 @@ module "aws-{{.Config.ClusterName}}" {
module "worker-pool-{{ $index }}" {
source = "../lokomotive-kubernetes/aws/flatcar-linux/kubernetes/workers"
- providers = {
- aws = aws.default
- }
-
vpc_id = module.aws-{{ $.Config.ClusterName }}.vpc_id
subnet_ids = flatten([module.aws-{{ $.Config.ClusterName }}.subnet_ids])
security_groups = module.aws-{{ $.Config.ClusterName }}.worker_security_groups
@@ -182,7 +170,6 @@ module "worker-pool-{{ $index }}" {
provider "aws" {
version = "2.48.0"
- alias = "default"
region = "{{.Config.Region}}"
{{- if .Config.CredsPath }}
@@ -196,22 +183,18 @@ provider "ct" {
provider "local" {
version = "1.4.0"
- alias = "default"
}
provider "null" {
version = "~> 2.1"
- alias = "default"
}
provider "template" {
version = "~> 2.1"
- alias = "default"
}
provider "tls" {
version = "~> 2.0"
- alias = "default"
}
# Stub output, which indicates, that Terraform run at least once.
And everything seems to work. Will try to Packet now.
Ok, let me try this
I tried your patch and same steps, AWS
is working fine, but packet
still gives error
On Packet things also seems fine with the following patch:
diff --git a/assets/lokomotive-kubernetes/packet/flatcar-linux/kubernetes/workers/require.tf b/assets/lokomotive-kubernetes/packet/flatcar-linux/kubernetes/workers/require.tf
index 4a4a17bb..1fce2e1a 100644
--- a/assets/lokomotive-kubernetes/packet/flatcar-linux/kubernetes/workers/require.tf
+++ b/assets/lokomotive-kubernetes/packet/flatcar-linux/kubernetes/workers/require.tf
@@ -4,10 +4,7 @@ terraform {
required_version = ">= 0.12.0"
required_providers {
- ct = "= 0.5.0"
- local = "~> 1.2"
- template = "~> 2.1"
- tls = "~> 2.0"
- packet = "~> 2.7.3"
+ ct = "= 0.5.0"
+ packet = "~> 2.7.3"
}
}
diff --git a/pkg/platform/packet/template.go b/pkg/platform/packet/template.go
index d4da1ad0..ff2a4315 100644
--- a/pkg/platform/packet/template.go
+++ b/pkg/platform/packet/template.go
@@ -18,14 +18,6 @@ var terraformConfigTmpl = `
module "packet-{{.Config.ClusterName}}" {
source = "../lokomotive-kubernetes/packet/flatcar-linux/kubernetes"
- providers = {
- local = local.default
- null = null.default
- template = template.default
- tls = tls.default
- packet = packet.default
- }
-
dns_zone = "{{.Config.DNS.Zone}}"
ssh_keys = {{.SSHPublicKeys}}
@@ -124,13 +116,6 @@ EOF
module "worker-{{ $pool.Name }}" {
source = "../lokomotive-kubernetes/packet/flatcar-linux/kubernetes/workers"
- providers = {
- local = local.default
- template = template.default
- tls = tls.default
- packet = packet.default
- }
-
dns_zone = "{{$.Config.DNS.Zone}}"
ssh_keys = {{$.SSHPublicKeys}}
@@ -236,12 +221,6 @@ EOF
module "dns" {
source = "../lokomotive-kubernetes/dns/{{.Config.DNS.Provider}}"
- {{ if eq .Config.DNS.Provider "route53" -}}
- providers = {
- aws = aws.default
- }
-
- {{ end -}}
cluster_name = "{{ .Config.ClusterName }}"
controllers_public_ipv4 = module.packet-{{.Config.ClusterName}}.controllers_public_ipv4
controllers_private_ipv4 = module.packet-{{.Config.ClusterName}}.controllers_private_ipv4
@@ -258,7 +237,6 @@ output "dns_entries" {
{{- if eq .Config.DNS.Provider "route53" }}
provider "aws" {
version = "2.48.0"
- alias = "default"
# The Route 53 service doesn't need a specific region to operate, however
# the AWS Terraform provider needs it and the documentation suggests to use
# "us-east-1": https://docs.aws.amazon.com/general/latest/gr/r53.html.
@@ -272,27 +250,22 @@ provider "ct" {
provider "local" {
version = "1.4.0"
- alias = "default"
}
provider "null" {
version = "~> 2.1"
- alias = "default"
}
provider "template" {
version = "~> 2.1"
- alias = "default"
}
provider "tls" {
version = "~> 2.0"
- alias = "default"
}
provider "packet" {
version = "~> 2.7.3"
- alias = "default"
{{- if .Config.AuthToken }}
auth_token = "{{.Config.AuthToken}}"
Let me try, just a small question, why removed tls, template, and template
from required providers?
Let me try, just a small question, why removed tls, template, and template from required providers?
Just a side cleanup, not necessarily part of this task, but something we should do, as those providers are not used in this module.
I don't know, still not able to check health. Same error, I applied the same patch
To be able to upgrade from this patch, I did the following:
sed -i 's/provider.template.default/provider.template/g' lokomotive-assets/terraform/terraform.tfstate
sed -i 's/provider.aws.default/provider.aws/g' lokomotive-assets/terraform/terraform.tfstate
Though I am not sure if this is the right approach :smile:
Terraform recommends modules to specify the required providers and only root module (top level) should instantiate the providers, so it has full control over their configuration.
This means we should do this for all Terraform code:
And ensure, that all modules has something like:
Note: this may break the updates. See https://github.com/kinvolk/lokomotive/pull/532 for more details.
More refs: