Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

Add networking-daemonsets feature #1195

Merged
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
kube-aws
/artifacts/template.json
/bin
/e2e/assets
*~
/core/*/config/templates.go
/core/*/config/files.go
.idea/
.envrc
coverage.txt
Expand All @@ -16,3 +15,4 @@ _book
*.mobi
*.pdf
node_modules
kube-aws
20 changes: 17 additions & 3 deletions build
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,23 @@ fi

echo Building kube-aws ${VERSION}

go generate ./core/controlplane/config
go generate ./core/nodepool/config
go generate ./core/root/config
# generate controlplane templates
pushd core/controlplane/config
go run ../../../codegen/templates_gen.go CloudConfigController=cloud-config-controller CloudConfigWorker=cloud-config-worker CloudConfigEtcd=cloud-config-etcd DefaultClusterConfig=cluster.yaml KubeConfigTemplate=kubeconfig.tmpl StackTemplateTemplate=stack-template.json
gofmt -w templates.go
go run ../../../codegen/files_gen.go Etcdadm=../../../etcdadm/etcdadm
gofmt -w files.go
popd

pushd core/nodepool/config
go run ../../../codegen/templates_gen.go StackTemplateTemplate=stack-template.json
gofmt -w templates.go
popd

pushd core/root/config
go run ../../../codegen/templates_gen.go StackTemplateTemplate=stack-template.json
gofmt -w templates.go
popd

if [[ ! "${BUILD_GOOS:-}" == "" ]];then
export GOOS=$BUILD_GOOS
Expand Down
63 changes: 55 additions & 8 deletions core/controlplane/config/config.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
package config

//go:generate go run ../../../codegen/templates_gen.go CloudConfigController=cloud-config-controller CloudConfigWorker=cloud-config-worker CloudConfigEtcd=cloud-config-etcd DefaultClusterConfig=cluster.yaml KubeConfigTemplate=kubeconfig.tmpl StackTemplateTemplate=stack-template.json
//go:generate gofmt -w templates.go
//go:generate go run ../../../codegen/files_gen.go Etcdadm=../../../etcdadm/etcdadm
//go:generate gofmt -w files.go

import (
"encoding/json"
"errors"
Expand Down Expand Up @@ -33,6 +28,13 @@ const (

credentialsDir = "credentials"
userDataDir = "userdata"

// Experimental SelfHosting feature default images.
kubeNetworkingSelfHostingDefaultCalicoNodeImageTag = "v3.0.3"
kubeNetworkingSelfHostingDefaultCalicoCniImageTag = "v2.0.1"
kubeNetworkingSelfHostingDefaultFlannelImageTag = "v0.9.1"
kubeNetworkingSelfHostingDefaultFlannelCniImageTag = "v0.3.0"
kubeNetworkingSelfHostingDefaultTyphaImageTag = "v0.6.2"
)

func NewDefaultCluster() *Cluster {
Expand Down Expand Up @@ -170,6 +172,20 @@ func NewDefaultCluster() *Cluster {
AdminPrivileges: true,
InsecureLogin: false,
},
Kubernetes: Kubernetes{
Networking: Networking{
SelfHosting: SelfHosting{
Enabled: false,
Type: "canal",
Typha: false,
CalicoNodeImage: model.Image{Repo: "quay.io/calico/node", Tag: kubeNetworkingSelfHostingDefaultCalicoNodeImageTag, RktPullDocker: false},
CalicoCniImage: model.Image{Repo: "quay.io/calico/cni", Tag: kubeNetworkingSelfHostingDefaultCalicoCniImageTag, RktPullDocker: false},
FlannelImage: model.Image{Repo: "quay.io/coreos/flannel", Tag: kubeNetworkingSelfHostingDefaultFlannelImageTag, RktPullDocker: false},
FlannelCniImage: model.Image{Repo: "quay.io/coreos/flannel-cni", Tag: kubeNetworkingSelfHostingDefaultFlannelCniImageTag, RktPullDocker: false},
TyphaImage: model.Image{Repo: "quay.io/calico/typha", Tag: kubeNetworkingSelfHostingDefaultTyphaImageTag, RktPullDocker: false},
},
},
},
CloudFormationStreaming: true,
HyperkubeImage: model.Image{Repo: "k8s.gcr.io/hyperkube-amd64", Tag: k8sVer, RktPullDocker: true},
AWSCliImage: model.Image{Repo: "quay.io/coreos/awscli", Tag: "master", RktPullDocker: false},
Expand Down Expand Up @@ -463,9 +479,11 @@ type DeploymentSettings struct {
KubeDns `yaml:"kubeDns,omitempty"`
KubernetesDashboard `yaml:"kubernetesDashboard,omitempty"`
// Images repository
HyperkubeImage model.Image `yaml:"hyperkubeImage,omitempty"`
AWSCliImage model.Image `yaml:"awsCliImage,omitempty"`
CalicoNodeImage model.Image `yaml:"calicoNodeImage,omitempty"`
HyperkubeImage model.Image `yaml:"hyperkubeImage,omitempty"`
AWSCliImage model.Image `yaml:"awsCliImage,omitempty"`

CalicoNodeImage model.Image `yaml:"calicoNodeImage,omitempty"`

CalicoCniImage model.Image `yaml:"calicoCniImage,omitempty"`
CalicoCtlImage model.Image `yaml:"calicoCtlImage,omitempty"`
CalicoKubeControllersImage model.Image `yaml:"calicoKubeControllersImage,omitempty"`
Expand All @@ -487,6 +505,7 @@ type DeploymentSettings struct {
PauseImage model.Image `yaml:"pauseImage,omitempty"`
FlannelImage model.Image `yaml:"flannelImage,omitempty"`
JournaldCloudWatchLogsImage model.Image `yaml:"journaldCloudWatchLogsImage,omitempty"`
Kubernetes Kubernetes `yaml:"kubernetes,omitempty"`
}

// Part of configuration which is specific to worker nodes
Expand Down Expand Up @@ -680,6 +699,25 @@ type LocalStreaming struct {
interval int `yaml:"interval"`
}

type Kubernetes struct {
Networking Networking `yaml:"networking,omitempty"`
}

type Networking struct {
SelfHosting SelfHosting `yaml:"selfHosting"`
}

type SelfHosting struct {
Enabled bool `yaml:"enabled"`
Type string `yaml:"type"`
Typha bool `yaml:"typha"`
CalicoNodeImage model.Image `yaml:"calicoNodeImage"`
CalicoCniImage model.Image `yaml:"calicoCniImage"`
FlannelImage model.Image `yaml:"flannelImage"`
FlannelCniImage model.Image `yaml:"flannelCniImage"`
TyphaImage model.Image `yaml:"typhaImage"`
}

func (c *LocalStreaming) Interval() int64 {
// Convert from seconds to milliseconds (and return as int64 type)
return int64(c.interval * 1000)
Expand Down Expand Up @@ -1189,6 +1227,15 @@ func (c Cluster) validate() error {
}
}

if c.Kubernetes.Networking.SelfHosting.Enabled {
if (c.Kubernetes.Networking.SelfHosting.Type != "canal") && (c.Kubernetes.Networking.SelfHosting.Type != "flannel") {
return fmt.Errorf("networkingdaemonsets - style must be either 'canal' or 'flannel'")
}
if c.Kubernetes.Networking.SelfHosting.Typha && c.Kubernetes.Networking.SelfHosting.Type != "canal" {
return fmt.Errorf("networkingdaemonsets - you can only enable typha when deploying type 'canal'")
}
}

return nil
}

Expand Down
Loading