Skip to content

Commit

Permalink
get TNC to a working state
Browse files Browse the repository at this point in the history
  • Loading branch information
enxebre committed Mar 2, 2018
1 parent a9a940d commit d6ff12c
Show file tree
Hide file tree
Showing 21 changed files with 91 additions and 186 deletions.
2 changes: 1 addition & 1 deletion installer/pkg/workflow/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func installBootstrapStep(m *metadata) error {
return err
}

if err := waitForNCG(m); err != nil {
if err := waitForTNC(m); err != nil {
return err
}

Expand Down
11 changes: 6 additions & 5 deletions installer/pkg/workflow/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
configFileName = "config.yaml"
kubeConfigPath = "generated/auth/kubeconfig"
binaryPrefix = "tectonic-installer"
tncDaemonSet = "tectonic-node-controller"
)

func copyFile(fromFilePath, toFilePath string) error {
Expand All @@ -50,7 +51,7 @@ func destroyCNAME(clusterDir string) error {
if err != nil {
return err
}
return terraformExec(clusterDir, "destroy", "-force", fmt.Sprintf("-state=%s.tfstate", bootstrapStep), "-target=aws_route53_record.tectonic_ncg", templatesPath)
return terraformExec(clusterDir, "destroy", "-force", fmt.Sprintf("-state=%s.tfstate", bootstrapStep), "-target=aws_route53_record.tectonic_tnc", templatesPath)
}

func findTemplates(relativePath string) (string, error) {
Expand Down Expand Up @@ -154,7 +155,7 @@ func readClusterConfigStep(m *metadata) error {
return nil
}

func waitForNCG(m *metadata) error {
func waitForTNC(m *metadata) error {
config, err := clientcmd.BuildConfigFromFlags("", filepath.Join(m.clusterDir, kubeConfigPath))
if err != nil {
return err
Expand All @@ -169,16 +170,16 @@ func waitForNCG(m *metadata) error {
wait := 10
for retries > 0 {
// client will error until api sever is up
ds, _ := client.DaemonSets("kube-system").Get("ncg")
log.Printf("Waiting for NCG to be running, this might take a while...")
ds, _ := client.DaemonSets("kube-system").Get(tncDaemonSet)
log.Printf("Waiting for TNC to be running, this might take a while...")
if ds.Status.NumberReady >= 1 {
return nil
}
time.Sleep(time.Second * time.Duration(wait))
retries--
}

return errors.New("NCG is not running")
return errors.New("TNC is not running")
}

func writeFile(path, content string) error {
Expand Down
6 changes: 3 additions & 3 deletions modules/aws/master-asg/master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ resource "aws_autoscaling_group" "masters" {
}
}

data "ignition_config" "ncg_master" {
data "ignition_config" "tnc_master" {
append {
source = "http://${var.cluster_name}-ncg.${var.base_domain}/ign/v1/role/master"
source = "http://${var.cluster_name}-tnc.${var.base_domain}/ign?role=master"
}

files = ["${data.ignition_file.kubelet_master_kubeconfig.id}"]
Expand All @@ -85,7 +85,7 @@ resource "aws_launch_configuration" "master_conf" {
security_groups = ["${var.master_sg_ids}"]
iam_instance_profile = "${aws_iam_instance_profile.master_profile.arn}"
associate_public_ip_address = "${var.public_endpoints}"
user_data = "${data.ignition_config.ncg_master.rendered}"
user_data = "${data.ignition_config.tnc_master.rendered}"

lifecycle {
create_before_destroy = true
Expand Down
10 changes: 5 additions & 5 deletions modules/aws/vpc/master-elb.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
resource "aws_elb" "ncg" {
resource "aws_elb" "tnc" {
count = "${var.private_master_endpoints}"
name = "${var.cluster_name}-ncg"
name = "${var.cluster_name}-tnc"
subnets = ["${local.master_subnet_ids}"]
internal = true
security_groups = ["${aws_security_group.ncg.id}"]
security_groups = ["${aws_security_group.tnc.id}"]

idle_timeout = 3600
connection_draining = true
connection_draining_timeout = 300

listener {
instance_port = 8080
instance_port = 45900
instance_protocol = "tcp"
lb_port = 80
lb_protocol = "tcp"
Expand All @@ -20,7 +20,7 @@ resource "aws_elb" "ncg" {
healthy_threshold = 2
unhealthy_threshold = 2
timeout = 3
target = "TCP:8080"
target = "TCP:45900"
interval = 5
}

Expand Down
10 changes: 5 additions & 5 deletions modules/aws/vpc/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ output "aws_elb_console_id" {
}

output "aws_lbs" {
value = ["${compact(concat(aws_elb.api_internal.*.id, list(aws_elb.console.id), aws_elb.api_external.*.id, aws_elb.ncg.*.id))}"]
value = ["${compact(concat(aws_elb.api_internal.*.id, list(aws_elb.console.id), aws_elb.api_external.*.id, aws_elb.tnc.*.id))}"]
}

output "aws_api_external_dns_name" {
Expand All @@ -72,10 +72,10 @@ output "aws_elb_console_zone_id" {
value = "${aws_elb.console.zone_id}"
}

output "aws_elb_ncg_dns_name" {
value = "${element(concat(aws_elb.ncg.*.dns_name, list("")), 0)}"
output "aws_elb_tnc_dns_name" {
value = "${element(concat(aws_elb.tnc.*.dns_name, list("")), 0)}"
}

output "aws_elb_ncg_zone_id" {
value = "${element(concat(aws_elb.ncg.*.zone_id, list("")), 0)}"
output "aws_elb_tnc_zone_id" {
value = "${element(concat(aws_elb.tnc.*.zone_id, list("")), 0)}"
}
2 changes: 1 addition & 1 deletion modules/aws/vpc/sg-elb.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "aws_security_group" "ncg" {
resource "aws_security_group" "tnc" {
vpc_id = "${data.aws_vpc.cluster_vpc.id}"

tags = "${merge(map(
Expand Down
6 changes: 3 additions & 3 deletions modules/aws/vpc/sg-master.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ resource "aws_security_group" "master" {
), var.extra_tags)}"
}

resource "aws_security_group_rule" "master_ncg" {
resource "aws_security_group_rule" "master_tnc" {
type = "ingress"
security_group_id = "${aws_security_group.master.id}"

protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
from_port = 8080
to_port = 8080
from_port = 45900
to_port = 45900
}

resource "aws_security_group_rule" "master_egress" {
Expand Down
6 changes: 3 additions & 3 deletions modules/aws/worker-asg/worker.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ data "aws_ami" "coreos_ami" {
}
}

data "ignition_config" "ncg_worker" {
data "ignition_config" "tnc_worker" {
append {
source = "http://${var.cluster_name}-ncg.${var.base_domain}/ign/v1/role/worker"
source = "http://${var.cluster_name}-tnc.${var.base_domain}/ign?role=worker"
}

files = ["${data.ignition_file.kubelet_worker_kubeconfig.id}"]
Expand All @@ -50,7 +50,7 @@ resource "aws_launch_configuration" "worker_conf" {
key_name = "${var.ssh_key}"
security_groups = ["${var.sg_ids}"]
iam_instance_profile = "${aws_iam_instance_profile.worker_profile.arn}"
user_data = "${data.ignition_config.ncg_worker.rendered}"
user_data = "${data.ignition_config.tnc_worker.rendered}"

lifecycle {
create_before_destroy = true
Expand Down
3 changes: 0 additions & 3 deletions modules/bootkube-ut2/assets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ resource "template_dir" "bootkube" {
pull_secret = "${base64encode(file(var.pull_secret_path))}"
serviceaccount_pub = "${base64encode(tls_private_key.service_account.public_key_pem)}"
serviceaccount_key = "${base64encode(tls_private_key.service_account.private_key_pem)}"
ncg_config_worker = "${var.ncg_config_worker}"
ncg_config_master = "${var.ncg_config_master}"
kube_dns_service_ip = "${cidrhost(var.service_cidr, 10)}"

etcd_ca_cert = "${base64encode(var.etcd_ca_cert_pem)}"
Expand Down Expand Up @@ -170,4 +168,3 @@ data "ignition_systemd_unit" "bootkube_path_unit" {
enabled = true
content = "${data.template_file.bootkube_path_unit.rendered}"
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: tectonic-node-controller-config-v1
namespace: kube-system
data:
tnc-config: |
HTTPProxy: "${http_proxy}"
HTTPSProxy: "${https_proxy}"
NoProxy: "${no_proxy}"
KubeletImageUrl: "${kubelet_image_url}"
KubeletImageTag: "${kubelet_image_tag}"
IscsiEnabled: "${iscsi_enabled}"
KubeconfigFetchCmd: "${kubeconfig_fetch_cmd}"
TectonicTorcxImageURL: "${tectonic_torcx_image_url}"
TectonicTorcxImageTag: "${tectonic_torcx_image_tag}"
BootstrapUpgradeCl: "${bootstrap_upgrade_cl}"
TorcxStoreULL: "${torcx_store_url}"
TorcxSkipSetup: "${torcx_skip_setup}"
NodeLabel: "${node_label}"
NodeTaintsParam: "${node_taints_param}"
ClusterDNSIP: "${cluster_dns_ip}"
CloudProvider: "${cloud_provider}"
CloudProviderConfig: "${cloud_provider_config}"
DebugConfig: "${debug_config}"
ClusterName: "${cluster_name}"
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: apps/v1beta2
kind: DaemonSet
metadata:
name: tectonic-node-controller
namespace: tectonic-system
namespace: kube-system
labels:
k8s-app: tectonic-node-controller
managed-by-channel-operator: "true"
Expand All @@ -23,12 +23,11 @@ spec:
containers:
- name: tectonic-node-controller
image: ${tnc_bootstrap_image}
command:
- /bootstrap
- --config=/etc/cluster-config
args:
- --config=/etc/cluster-config/tnc-config
- --port=45900
- --cert=/opt/tectonic/tls/root-ca.crt
- --key=/opt/tectonic/tls/root-ca.key
- --cert=/opt/tectonic/tls/ca.crt
- --key=/opt/tectonic/tls/ca.key
resources:
limits:
cpu: 20m
Expand All @@ -51,7 +50,7 @@ spec:
volumes:
- name: cluster-config
configMap:
name: cluster-config-v1
name: tectonic-node-controller-config-v1
items:
- key: tnc-config
path: tnc-config
Expand Down
11 changes: 0 additions & 11 deletions modules/bootkube-ut2/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,6 @@ variable "tectonic_networking" {
type = "string"
}

variable "ncg_config_worker" {
description = "configures the network to be used in the cluster"
type = "string"
}

variable "ncg_config_master" {
description = "configures the network to be used in the cluster"
type = "string"
}

variable "http_proxy" {
type = "string"
description = "HTTP proxy address."
Expand Down Expand Up @@ -255,4 +245,3 @@ EOF

type = "string"
}

103 changes: 0 additions & 103 deletions steps/assets/ignition-ncg.tf

This file was deleted.

2 changes: 1 addition & 1 deletion steps/assets/resources/rm-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ s3_clean() {
set -o pipefail
REGION=$(wget -q -O - http://169.254.169.254/latest/meta-data/placement/availability-zone | sed '"'"'s/[a-zA-Z]$//'"'"')
/usr/bin/aws --region="$REGION" s3 cp /tmp/assets.zip s3://"$LOCATION/assets.zip"
/usr/bin/aws --region="$REGION" s3 cp /tmp/assets.zip s3://"$LOCATION/ignition"
/usr/bin/aws --region="$REGION" s3 cp /tmp/assets.zip s3://"$LOCATION/ign"
'
}

Expand Down
Loading

0 comments on commit d6ff12c

Please sign in to comment.