mirror of https://github.com/k3s-io/k3s
kubeadm: Harmonize import names in the controlplane phase with all the other code
parent
8046bafca5
commit
4bab0e9b54
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package master
|
||||
package controlplane
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
@ -25,7 +25,7 @@ import (
|
|||
|
||||
"github.com/ghodss/yaml"
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"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
|
||||
// where kubelet will pick and schedule them.
|
||||
func WriteStaticPodManifests(cfg *kubeadmapi.MasterConfiguration) error {
|
||||
volumes := []api.Volume{k8sVolume()}
|
||||
volumeMounts := []api.VolumeMount{k8sVolumeMount()}
|
||||
volumes := []v1.Volume{k8sVolume()}
|
||||
volumeMounts := []v1.VolumeMount{k8sVolumeMount()}
|
||||
|
||||
if isCertsVolumeMountNeeded() {
|
||||
volumes = append(volumes, certsVolume(cfg))
|
||||
|
@ -79,31 +79,31 @@ func WriteStaticPodManifests(cfg *kubeadmapi.MasterConfiguration) error {
|
|||
}
|
||||
|
||||
// Prepare static pod specs
|
||||
staticPodSpecs := map[string]api.Pod{
|
||||
kubeAPIServer: componentPod(api.Container{
|
||||
staticPodSpecs := map[string]v1.Pod{
|
||||
kubeAPIServer: componentPod(v1.Container{
|
||||
Name: kubeAPIServer,
|
||||
Image: images.GetCoreImage(images.KubeAPIServerImage, cfg, kubeadmapi.GlobalEnvParams.HyperkubeImage),
|
||||
Command: getAPIServerCommand(cfg, false, k8sVersion),
|
||||
VolumeMounts: volumeMounts,
|
||||
LivenessProbe: componentProbe(int(cfg.API.BindPort), "/healthz", api.URISchemeHTTPS),
|
||||
LivenessProbe: componentProbe(int(cfg.API.BindPort), "/healthz", v1.URISchemeHTTPS),
|
||||
Resources: componentResources("250m"),
|
||||
Env: getProxyEnvVars(),
|
||||
}, volumes...),
|
||||
kubeControllerManager: componentPod(api.Container{
|
||||
kubeControllerManager: componentPod(v1.Container{
|
||||
Name: kubeControllerManager,
|
||||
Image: images.GetCoreImage(images.KubeControllerManagerImage, cfg, kubeadmapi.GlobalEnvParams.HyperkubeImage),
|
||||
Command: getControllerManagerCommand(cfg, false, k8sVersion),
|
||||
VolumeMounts: volumeMounts,
|
||||
LivenessProbe: componentProbe(10252, "/healthz", api.URISchemeHTTP),
|
||||
LivenessProbe: componentProbe(10252, "/healthz", v1.URISchemeHTTP),
|
||||
Resources: componentResources("200m"),
|
||||
Env: getProxyEnvVars(),
|
||||
}, volumes...),
|
||||
kubeScheduler: componentPod(api.Container{
|
||||
kubeScheduler: componentPod(v1.Container{
|
||||
Name: kubeScheduler,
|
||||
Image: images.GetCoreImage(images.KubeSchedulerImage, cfg, kubeadmapi.GlobalEnvParams.HyperkubeImage),
|
||||
Command: getSchedulerCommand(cfg, false),
|
||||
VolumeMounts: []api.VolumeMount{k8sVolumeMount()},
|
||||
LivenessProbe: componentProbe(10251, "/healthz", api.URISchemeHTTP),
|
||||
VolumeMounts: []v1.VolumeMount{k8sVolumeMount()},
|
||||
LivenessProbe: componentProbe(10251, "/healthz", v1.URISchemeHTTP),
|
||||
Resources: componentResources("100m"),
|
||||
Env: getProxyEnvVars(),
|
||||
}, k8sVolume()),
|
||||
|
@ -111,16 +111,16 @@ func WriteStaticPodManifests(cfg *kubeadmapi.MasterConfiguration) error {
|
|||
|
||||
// Add etcd static pod spec only if external etcd is not configured
|
||||
if len(cfg.Etcd.Endpoints) == 0 {
|
||||
etcdPod := componentPod(api.Container{
|
||||
etcdPod := componentPod(v1.Container{
|
||||
Name: etcd,
|
||||
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),
|
||||
LivenessProbe: componentProbe(2379, "/health", api.URISchemeHTTP),
|
||||
LivenessProbe: componentProbe(2379, "/health", v1.URISchemeHTTP),
|
||||
}, certsVolume(cfg), etcdVolume(cfg), k8sVolume())
|
||||
|
||||
etcdPod.Spec.SecurityContext = &api.PodSecurityContext{
|
||||
SELinuxOptions: &api.SELinuxOptions{
|
||||
etcdPod.Spec.SecurityContext = &v1.PodSecurityContext{
|
||||
SELinuxOptions: &v1.SELinuxOptions{
|
||||
// Unconfine the etcd container so it can write to the data dir with SELinux enforcing:
|
||||
Type: "spc_t",
|
||||
},
|
||||
|
@ -146,34 +146,34 @@ func WriteStaticPodManifests(cfg *kubeadmapi.MasterConfiguration) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func newVolume(name, path string) api.Volume {
|
||||
return api.Volume{
|
||||
func newVolume(name, path string) v1.Volume {
|
||||
return v1.Volume{
|
||||
Name: name,
|
||||
VolumeSource: api.VolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{Path: path},
|
||||
VolumeSource: v1.VolumeSource{
|
||||
HostPath: &v1.HostPathVolumeSource{Path: path},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func newVolumeMount(name, path string) api.VolumeMount {
|
||||
return api.VolumeMount{
|
||||
func newVolumeMount(name, path string) v1.VolumeMount {
|
||||
return v1.VolumeMount{
|
||||
Name: name,
|
||||
MountPath: path,
|
||||
}
|
||||
}
|
||||
|
||||
// etcdVolume exposes a path on the host in order to guarantee data survival during reboot.
|
||||
func etcdVolume(cfg *kubeadmapi.MasterConfiguration) api.Volume {
|
||||
return api.Volume{
|
||||
func etcdVolume(cfg *kubeadmapi.MasterConfiguration) v1.Volume {
|
||||
return v1.Volume{
|
||||
Name: "etcd",
|
||||
VolumeSource: api.VolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{Path: cfg.Etcd.DataDir},
|
||||
VolumeSource: v1.VolumeSource{
|
||||
HostPath: &v1.HostPathVolumeSource{Path: cfg.Etcd.DataDir},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func etcdVolumeMount(dataDir string) api.VolumeMount {
|
||||
return api.VolumeMount{
|
||||
func etcdVolumeMount(dataDir string) v1.VolumeMount {
|
||||
return v1.VolumeMount{
|
||||
Name: "etcd",
|
||||
MountPath: dataDir,
|
||||
}
|
||||
|
@ -186,18 +186,18 @@ func isCertsVolumeMountNeeded() bool {
|
|||
}
|
||||
|
||||
// certsVolume exposes host SSL certificates to pod containers.
|
||||
func certsVolume(cfg *kubeadmapi.MasterConfiguration) api.Volume {
|
||||
return api.Volume{
|
||||
func certsVolume(cfg *kubeadmapi.MasterConfiguration) v1.Volume {
|
||||
return v1.Volume{
|
||||
Name: "certs",
|
||||
VolumeSource: api.VolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
// TODO(phase1+) make path configurable
|
||||
HostPath: &api.HostPathVolumeSource{Path: "/etc/ssl/certs"},
|
||||
HostPath: &v1.HostPathVolumeSource{Path: "/etc/ssl/certs"},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func certsVolumeMount() api.VolumeMount {
|
||||
return api.VolumeMount{
|
||||
func certsVolumeMount() v1.VolumeMount {
|
||||
return v1.VolumeMount{
|
||||
Name: "certs",
|
||||
MountPath: "/etc/ssl/certs",
|
||||
}
|
||||
|
@ -212,69 +212,69 @@ func isPkiVolumeMountNeeded() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func pkiVolume() api.Volume {
|
||||
return api.Volume{
|
||||
func pkiVolume() v1.Volume {
|
||||
return v1.Volume{
|
||||
Name: "pki",
|
||||
VolumeSource: api.VolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
// TODO(phase1+) make path configurable
|
||||
HostPath: &api.HostPathVolumeSource{Path: "/etc/pki"},
|
||||
HostPath: &v1.HostPathVolumeSource{Path: "/etc/pki"},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func pkiVolumeMount() api.VolumeMount {
|
||||
return api.VolumeMount{
|
||||
func pkiVolumeMount() v1.VolumeMount {
|
||||
return v1.VolumeMount{
|
||||
Name: "pki",
|
||||
MountPath: "/etc/pki",
|
||||
}
|
||||
}
|
||||
|
||||
func flockVolume() api.Volume {
|
||||
return api.Volume{
|
||||
func flockVolume() v1.Volume {
|
||||
return v1.Volume{
|
||||
Name: "var-lock",
|
||||
VolumeSource: api.VolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{Path: "/var/lock"},
|
||||
VolumeSource: v1.VolumeSource{
|
||||
HostPath: &v1.HostPathVolumeSource{Path: "/var/lock"},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func flockVolumeMount() api.VolumeMount {
|
||||
return api.VolumeMount{
|
||||
func flockVolumeMount() v1.VolumeMount {
|
||||
return v1.VolumeMount{
|
||||
Name: "var-lock",
|
||||
MountPath: "/var/lock",
|
||||
ReadOnly: false,
|
||||
}
|
||||
}
|
||||
|
||||
func k8sVolume() api.Volume {
|
||||
return api.Volume{
|
||||
func k8sVolume() v1.Volume {
|
||||
return v1.Volume{
|
||||
Name: "k8s",
|
||||
VolumeSource: api.VolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{Path: kubeadmapi.GlobalEnvParams.KubernetesDir},
|
||||
VolumeSource: v1.VolumeSource{
|
||||
HostPath: &v1.HostPathVolumeSource{Path: kubeadmapi.GlobalEnvParams.KubernetesDir},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func k8sVolumeMount() api.VolumeMount {
|
||||
return api.VolumeMount{
|
||||
func k8sVolumeMount() v1.VolumeMount {
|
||||
return v1.VolumeMount{
|
||||
Name: "k8s",
|
||||
MountPath: kubeadmapi.GlobalEnvParams.KubernetesDir,
|
||||
ReadOnly: true,
|
||||
}
|
||||
}
|
||||
|
||||
func componentResources(cpu string) api.ResourceRequirements {
|
||||
return api.ResourceRequirements{
|
||||
Requests: api.ResourceList{
|
||||
api.ResourceName(api.ResourceCPU): resource.MustParse(cpu),
|
||||
func componentResources(cpu string) v1.ResourceRequirements {
|
||||
return v1.ResourceRequirements{
|
||||
Requests: v1.ResourceList{
|
||||
v1.ResourceName(v1.ResourceCPU): resource.MustParse(cpu),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func componentProbe(port int, path string, scheme api.URIScheme) *api.Probe {
|
||||
return &api.Probe{
|
||||
Handler: api.Handler{
|
||||
HTTPGet: &api.HTTPGetAction{
|
||||
func componentProbe(port int, path string, scheme v1.URIScheme) *v1.Probe {
|
||||
return &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
HTTPGet: &v1.HTTPGetAction{
|
||||
Host: "127.0.0.1",
|
||||
Path: path,
|
||||
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 {
|
||||
return api.Pod{
|
||||
func componentPod(container v1.Container, volumes ...v1.Volume) v1.Pod {
|
||||
return v1.Pod{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: "v1",
|
||||
Kind: "Pod",
|
||||
|
@ -299,8 +299,8 @@ func componentPod(container api.Container, volumes ...api.Volume) api.Pod {
|
|||
Annotations: map[string]string{kubetypes.CriticalPodAnnotationKey: ""},
|
||||
Labels: map[string]string{"component": container.Name, "tier": "control-plane"},
|
||||
},
|
||||
Spec: api.PodSpec{
|
||||
Containers: []api.Container{container},
|
||||
Spec: v1.PodSpec{
|
||||
Containers: []v1.Container{container},
|
||||
HostNetwork: true,
|
||||
Volumes: volumes,
|
||||
},
|
||||
|
@ -429,8 +429,8 @@ func getSchedulerCommand(cfg *kubeadmapi.MasterConfiguration, selfHosted bool) [
|
|||
return command
|
||||
}
|
||||
|
||||
func getProxyEnvVars() []api.EnvVar {
|
||||
envs := []api.EnvVar{}
|
||||
func getProxyEnvVars() []v1.EnvVar {
|
||||
envs := []v1.EnvVar{}
|
||||
for _, env := range os.Environ() {
|
||||
pos := strings.Index(env, "=")
|
||||
if pos == -1 {
|
||||
|
@ -440,18 +440,18 @@ func getProxyEnvVars() []api.EnvVar {
|
|||
name := env[:pos]
|
||||
value := env[pos+1:]
|
||||
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)
|
||||
}
|
||||
}
|
||||
return envs
|
||||
}
|
||||
|
||||
func getSelfHostedAPIServerEnv() []api.EnvVar {
|
||||
podIPEnvVar := api.EnvVar{
|
||||
func getSelfHostedAPIServerEnv() []v1.EnvVar {
|
||||
podIPEnvVar := v1.EnvVar{
|
||||
Name: "POD_IP",
|
||||
ValueFrom: &api.EnvVarSource{
|
||||
FieldRef: &api.ObjectFieldSelector{
|
||||
ValueFrom: &v1.EnvVarSource{
|
||||
FieldRef: &v1.ObjectFieldSelector{
|
||||
FieldPath: "status.podIP",
|
||||
},
|
||||
},
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package master
|
||||
package controlplane
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -25,7 +25,7 @@ import (
|
|||
"sort"
|
||||
"testing"
|
||||
|
||||
api "k8s.io/api/core/v1"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apimachinery/pkg/util/yaml"
|
||||
"k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm"
|
||||
|
@ -93,7 +93,7 @@ func TestWriteStaticPodManifests(t *testing.T) {
|
|||
}
|
||||
defer manifest.Close()
|
||||
|
||||
var pod api.Pod
|
||||
var pod v1.Pod
|
||||
d := yaml.NewYAMLOrJSONDecoder(manifest, 4096)
|
||||
if err := d.Decode(&pod); err != nil {
|
||||
t.Error("WriteStaticPodManifests: error decoding manifests/kube-apiserver.yaml into Pod")
|
||||
|
@ -131,15 +131,15 @@ func TestNewVolume(t *testing.T) {
|
|||
var tests = []struct {
|
||||
name string
|
||||
path string
|
||||
expected api.Volume
|
||||
expected v1.Volume
|
||||
}{
|
||||
{
|
||||
name: "foo",
|
||||
path: "/etc/foo",
|
||||
expected: api.Volume{
|
||||
expected: v1.Volume{
|
||||
Name: "foo",
|
||||
VolumeSource: api.VolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{Path: "/etc/foo"},
|
||||
VolumeSource: v1.VolumeSource{
|
||||
HostPath: &v1.HostPathVolumeSource{Path: "/etc/foo"},
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
@ -167,12 +167,12 @@ func TestNewVolumeMount(t *testing.T) {
|
|||
var tests = []struct {
|
||||
name string
|
||||
path string
|
||||
expected api.VolumeMount
|
||||
expected v1.VolumeMount
|
||||
}{
|
||||
{
|
||||
name: "foo",
|
||||
path: "/etc/foo",
|
||||
expected: api.VolumeMount{
|
||||
expected: v1.VolumeMount{
|
||||
Name: "foo",
|
||||
MountPath: "/etc/foo",
|
||||
},
|
||||
|
@ -201,16 +201,16 @@ func TestNewVolumeMount(t *testing.T) {
|
|||
func TestEtcdVolume(t *testing.T) {
|
||||
var tests = []struct {
|
||||
cfg *kubeadmapi.MasterConfiguration
|
||||
expected api.Volume
|
||||
expected v1.Volume
|
||||
}{
|
||||
{
|
||||
cfg: &kubeadmapi.MasterConfiguration{
|
||||
Etcd: kubeadmapi.Etcd{DataDir: etcdDataDir},
|
||||
},
|
||||
expected: api.Volume{
|
||||
expected: v1.Volume{
|
||||
Name: "etcd",
|
||||
VolumeSource: api.VolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{Path: etcdDataDir},
|
||||
VolumeSource: v1.VolumeSource{
|
||||
HostPath: &v1.HostPathVolumeSource{Path: etcdDataDir},
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
@ -236,10 +236,10 @@ func TestEtcdVolume(t *testing.T) {
|
|||
|
||||
func TestEtcdVolumeMount(t *testing.T) {
|
||||
var tests = []struct {
|
||||
expected api.VolumeMount
|
||||
expected v1.VolumeMount
|
||||
}{
|
||||
{
|
||||
expected: api.VolumeMount{
|
||||
expected: v1.VolumeMount{
|
||||
Name: "etcd",
|
||||
MountPath: etcdDataDir,
|
||||
},
|
||||
|
@ -268,14 +268,14 @@ func TestEtcdVolumeMount(t *testing.T) {
|
|||
func TestCertsVolume(t *testing.T) {
|
||||
var tests = []struct {
|
||||
cfg *kubeadmapi.MasterConfiguration
|
||||
expected api.Volume
|
||||
expected v1.Volume
|
||||
}{
|
||||
{
|
||||
cfg: &kubeadmapi.MasterConfiguration{},
|
||||
expected: api.Volume{
|
||||
expected: v1.Volume{
|
||||
Name: "certs",
|
||||
VolumeSource: api.VolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
HostPath: &v1.HostPathVolumeSource{
|
||||
Path: "/etc/ssl/certs"},
|
||||
}},
|
||||
},
|
||||
|
@ -302,10 +302,10 @@ func TestCertsVolume(t *testing.T) {
|
|||
|
||||
func TestCertsVolumeMount(t *testing.T) {
|
||||
var tests = []struct {
|
||||
expected api.VolumeMount
|
||||
expected v1.VolumeMount
|
||||
}{
|
||||
{
|
||||
expected: api.VolumeMount{
|
||||
expected: v1.VolumeMount{
|
||||
Name: "certs",
|
||||
MountPath: "/etc/ssl/certs",
|
||||
},
|
||||
|
@ -333,13 +333,13 @@ func TestCertsVolumeMount(t *testing.T) {
|
|||
|
||||
func TestK8sVolume(t *testing.T) {
|
||||
var tests = []struct {
|
||||
expected api.Volume
|
||||
expected v1.Volume
|
||||
}{
|
||||
{
|
||||
expected: api.Volume{
|
||||
expected: v1.Volume{
|
||||
Name: "k8s",
|
||||
VolumeSource: api.VolumeSource{
|
||||
HostPath: &api.HostPathVolumeSource{
|
||||
VolumeSource: v1.VolumeSource{
|
||||
HostPath: &v1.HostPathVolumeSource{
|
||||
Path: kubeadmapi.GlobalEnvParams.KubernetesDir},
|
||||
}},
|
||||
},
|
||||
|
@ -366,10 +366,10 @@ func TestK8sVolume(t *testing.T) {
|
|||
|
||||
func TestK8sVolumeMount(t *testing.T) {
|
||||
var tests = []struct {
|
||||
expected api.VolumeMount
|
||||
expected v1.VolumeMount
|
||||
}{
|
||||
{
|
||||
expected: api.VolumeMount{
|
||||
expected: v1.VolumeMount{
|
||||
Name: "k8s",
|
||||
MountPath: kubeadmapi.GlobalEnvParams.KubernetesDir,
|
||||
ReadOnly: true,
|
||||
|
@ -416,17 +416,17 @@ func TestComponentProbe(t *testing.T) {
|
|||
var tests = []struct {
|
||||
port int
|
||||
path string
|
||||
scheme api.URIScheme
|
||||
scheme v1.URIScheme
|
||||
}{
|
||||
{
|
||||
port: 1,
|
||||
path: "foo",
|
||||
scheme: api.URISchemeHTTP,
|
||||
scheme: v1.URISchemeHTTP,
|
||||
},
|
||||
{
|
||||
port: 2,
|
||||
path: "bar",
|
||||
scheme: api.URISchemeHTTPS,
|
||||
scheme: v1.URISchemeHTTPS,
|
||||
},
|
||||
}
|
||||
for _, rt := range tests {
|
||||
|
@ -465,8 +465,8 @@ func TestComponentPod(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, rt := range tests {
|
||||
c := api.Container{Name: rt.n}
|
||||
v := api.Volume{}
|
||||
c := v1.Container{Name: rt.n}
|
||||
v := v1.Volume{}
|
||||
actual := componentPod(c, v)
|
||||
if actual.ObjectMeta.Name != rt.n {
|
||||
t.Errorf(
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
package master
|
||||
package controlplane
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -23,7 +23,7 @@ import (
|
|||
"time"
|
||||
|
||||
"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"
|
||||
"k8s.io/apimachinery/pkg/util/intstr"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
|
@ -194,8 +194,8 @@ func waitForPodsWithLabel(client *clientset.Clientset, appLabel string, mustBeRu
|
|||
}
|
||||
|
||||
// Sources from bootkube templates.go
|
||||
func getAPIServerDS(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount, kubeVersion *version.Version) ext.DaemonSet {
|
||||
ds := ext.DaemonSet{
|
||||
func getAPIServerDS(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount, kubeVersion *version.Version) extensions.DaemonSet {
|
||||
ds := extensions.DaemonSet{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: "extensions/v1beta1",
|
||||
Kind: "DaemonSet",
|
||||
|
@ -205,7 +205,7 @@ func getAPIServerDS(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, vo
|
|||
Namespace: "kube-system",
|
||||
Labels: map[string]string{"k8s-app": "self-hosted-" + kubeAPIServer},
|
||||
},
|
||||
Spec: ext.DaemonSetSpec{
|
||||
Spec: extensions.DaemonSetSpec{
|
||||
Template: v1.PodTemplateSpec{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Labels: map[string]string{
|
||||
|
@ -238,8 +238,8 @@ func getAPIServerDS(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, vo
|
|||
return ds
|
||||
}
|
||||
|
||||
func getControllerManagerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount, kubeVersion *version.Version) ext.Deployment {
|
||||
d := ext.Deployment{
|
||||
func getControllerManagerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount, kubeVersion *version.Version) extensions.Deployment {
|
||||
d := extensions.Deployment{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: "extensions/v1beta1",
|
||||
Kind: "Deployment",
|
||||
|
@ -249,11 +249,11 @@ func getControllerManagerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes
|
|||
Namespace: "kube-system",
|
||||
Labels: map[string]string{"k8s-app": "self-hosted-" + kubeControllerManager},
|
||||
},
|
||||
Spec: ext.DeploymentSpec{
|
||||
Spec: extensions.DeploymentSpec{
|
||||
// TODO bootkube uses 2 replicas
|
||||
Strategy: ext.DeploymentStrategy{
|
||||
Type: ext.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &ext.RollingUpdateDeployment{
|
||||
Strategy: extensions.DeploymentStrategy{
|
||||
Type: extensions.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &extensions.RollingUpdateDeployment{
|
||||
MaxUnavailable: &maxUnavailable,
|
||||
MaxSurge: &maxSurge,
|
||||
},
|
||||
|
@ -290,8 +290,8 @@ func getControllerManagerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes
|
|||
return d
|
||||
}
|
||||
|
||||
func getSchedulerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount) ext.Deployment {
|
||||
d := ext.Deployment{
|
||||
func getSchedulerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Volume, volumeMounts []v1.VolumeMount) extensions.Deployment {
|
||||
d := extensions.Deployment{
|
||||
TypeMeta: metav1.TypeMeta{
|
||||
APIVersion: "extensions/v1beta1",
|
||||
Kind: "Deployment",
|
||||
|
@ -301,11 +301,11 @@ func getSchedulerDeployment(cfg *kubeadmapi.MasterConfiguration, volumes []v1.Vo
|
|||
Namespace: "kube-system",
|
||||
Labels: map[string]string{"k8s-app": "self-hosted-" + kubeScheduler},
|
||||
},
|
||||
Spec: ext.DeploymentSpec{
|
||||
Spec: extensions.DeploymentSpec{
|
||||
// TODO bootkube uses 2 replicas
|
||||
Strategy: ext.DeploymentStrategy{
|
||||
Type: ext.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &ext.RollingUpdateDeployment{
|
||||
Strategy: extensions.DeploymentStrategy{
|
||||
Type: extensions.RollingUpdateDeploymentStrategyType,
|
||||
RollingUpdate: &extensions.RollingUpdateDeployment{
|
||||
MaxUnavailable: &maxUnavailable,
|
||||
MaxSurge: &maxSurge,
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue