TritonDataCenter / triton-kubernetes

Kubernetes on Triton
Mozilla Public License 2.0
183 stars 43 forks source link

create cluster - No Networks found by name "Joyent-SDC-Public" #78

Open neuroserve opened 6 years ago

neuroserve commented 6 years ago

Deploying a pair of managers in an on premise Triton installation works like charm. triton-kubernetes talks to the api to learn images, packages and networks.

Deploying a cluster (and nodes for it) does not work because the network "Joyent-SDC-Public" is defined somewhere statically and cannot be changed during the "question and answer" phase. And changing various occurrences of "Joyent-SDC-Public" in various terraform *tf files did not help either.

The error message is:

Error: Error refreshing state: 1 error(s) occurred:

It would be nice, if the network variable could be changed for every time, it is required by Terraform to create the respective VMs.

fayazg commented 6 years ago

Are you still having this issue after the go rewrite?

Smithx10 commented 6 years ago

@fayazg

I can confirm, I just tried in a Private Cloud also.

Also, the managers aren't coming up clean if the entire cluster gets rebooted at the same time. Can we deploy mysql autopilotpattern/mysql?

edit: Actually, that's not very portable to other clouds.

https://github.com/autopilotpattern/mysql

data.template_file.install_rancher_master: Refreshing state...
null_resource.install_rancher_master[1]: Refreshing state... (ID: 8469996742215062234)
data.template_file.setup_rancher_k8s: Refreshing state...
null_resource.install_rancher_master[0]: Refreshing state... (ID: 1866960069457497987)
data.external.rancher_environment_template: Refreshing state...
null_resource.setup_rancher_k8s: Refreshing state... (ID: 8757083058364748555)
Releasing state lock. This may take a few moments...

Error: Error refreshing state: 1 error(s) occurred:

* module.cluster_triton_my-cluster.data.triton_network.networks: 1 error(s) occurred:

* module.cluster_triton_my-cluster.data.triton_network.networks: data.triton_network.networks: No Networks found by name "Joyent-SDC-Public"
Smithx10 commented 6 years ago

I found out that by changing the "triton_network_names" default to "my_default_network" in the following two files worked.

terraform/modules/triton-rancher-k8s-host/variables.tf:    "Joyent-SDC-Public",
terraform/modules/triton-rancher-k8s/variables.tf:    "Joyent-SDC-Public",
 62 variable "triton_network_names" {
 63   type        = "list"
 64   description = "List of Triton network names that the node(s) should be attached to."
 65
 66   default = [
 67     "Joyent-SDC-Public",
 68   ]
 69 }

I found this quite quickly by using git grep.

bruce.smith@Bruces-MacBook-Pro /g/s/triton-kubernetes ❯❯❯ git grep Joyent-SDC-Public                                                                                                                                                                    master
examples/silent-install/sample-create-ha-cluster.yaml:      - Joyent-SDC-Public
examples/silent-install/sample-create-ha-cluster.yaml:      - Joyent-SDC-Public
examples/silent-install/sample-create-ha-cluster.yaml:      - Joyent-SDC-Public
examples/silent-install/sample-create-ha-manager.yaml:  - Joyent-SDC-Public
examples/silent-install/sample-create-non-ha-cluster.yaml:      - Joyent-SDC-Public
examples/silent-install/sample-create-non-ha-manager.yaml:  - Joyent-SDC-Public
terraform/create-rancher-env.tf:    "Joyent-SDC-Public",
terraform/create-rancher.tf:  triton_network_names = ["Joyent-SDC-Public", "Joyent-SDC-Private"]
terraform/modules/triton-rancher-k8s-host/variables.tf:    "Joyent-SDC-Public",
terraform/modules/triton-rancher-k8s/variables.tf:    "Joyent-SDC-Public",
vendor/github.com/joyent/triton-go/network/networks_test.go:                                    toFind := []string{"Joyent-SDC-Private", "Joyent-SDC-Public"}

I imagine that there is some logic that is not over riding that default. I might dig into later if I get some time. But this should help until @fayazg can fix it.

neuroserve commented 6 years ago

Hm. Error: Error refreshing state: 1 error(s) occurred:

root@e3b75fc5-3621-cdd8-f9dd-c9acbf4a37e9:~/triton-kubernetes# git grep Joyent-SDC-Public examples/silent-install/sample-create-ha-cluster.yaml - Joyent-SDC-Public examples/silent-install/sample-create-ha-cluster.yaml - Joyent-SDC-Public examples/silent-install/sample-create-ha-cluster.yaml - Joyent-SDC-Public examples/silent-install/sample-create-ha-manager.yaml - Joyent-SDC-Public examples/silent-install/sample-create-non-ha-cluster.yaml - Joyent-SDC-Public examples/silent-install/sample-create-non-ha-manager.yaml - Joyent-SDC-Public vendor/github.com/joyent/triton-go/network/networks_test.go toFind := []string{"Joyent-SDC-Private", "Joyent-SDC-Public"}

Do I have to change the "toFind" string in networks_test.go and rebuild?