kubeadm: Harmonize import names in the controlplane phase with all the other code

pull/6/head
Lucas Käldström 2017-07-04 12:31:46 +03:00
parent 8046bafca5
commit 4bab0e9b54
No known key found for this signature in database
GPG Key ID: 3FA3783D77751514
3 changed files with 121 additions and 121 deletions

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package master package controlplane
import ( import (
"bytes" "bytes"
@ -25,7 +25,7 @@ import (
"github.com/ghodss/yaml" "github.com/ghodss/yaml"
api "k8s.io/api/core/v1" "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
@ -55,8 +55,8 @@ const (
// WriteStaticPodManifests builds manifest objects based on user provided configuration and then dumps it to disk // WriteStaticPodManifests builds manifest objects based on user provided configuration and then dumps it to disk
// where kubelet will pick and schedule them. // where kubelet will pick and schedule them.
func WriteStaticPodManifests(cfg *kubeadmapi.MasterConfiguration) error { func WriteStaticPodManifests(cfg *kubeadmapi.MasterConfiguration) error {
volumes := []api.Volume{k8sVolume()} volumes := []v1.Volume{k8sVolume()}
volumeMounts := []api.VolumeMount{k8sVolumeMount()} volumeMounts := []v1.VolumeMount{k8sVolumeMount()}
if isCertsVolumeMountNeeded() { if isCertsVolumeMountNeeded() {
volumes = append(volumes, certsVolume(cfg)) volumes = append(volumes, certsVolume(cfg))
@ -79,31 +79,31 @@ func WriteStaticPodManifests(cfg *kubeadmapi.MasterConfiguration) error {
} }
// Prepare static pod specs // Prepare static pod specs
staticPodSpecs := map[string]api.Pod{ staticPodSpecs := map[string]v1.Pod{
kubeAPIServer: componentPod(api.Container{ kubeAPIServer: componentPod(v1.Container{
Name: kubeAPIServer, Name: kubeAPIServer,
Image: images.GetCoreImage(images.KubeAPIServerImage, cfg, kubeadmapi.GlobalEnvParams.HyperkubeImage), Image: images.GetCoreImage(images.KubeAPIServerImage, cfg, kubeadmapi.GlobalEnvParams.HyperkubeImage),
Command: getAPIServerCommand(cfg, false, k8sVersion), Command: getAPIServerCommand(cfg, false, k8sVersion),
VolumeMounts: volumeMounts, VolumeMounts: volumeMounts,
LivenessProbe: componentProbe(int(cfg.API.BindPort), "/healthz", api.URISchemeHTTPS), LivenessProbe: componentProbe(int(cfg.API.BindPort), "/healthz", v1.URISchemeHTTPS),
Resources: componentResources("250m"), Resources: componentResources("250m"),
Env: getProxyEnvVars(), Env: getProxyEnvVars(),
}, volumes...), }, volumes...),
kubeControllerManager: componentPod(api.Container{ kubeControllerManager: componentPod(v1.Container{
Name: kubeControllerManager, Name: kubeControllerManager,
Image: images.GetCoreImage(images.KubeControllerManagerImage, cfg, kubeadmapi.GlobalEnvParams.HyperkubeImage), Image: images.GetCoreImage(images.KubeControllerManagerImage, cfg, kubeadmapi.GlobalEnvParams.HyperkubeImage),
Command: getControllerManagerCommand(cfg, false, k8sVersion), Command: getControllerManagerCommand(cfg, false, k8sVersion),
VolumeMounts: volumeMounts, VolumeMounts: volumeMounts,
LivenessProbe: componentProbe(10252, "/healthz", api.URISchemeHTTP), LivenessProbe: componentProbe(10252, "/healthz", v1.URISchemeHTTP),
Resources: componentResources("200m"), Resources: componentResources("200m"),
Env: getProxyEnvVars(), Env: getProxyEnvVars(),
}, volumes...), }, volumes...),
kubeScheduler: componentPod(api.Container{ kubeScheduler: componentPod(v1.Container{
Name: kubeScheduler, Name: kubeScheduler,
Image: images.GetCoreImage(images.KubeSchedulerImage, cfg, kubeadmapi.GlobalEnvParams.HyperkubeImage), Image: images.GetCoreImage(images.KubeSchedulerImage, cfg, kubeadmapi.GlobalEnvParams.HyperkubeImage),
Command: getSchedulerCommand(cfg, false), Command: getSchedulerCommand(cfg, false),
VolumeMounts: []api.VolumeMount{k8sVolumeMount()}, VolumeMounts: []v1.VolumeMount{k8sVolumeMount()},
LivenessProbe: componentProbe(10251, "/healthz", api.URISchemeHTTP), LivenessProbe: componentProbe(10251, "/healthz", v1.URISchemeHTTP),
Resources: componentResources("100m"), Resources: componentResources("100m"),
Env: getProxyEnvVars(), Env: getProxyEnvVars(),
}, k8sVolume()), }, k8sVolume()),
@ -111,16 +111,16 @@ func WriteStaticPodManifests(cfg *kubeadmapi.MasterConfiguration) error {
// Add etcd static pod spec only if external etcd is not configured // Add etcd static pod spec only if external etcd is not configured
if len(cfg.Etcd.Endpoints) == 0 { if len(cfg.Etcd.Endpoints) == 0 {
etcdPod := componentPod(api.Container{ etcdPod := componentPod(v1.Container{
Name: etcd, Name: etcd,
Command: getEtcdCommand(cfg), Command: getEtcdCommand(cfg),
VolumeMounts: []api.VolumeMount{certsVolumeMount(), etcdVolumeMount(cfg.Etcd.DataDir), k8sVolumeMount()}, VolumeMounts: []v1.VolumeMount{certsVolumeMount(), etcdVolumeMount(cfg.Etcd.DataDir), k8sVolumeMount()},
Image: images.GetCoreImage(images.KubeEtcdImage, cfg, kubeadmapi.GlobalEnvParams.EtcdImage), Image: images.GetCoreImage(images.KubeEtcdImage, cfg, kubeadmapi.GlobalEnvParams.EtcdImage),
LivenessProbe: componentProbe(2379, "/health", api.URISchemeHTTP), LivenessProbe: componentProbe(2379, "/health", v1.URISchemeHTTP),
}, certsVolume(cfg), etcdVolume(cfg), k8sVolume()) }, certsVolume(cfg), etcdVolume(cfg), k8sVolume())
etcdPod.Spec.SecurityContext = &api.PodSecurityContext{ etcdPod.Spec.SecurityContext = &v1.PodSecurityContext{
SELinuxOptions: &api.SELinuxOptions{ SELinuxOptions: &v1.SELinuxOptions{
// Unconfine the etcd container so it can write to the data dir with SELinux enforcing: // Unconfine the etcd container so it can write to the data dir with SELinux enforcing:
Type: "spc_t", Type: "spc_t",
}, },
@ -146,34 +146,34 @@ func WriteStaticPodManifests(cfg *kubeadmapi.MasterConfiguration) error {
return nil return nil
} }
func newVolume(name, path string) api.Volume { func newVolume(name, path string) v1.Volume {
return api.Volume{ return v1.Volume{
Name: name, Name: name,
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{Path: path}, HostPath: &v1.HostPathVolumeSource{Path: path},
}, },
} }
} }
func newVolumeMount(name, path string) api.VolumeMount { func newVolumeMount(name, path string) v1.VolumeMount {
return api.VolumeMount{ return v1.VolumeMount{
Name: name, Name: name,
MountPath: path, MountPath: path,
} }
} }
// etcdVolume exposes a path on the host in order to guarantee data survival during reboot. // etcdVolume exposes a path on the host in order to guarantee data survival during reboot.
func etcdVolume(cfg *kubeadmapi.MasterConfiguration) api.Volume { func etcdVolume(cfg *kubeadmapi.MasterConfiguration) v1.Volume {
return api.Volume{ return v1.Volume{
Name: "etcd", Name: "etcd",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{Path: cfg.Etcd.DataDir}, HostPath: &v1.HostPathVolumeSource{Path: cfg.Etcd.DataDir},
}, },
} }
} }
func etcdVolumeMount(dataDir string) api.VolumeMount { func etcdVolumeMount(dataDir string) v1.VolumeMount {
return api.VolumeMount{ return v1.VolumeMount{
Name: "etcd", Name: "etcd",
MountPath: dataDir, MountPath: dataDir,
} }
@ -186,18 +186,18 @@ func isCertsVolumeMountNeeded() bool {
} }
// certsVolume exposes host SSL certificates to pod containers. // certsVolume exposes host SSL certificates to pod containers.
func certsVolume(cfg *kubeadmapi.MasterConfiguration) api.Volume { func certsVolume(cfg *kubeadmapi.MasterConfiguration) v1.Volume {
return api.Volume{ return v1.Volume{
Name: "certs", Name: "certs",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
// TODO(phase1+) make path configurable // TODO(phase1+) make path configurable
HostPath: &api.HostPathVolumeSource{Path: "/etc/ssl/certs"}, HostPath: &v1.HostPathVolumeSource{Path: "/etc/ssl/certs"},
}, },
} }
} }
func certsVolumeMount() api.VolumeMount { func certsVolumeMount() v1.VolumeMount {
return api.VolumeMount{ return v1.VolumeMount{
Name: "certs", Name: "certs",
MountPath: "/etc/ssl/certs", MountPath: "/etc/ssl/certs",
} }
@ -212,69 +212,69 @@ func isPkiVolumeMountNeeded() bool {
return false return false
} }
func pkiVolume() api.Volume { func pkiVolume() v1.Volume {
return api.Volume{ return v1.Volume{
Name: "pki", Name: "pki",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
// TODO(phase1+) make path configurable // TODO(phase1+) make path configurable
HostPath: &api.HostPathVolumeSource{Path: "/etc/pki"}, HostPath: &v1.HostPathVolumeSource{Path: "/etc/pki"},
}, },
} }
} }
func pkiVolumeMount() api.VolumeMount { func pkiVolumeMount() v1.VolumeMount {
return api.VolumeMount{ return v1.VolumeMount{
Name: "pki", Name: "pki",
MountPath: "/etc/pki", MountPath: "/etc/pki",
} }
} }
func flockVolume() api.Volume { func flockVolume() v1.Volume {
return api.Volume{ return v1.Volume{
Name: "var-lock", Name: "var-lock",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{Path: "/var/lock"}, HostPath: &v1.HostPathVolumeSource{Path: "/var/lock"},
}, },
} }
} }
func flockVolumeMount() api.VolumeMount { func flockVolumeMount() v1.VolumeMount {
return api.VolumeMount{ return v1.VolumeMount{
Name: "var-lock", Name: "var-lock",
MountPath: "/var/lock", MountPath: "/var/lock",
ReadOnly: false, ReadOnly: false,
} }
} }
func k8sVolume() api.Volume { func k8sVolume() v1.Volume {
return api.Volume{ return v1.Volume{
Name: "k8s", Name: "k8s",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{Path: kubeadmapi.GlobalEnvParams.KubernetesDir}, HostPath: &v1.HostPathVolumeSource{Path: kubeadmapi.GlobalEnvParams.KubernetesDir},
}, },
} }
} }
func k8sVolumeMount() api.VolumeMount { func k8sVolumeMount() v1.VolumeMount {
return api.VolumeMount{ return v1.VolumeMount{
Name: "k8s", Name: "k8s",
MountPath: kubeadmapi.GlobalEnvParams.KubernetesDir, MountPath: kubeadmapi.GlobalEnvParams.KubernetesDir,
ReadOnly: true, ReadOnly: true,
} }
} }
func componentResources(cpu string) api.ResourceRequirements { func componentResources(cpu string) v1.ResourceRequirements {
return api.ResourceRequirements{ return v1.ResourceRequirements{
Requests: api.ResourceList{ Requests: v1.ResourceList{
api.ResourceName(api.ResourceCPU): resource.MustParse(cpu), v1.ResourceName(v1.ResourceCPU): resource.MustParse(cpu),
}, },
} }
} }
func componentProbe(port int, path string, scheme api.URIScheme) *api.Probe { func componentProbe(port int, path string, scheme v1.URIScheme) *v1.Probe {
return &api.Probe{ return &v1.Probe{
Handler: api.Handler{ Handler: v1.Handler{
HTTPGet: &api.HTTPGetAction{ HTTPGet: &v1.HTTPGetAction{
Host: "127.0.0.1", Host: "127.0.0.1",
Path: path, Path: path,
Port: intstr.FromInt(port), Port: intstr.FromInt(port),
@ -287,8 +287,8 @@ func componentProbe(port int, path string, scheme api.URIScheme) *api.Probe {
} }
} }
func componentPod(container api.Container, volumes ...api.Volume) api.Pod { func componentPod(container v1.Container, volumes ...v1.Volume) v1.Pod {
return api.Pod{ return v1.Pod{
TypeMeta: metav1.TypeMeta{ TypeMeta: metav1.TypeMeta{
APIVersion: "v1", APIVersion: "v1",
Kind: "Pod", Kind: "Pod",
@ -299,8 +299,8 @@ func componentPod(container api.Container, volumes ...api.Volume) api.Pod {
Annotations: map[string]string{kubetypes.CriticalPodAnnotationKey: ""}, Annotations: map[string]string{kubetypes.CriticalPodAnnotationKey: ""},
Labels: map[string]string{"component": container.Name, "tier": "control-plane"}, Labels: map[string]string{"component": container.Name, "tier": "control-plane"},
}, },
Spec: api.PodSpec{ Spec: v1.PodSpec{
Containers: []api.Container{container}, Containers: []v1.Container{container},
HostNetwork: true, HostNetwork: true,
Volumes: volumes, Volumes: volumes,
}, },
@ -429,8 +429,8 @@ func getSchedulerCommand(cfg *kubeadmapi.MasterConfiguration, selfHosted bool) [
return command return command
} }
func getProxyEnvVars() []api.EnvVar { func getProxyEnvVars() []v1.EnvVar {
envs := []api.EnvVar{} envs := []v1.EnvVar{}
for _, env := range os.Environ() { for _, env := range os.Environ() {
pos := strings.Index(env, "=") pos := strings.Index(env, "=")
if pos == -1 { if pos == -1 {
@ -440,18 +440,18 @@ func getProxyEnvVars() []api.EnvVar {
name := env[:pos] name := env[:pos]
value := env[pos+1:] value := env[pos+1:]
if strings.HasSuffix(strings.ToLower(name), "_proxy") && value != "" { if strings.HasSuffix(strings.ToLower(name), "_proxy") && value != "" {
envVar := api.EnvVar{Name: name, Value: value} envVar := v1.EnvVar{Name: name, Value: value}
envs = append(envs, envVar) envs = append(envs, envVar)
} }
} }
return envs return envs
} }
func getSelfHostedAPIServerEnv() []api.EnvVar { func getSelfHostedAPIServerEnv() []v1.EnvVar {
podIPEnvVar := api.EnvVar{ podIPEnvVar := v1.EnvVar{
Name: "POD_IP", Name: "POD_IP",
ValueFrom: &api.EnvVarSource{ ValueFrom: &v1.EnvVarSource{
FieldRef: &api.ObjectFieldSelector{ FieldRef: &v1.ObjectFieldSelector{
FieldPath: "status.podIP", FieldPath: "status.podIP",
}, },
}, },

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package master package controlplane
import ( import (
"fmt" "fmt"
@ -25,7 +25,7 @@ import (
"sort" "sort"
"testing" "testing"
api "k8s.io/api/core/v1" "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/yaml" "k8s.io/apimachinery/pkg/util/yaml"
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
@ -93,7 +93,7 @@ func TestWriteStaticPodManifests(t *testing.T) {
} }
defer manifest.Close() defer manifest.Close()
var pod api.Pod var pod v1.Pod
d := yaml.NewYAMLOrJSONDecoder(manifest, 4096) d := yaml.NewYAMLOrJSONDecoder(manifest, 4096)
if err := d.Decode(&pod); err != nil { if err := d.Decode(&pod); err != nil {
t.Error("WriteStaticPodManifests: error decoding manifests/kube-apiserver.yaml into Pod") t.Error("WriteStaticPodManifests: error decoding manifests/kube-apiserver.yaml into Pod")
@ -131,15 +131,15 @@ func TestNewVolume(t *testing.T) {
var tests = []struct { var tests = []struct {
name string name string
path string path string
expected api.Volume expected v1.Volume
}{ }{
{ {
name: "foo", name: "foo",
path: "/etc/foo", path: "/etc/foo",
expected: api.Volume{ expected: v1.Volume{
Name: "foo", Name: "foo",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{Path: "/etc/foo"}, HostPath: &v1.HostPathVolumeSource{Path: "/etc/foo"},
}}, }},
}, },
} }
@ -167,12 +167,12 @@ func TestNewVolumeMount(t *testing.T) {
var tests = []struct { var tests = []struct {
name string name string
path string path string
expected api.VolumeMount expected v1.VolumeMount
}{ }{
{ {
name: "foo", name: "foo",
path: "/etc/foo", path: "/etc/foo",
expected: api.VolumeMount{ expected: v1.VolumeMount{
Name: "foo", Name: "foo",
MountPath: "/etc/foo", MountPath: "/etc/foo",
}, },
@ -201,16 +201,16 @@ func TestNewVolumeMount(t *testing.T) {
func TestEtcdVolume(t *testing.T) { func TestEtcdVolume(t *testing.T) {
var tests = []struct { var tests = []struct {
cfg *kubeadmapi.MasterConfiguration cfg *kubeadmapi.MasterConfiguration
expected api.Volume expected v1.Volume
}{ }{
{ {
cfg: &kubeadmapi.MasterConfiguration{ cfg: &kubeadmapi.MasterConfiguration{
Etcd: kubeadmapi.Etcd{DataDir: etcdDataDir}, Etcd: kubeadmapi.Etcd{DataDir: etcdDataDir},
}, },
expected: api.Volume{ expected: v1.Volume{
Name: "etcd", Name: "etcd",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{Path: etcdDataDir}, HostPath: &v1.HostPathVolumeSource{Path: etcdDataDir},
}}, }},
}, },
} }
@ -236,10 +236,10 @@ func TestEtcdVolume(t *testing.T) {
func TestEtcdVolumeMount(t *testing.T) { func TestEtcdVolumeMount(t *testing.T) {
var tests = []struct { var tests = []struct {
expected api.VolumeMount expected v1.VolumeMount
}{ }{
{ {
expected: api.VolumeMount{ expected: v1.VolumeMount{
Name: "etcd", Name: "etcd",
MountPath: etcdDataDir, MountPath: etcdDataDir,
}, },
@ -268,14 +268,14 @@ func TestEtcdVolumeMount(t *testing.T) {
func TestCertsVolume(t *testing.T) { func TestCertsVolume(t *testing.T) {
var tests = []struct { var tests = []struct {
cfg *kubeadmapi.MasterConfiguration cfg *kubeadmapi.MasterConfiguration
expected api.Volume expected v1.Volume
}{ }{
{ {
cfg: &kubeadmapi.MasterConfiguration{}, cfg: &kubeadmapi.MasterConfiguration{},
expected: api.Volume{ expected: v1.Volume{
Name: "certs", Name: "certs",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{ HostPath: &v1.HostPathVolumeSource{
Path: "/etc/ssl/certs"}, Path: "/etc/ssl/certs"},
}}, }},
}, },
@ -302,10 +302,10 @@ func TestCertsVolume(t *testing.T) {
func TestCertsVolumeMount(t *testing.T) { func TestCertsVolumeMount(t *testing.T) {
var tests = []struct { var tests = []struct {
expected api.VolumeMount expected v1.VolumeMount
}{ }{
{ {
expected: api.VolumeMount{ expected: v1.VolumeMount{
Name: "certs", Name: "certs",
MountPath: "/etc/ssl/certs", MountPath: "/etc/ssl/certs",
}, },
@ -333,13 +333,13 @@ func TestCertsVolumeMount(t *testing.T) {
func TestK8sVolume(t *testing.T) { func TestK8sVolume(t *testing.T) {
var tests = []struct { var tests = []struct {
expected api.Volume expected v1.Volume
}{ }{
{ {
expected: api.Volume{ expected: v1.Volume{
Name: "k8s", Name: "k8s",
VolumeSource: api.VolumeSource{ VolumeSource: v1.VolumeSource{
HostPath: &api.HostPathVolumeSource{ HostPath: &v1.HostPathVolumeSource{
Path: kubeadmapi.GlobalEnvParams.KubernetesDir}, Path: kubeadmapi.GlobalEnvParams.KubernetesDir},
}}, }},
}, },
@ -366,10 +366,10 @@ func TestK8sVolume(t *testing.T) {
func TestK8sVolumeMount(t *testing.T) { func TestK8sVolumeMount(t *testing.T) {
var tests = []struct { var tests = []struct {
expected api.VolumeMount expected v1.VolumeMount
}{ }{
{ {
expected: api.VolumeMount{ expected: v1.VolumeMount{
Name: "k8s", Name: "k8s",
MountPath: kubeadmapi.GlobalEnvParams.KubernetesDir, MountPath: kubeadmapi.GlobalEnvParams.KubernetesDir,
ReadOnly: true, ReadOnly: true,
@ -416,17 +416,17 @@ func TestComponentProbe(t *testing.T) {
var tests = []struct { var tests = []struct {
port int port int
path string path string
scheme api.URIScheme scheme v1.URIScheme
}{ }{
{ {
port: 1, port: 1,
path: "foo", path: "foo",
scheme: api.URISchemeHTTP, scheme: v1.URISchemeHTTP,
}, },
{ {
port: 2, port: 2,
path: "bar", path: "bar",
scheme: api.URISchemeHTTPS, scheme: v1.URISchemeHTTPS,
}, },
} }
for _, rt := range tests { for _, rt := range tests {
@ -465,8 +465,8 @@ func TestComponentPod(t *testing.T) {
} }
for _, rt := range tests { for _, rt := range tests {
c := api.Container{Name: rt.n} c := v1.Container{Name: rt.n}
v := api.Volume{} v := v1.Volume{}
actual := componentPod(c, v) actual := componentPod(c, v)
if actual.ObjectMeta.Name != rt.n { if actual.ObjectMeta.Name != rt.n {
t.Errorf( t.Errorf(

View File

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package master package controlplane
import ( import (
"fmt" "fmt"
@ -23,7 +23,7 @@ import (
"time" "time"
"k8s.io/api/core/v1" "k8s.io/api/core/v1"
ext "k8s.io/api/extensions/v1beta1" extensions "k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -194,8 +194,8 @@ func waitForPodsWithLabel(client *clientset.Clientset, appLabel string, mustBeRu
} }
// Sources from bootkube templates.go // Sources from bootkube templates.go
func getAPIServerDS(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount, kubeVersion *version.Version) ext.DaemonSet { func getAPIServerDS(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount, kubeVersion *version.Version) extensions.DaemonSet {
ds := ext.DaemonSet{ ds := extensions.DaemonSet{
TypeMeta: metav1.TypeMeta{ TypeMeta: metav1.TypeMeta{
APIVersion: "extensions/v1beta1", APIVersion: "extensions/v1beta1",
Kind: "DaemonSet", Kind: "DaemonSet",
@ -205,7 +205,7 @@ func getAPIServerDS(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, vo
Namespace: "kube-system", Namespace: "kube-system",
Labels: map[string]string{"k8s-app": "self-hosted-" + kubeAPIServer}, Labels: map[string]string{"k8s-app": "self-hosted-" + kubeAPIServer},
}, },
Spec: ext.DaemonSetSpec{ Spec: extensions.DaemonSetSpec{
Template: v1.PodTemplateSpec{ Template: v1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{ Labels: map[string]string{
@ -238,8 +238,8 @@ func getAPIServerDS(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, vo
return ds return ds
} }
func getControllerManagerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount, kubeVersion *version.Version) ext.Deployment { func getControllerManagerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount, kubeVersion *version.Version) extensions.Deployment {
d := ext.Deployment{ d := extensions.Deployment{
TypeMeta: metav1.TypeMeta{ TypeMeta: metav1.TypeMeta{
APIVersion: "extensions/v1beta1", APIVersion: "extensions/v1beta1",
Kind: "Deployment", Kind: "Deployment",
@ -249,11 +249,11 @@ func getControllerManagerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes
Namespace: "kube-system", Namespace: "kube-system",
Labels: map[string]string{"k8s-app": "self-hosted-" + kubeControllerManager}, Labels: map[string]string{"k8s-app": "self-hosted-" + kubeControllerManager},
}, },
Spec: ext.DeploymentSpec{ Spec: extensions.DeploymentSpec{
// TODO bootkube uses 2 replicas // TODO bootkube uses 2 replicas
Strategy: ext.DeploymentStrategy{ Strategy: extensions.DeploymentStrategy{
Type: ext.RollingUpdateDeploymentStrategyType, Type: extensions.RollingUpdateDeploymentStrategyType,
RollingUpdate: &ext.RollingUpdateDeployment{ RollingUpdate: &extensions.RollingUpdateDeployment{
MaxUnavailable: &maxUnavailable, MaxUnavailable: &maxUnavailable,
MaxSurge: &maxSurge, MaxSurge: &maxSurge,
}, },
@ -290,8 +290,8 @@ func getControllerManagerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes
return d return d
} }
func getSchedulerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount) ext.Deployment { func getSchedulerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount) extensions.Deployment {
d := ext.Deployment{ d := extensions.Deployment{
TypeMeta: metav1.TypeMeta{ TypeMeta: metav1.TypeMeta{
APIVersion: "extensions/v1beta1", APIVersion: "extensions/v1beta1",
Kind: "Deployment", Kind: "Deployment",
@ -301,11 +301,11 @@ func getSchedulerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Vo
Namespace: "kube-system", Namespace: "kube-system",
Labels: map[string]string{"k8s-app": "self-hosted-" + kubeScheduler}, Labels: map[string]string{"k8s-app": "self-hosted-" + kubeScheduler},
}, },
Spec: ext.DeploymentSpec{ Spec: extensions.DeploymentSpec{
// TODO bootkube uses 2 replicas // TODO bootkube uses 2 replicas
Strategy: ext.DeploymentStrategy{ Strategy: extensions.DeploymentStrategy{
Type: ext.RollingUpdateDeploymentStrategyType, Type: extensions.RollingUpdateDeploymentStrategyType,
RollingUpdate: &ext.RollingUpdateDeployment{ RollingUpdate: &extensions.RollingUpdateDeployment{
MaxUnavailable: &maxUnavailable, MaxUnavailable: &maxUnavailable,
MaxSurge: &maxSurge, MaxSurge: &maxSurge,
}, },