Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify install scripts with an install config #46

Open
hoeghh opened this issue Aug 22, 2018 · 2 comments
Open

Simplify install scripts with an install config #46

hoeghh opened this issue Aug 22, 2018 · 2 comments
Labels
enhancement New feature or request Implementation

Comments

@hoeghh
Copy link
Owner

hoeghh commented Aug 22, 2018

Right now each host needs to look into a host file and do a lot of jumps to configure itself.

I think it would be smart to generate an install config file that is copied to each host, and used by the install script.

It will make it easier to add more nodes, as it is only to generate a config and then run the same script as the others

It will also make it easier later, to use the scripts outside of this project, or with a provitioning master.

@hoeghh hoeghh added enhancement New feature or request Implementation labels Aug 22, 2018
@hoeghh
Copy link
Owner Author

hoeghh commented Aug 23, 2018

I suggest we create/generate a ktew.env file. Use the same name on each host. The file will tell the what kind of node it should install, and all the information it needs.

@hoeghh
Copy link
Owner Author

hoeghh commented Sep 1, 2018

json for etcd test

{
	"type": "etcd",
	"hostname": "k8s-etcd-03",
	"install": {
		"type": "remote",
		"location": "https://lighthouse.net:8000/clusters/4/k8s-etcd-01"
	},
	"etcd_cluster": [{
			"hostname": "k8s-etcd-01",
			"ip": "192.168.0.25",
			"version": "v3.2.11",
			"status": "not-ready"
		},
		{
			"hostname": "k8s-etcd-02",
			"ip": "192.168.0.26",
			"version": "v3.2.11",
			"status": "ready"
		},
		{
			"hostname": "k8s-etcd-03",
			"ip": "192.168.0.27",
			"version": "v3.2.11",
			"status": "ready"
		}
	]
}

Getting data we need :

export my_hostname=$(cat etcd.json | jq '.hostname' | tr -d \")
export my_ip=$(cat etcd.json | jq '.etcd_cluster[] | select (.hostname=="'$my_hostname'") | .ip' | tr -d \")

export other_ips=$(cat etcd.json | jq '.etcd_cluster[] | select (.hostname=="'$my_hostname'" | not) | .ip' | tr -d \" | tr '\n' ',' |  sed 's/,$//g')

export cluster_list=$(cat etcd.json | jq '.etcd_cluster[] | " \(.hostname)=https://\(.ip)"' | tr -d \" | tr '\n' ',' |  sed 's/,$//g')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Implementation
Projects
None yet
Development

No branches or pull requests

1 participant