Skip to content

Commit dcb5c2c

Browse files
dlorencdlorenc
dlorenc
authored andcommitted
Manual changes for 1.10.
localkube now has to be non-statically compiled :(
1 parent 6ff1639 commit dcb5c2c

File tree

11 files changed

+82
-42
lines changed

11 files changed

+82
-42
lines changed

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ STORAGE_PROVISIONER_TAG := v1.8.1
5252
# Set the version information for the Kubernetes servers, and build localkube statically
5353
K8S_VERSION_LDFLAGS := $(shell $(PYTHON) hack/get_k8s_version.py 2>&1)
5454
MINIKUBE_LDFLAGS := -X k8s.io/minikube/pkg/version.version=$(VERSION) -X k8s.io/minikube/pkg/version.isoVersion=$(ISO_VERSION) -X k8s.io/minikube/pkg/version.isoPath=$(ISO_BUCKET)
55-
LOCALKUBE_LDFLAGS := "$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS) -s -w -extldflags '-static'"
55+
LOCALKUBE_LDFLAGS := "$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS) -s -w"
5656

5757
MAKEDEPEND := GOPATH=$(GOPATH) ./makedepend.sh
5858

@@ -98,14 +98,14 @@ out/minikube$(IS_EXE): out/minikube-$(GOOS)-$(GOARCH)$(IS_EXE)
9898
cp $< $@
9999

100100
out/localkube.d:
101-
$(MAKEDEPEND) out/localkube $(ORG) $(LOCALKUBEFILES) $^ > $@
101+
GOOS=linux GOARCH=amd64 $(MAKEDEPEND) out/localkube $(ORG) $(LOCALKUBEFILES) $^ > $@
102102

103103
-include out/localkube.d
104104
out/localkube:
105105
ifeq ($(LOCALKUBE_BUILD_IN_DOCKER),y)
106106
$(call DOCKER,$(BUILD_IMAGE),/usr/bin/make $@)
107107
else
108-
CGO_ENABLED=1 go build -tags static_build -ldflags=$(LOCALKUBE_LDFLAGS) -o $(BUILD_DIR)/localkube ./cmd/localkube
108+
CGO_ENABLED=1 go build -ldflags=$(LOCALKUBE_LDFLAGS) -o $(BUILD_DIR)/localkube ./cmd/localkube
109109
endif
110110

111111
out/minikube-windows-amd64.exe: out/minikube-windows-amd64

deploy/addons/addon-manager.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ metadata:
1919
namespace: kube-system
2020
labels:
2121
component: kube-addon-manager
22-
version: v6.5
22+
version: v8.6
2323
kubernetes.io/minikube-addons: addon-manager
2424
spec:
2525
hostNetwork: true
2626
containers:
2727
- name: kube-addon-manager
28-
image: gcr.io/google-containers/kube-addon-manager:v6.5
28+
image: gcr.io/google-containers/kube-addon-manager:v8.6
2929
env:
3030
- name: KUBECONFIG
3131
value: /var/lib/localkube/kubeconfig

pkg/localkube/apiserver.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ import (
2828
apiserveroptions "k8s.io/apiserver/pkg/server/options"
2929
"k8s.io/apiserver/pkg/storage/storagebackend"
3030

31+
genericoptions "k8s.io/apiserver/pkg/server/options"
3132
apiserver "k8s.io/kubernetes/cmd/kube-apiserver/app"
3233
"k8s.io/kubernetes/cmd/kube-apiserver/app/options"
33-
kubeapioptions "k8s.io/kubernetes/pkg/kubeapiserver/options"
3434
)
3535

3636
func (lk LocalkubeServer) NewAPIServer() Server {
@@ -69,7 +69,7 @@ func StartAPIServer(lk LocalkubeServer) func() error {
6969

7070
config.AllowPrivileged = true
7171

72-
config.APIEnablement = &kubeapioptions.APIEnablementOptions{
72+
config.APIEnablement = &genericoptions.APIEnablementOptions{
7373
RuntimeConfig: lk.RuntimeConfig,
7474
}
7575

pkg/localkube/controller-manager.go

+17-12
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package localkube
1818

1919
import (
2020
controllerManager "k8s.io/kubernetes/cmd/kube-controller-manager/app"
21+
"k8s.io/kubernetes/cmd/kube-controller-manager/app/config"
2122
"k8s.io/kubernetes/cmd/kube-controller-manager/app/options"
2223
"k8s.io/minikube/pkg/util"
2324
)
@@ -27,24 +28,28 @@ func (lk LocalkubeServer) NewControllerManagerServer() Server {
2728
}
2829

2930
func StartControllerManagerServer(lk LocalkubeServer) func() error {
30-
config := options.NewCMServer()
31+
opts := options.NewKubeControllerManagerOptions()
3132

32-
config.Kubeconfig = util.DefaultKubeConfigPath
33+
opts.Generic.Kubeconfig = util.DefaultKubeConfigPath
3334

3435
// defaults from command
35-
config.DeletingPodsQps = 0.1
36-
config.DeletingPodsBurst = 10
37-
config.NodeEvictionRate = 0.1
36+
opts.Generic.ComponentConfig.DeletingPodsQps = 0.1
37+
opts.Generic.ComponentConfig.DeletingPodsBurst = 10
38+
opts.Generic.ComponentConfig.NodeEvictionRate = 0.1
3839

39-
config.EnableProfiling = true
40-
config.VolumeConfiguration.EnableHostPathProvisioning = true
41-
config.VolumeConfiguration.EnableDynamicProvisioning = true
42-
config.ServiceAccountKeyFile = lk.GetPrivateKeyCertPath()
43-
config.RootCAFile = lk.GetCAPublicKeyCertPath()
40+
opts.Generic.ComponentConfig.EnableProfiling = true
41+
opts.Generic.ComponentConfig.VolumeConfiguration.EnableHostPathProvisioning = true
42+
opts.Generic.ComponentConfig.VolumeConfiguration.EnableDynamicProvisioning = true
43+
opts.Generic.ComponentConfig.ServiceAccountKeyFile = lk.GetPrivateKeyCertPath()
44+
opts.Generic.ComponentConfig.RootCAFile = lk.GetCAPublicKeyCertPath()
4445

45-
lk.SetExtraConfigForComponent("controller-manager", &config)
46+
lk.SetExtraConfigForComponent("controller-manager", &opts)
4647

48+
cfg := config.Config{}
49+
if err := opts.ApplyTo(&cfg); err != nil {
50+
panic(err)
51+
}
4752
return func() error {
48-
return controllerManager.Run(config)
53+
return controllerManager.Run(cfg.Complete())
4954
}
5055
}

pkg/localkube/kubelet.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ limitations under the License.
1717
package localkube
1818

1919
import (
20-
"k8s.io/apiserver/pkg/util/flag"
2120
kubelet "k8s.io/kubernetes/cmd/kubelet/app"
2221
"k8s.io/kubernetes/cmd/kubelet/app/options"
2322
"k8s.io/minikube/pkg/util"
@@ -38,14 +37,13 @@ func StartKubeletServer(lk LocalkubeServer) func() error {
3837
}
3938

4039
// Master details
41-
config.KubeConfig = flag.NewStringFlag(util.DefaultKubeConfigPath)
42-
config.RequireKubeConfig = true
40+
config.KubeConfig = util.DefaultKubeConfigPath
4341

4442
// Set containerized based on the flag
4543
config.Containerized = lk.Containerized
4644

4745
config.AllowPrivileged = true
48-
config.PodManifestPath = "/etc/kubernetes/manifests"
46+
config.StaticPodPath = "/etc/kubernetes/manifests"
4947

5048
// Networking
5149
config.ClusterDomain = lk.DNSDomain
@@ -54,6 +52,7 @@ func StartKubeletServer(lk LocalkubeServer) func() error {
5452
config.PodCIDR = "10.180.1.0/24"
5553

5654
config.NodeIP = lk.NodeIP.String()
55+
config.FailSwapOn = false
5756

5857
if lk.NetworkPlugin != "" {
5958
config.NetworkPluginName = lk.NetworkPlugin

pkg/localkube/localkube.go

+22
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"net/http"
2727
"path"
2828
"strconv"
29+
"strings"
2930

3031
"github.com/golang/glog"
3132
"github.com/pkg/errors"
@@ -179,6 +180,27 @@ func (lk LocalkubeServer) SetExtraConfigForComponent(component string, config in
179180
}
180181
}
181182

183+
func (lk LocalkubeServer) GetFeatureGates() (map[string]bool, error) {
184+
fg := map[string]bool{}
185+
if lk.FeatureGates == "" {
186+
return fg, nil
187+
}
188+
gates := strings.Split(lk.FeatureGates, ",")
189+
for _, g := range gates {
190+
191+
kvp := strings.SplitN(g, "=", 2)
192+
if len(kvp) != 2 {
193+
return nil, fmt.Errorf("invalid feature gate specification: %s", g)
194+
}
195+
value, err := strconv.ParseBool(kvp[1])
196+
if err != nil {
197+
return nil, fmt.Errorf("invalid feature gate specification: %s", g)
198+
}
199+
fg[kvp[0]] = value
200+
}
201+
return fg, nil
202+
}
203+
182204
func (lk LocalkubeServer) loadCert(path string) (*x509.Certificate, error) {
183205
contents, err := ioutil.ReadFile(path)
184206
if err != nil {

pkg/localkube/proxy.go

+8-6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ func StartProxyServer(lk LocalkubeServer) func() error {
4343
}
4444

4545
opts := kubeproxy.NewOptions()
46+
fg, err := lk.GetFeatureGates()
47+
if err != nil {
48+
panic(err)
49+
}
4650
config := &kubeproxyconfig.KubeProxyConfiguration{
4751
OOMScoreAdj: &OOMScoreAdj,
4852
ClientConnection: kubeproxyconfig.ClientConnectionConfiguration{
@@ -58,17 +62,15 @@ func StartProxyServer(lk LocalkubeServer) func() error {
5862
},
5963
BindAddress: bindaddress,
6064
Mode: kubeproxyconfig.ProxyModeIPTables,
61-
FeatureGates: lk.FeatureGates,
65+
FeatureGates: fg,
6266
// Disable the healthz check
63-
HealthzBindAddress: "0",
67+
HealthzBindAddress: "",
6468
}
65-
_, err := opts.ApplyDefaults(config)
66-
if err != nil {
69+
if _, err := opts.ApplyDefaults(config); err != nil {
6770
panic(err)
6871
}
69-
opts.SetConfig(config)
70-
7172
lk.SetExtraConfigForComponent("proxy", &config)
73+
opts.SetConfig(config)
7274

7375
return func() error {
7476
return opts.Run()

pkg/localkube/scheduler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ limitations under the License.
1717
package localkube
1818

1919
import (
20+
scheduler "k8s.io/kubernetes/cmd/kube-scheduler/app"
2021
"k8s.io/kubernetes/pkg/apis/componentconfig"
21-
scheduler "k8s.io/kubernetes/plugin/cmd/kube-scheduler/app"
2222
"k8s.io/minikube/pkg/util"
2323
)
2424

pkg/minikube/bootstrapper/kubeadm/kubeadm_test.go

+16-10
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,30 @@ func TestGenerateConfig(t *testing.T) {
3434
description: "no extra args",
3535
cfg: config.KubernetesConfig{
3636
NodeIP: "192.168.1.100",
37-
KubernetesVersion: "v1.8.0",
37+
KubernetesVersion: "v1.10.0",
3838
NodeName: "minikube",
3939
},
4040
expectedCfg: `apiVersion: kubeadm.k8s.io/v1alpha1
4141
kind: MasterConfiguration
4242
api:
4343
advertiseAddress: 192.168.1.100
4444
bindPort: 8443
45-
kubernetesVersion: v1.8.0
45+
kubernetesVersion: v1.10.0
4646
certificatesDir: /var/lib/localkube/certs/
4747
networking:
4848
serviceSubnet: 10.96.0.0/12
4949
etcd:
5050
dataDir: /data
5151
nodeName: minikube
52+
apiServerExtraArgs:
53+
admission-control: "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
5254
`,
5355
},
5456
{
5557
description: "extra args all components",
5658
cfg: config.KubernetesConfig{
5759
NodeIP: "192.168.1.101",
58-
KubernetesVersion: "v1.8.0-alpha.0",
60+
KubernetesVersion: "v1.10.0-alpha.0",
5961
NodeName: "extra-args-minikube",
6062
ExtraOptions: util.ExtraOptionSlice{
6163
util.ExtraOption{
@@ -80,14 +82,15 @@ kind: MasterConfiguration
8082
api:
8183
advertiseAddress: 192.168.1.101
8284
bindPort: 8443
83-
kubernetesVersion: v1.8.0-alpha.0
85+
kubernetesVersion: v1.10.0-alpha.0
8486
certificatesDir: /var/lib/localkube/certs/
8587
networking:
8688
serviceSubnet: 10.96.0.0/12
8789
etcd:
8890
dataDir: /data
8991
nodeName: extra-args-minikube
9092
apiServerExtraArgs:
93+
admission-control: "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
9194
fail-no-swap: "true"
9295
controllerManagerExtraArgs:
9396
kube-api-burst: "32"
@@ -99,7 +102,7 @@ schedulerExtraArgs:
99102
description: "two extra args for one component",
100103
cfg: config.KubernetesConfig{
101104
NodeIP: "192.168.1.101",
102-
KubernetesVersion: "v1.8.0-alpha.0",
105+
KubernetesVersion: "v1.10.0-alpha.0",
103106
NodeName: "extra-args-minikube",
104107
ExtraOptions: util.ExtraOptionSlice{
105108
util.ExtraOption{
@@ -119,14 +122,15 @@ kind: MasterConfiguration
119122
api:
120123
advertiseAddress: 192.168.1.101
121124
bindPort: 8443
122-
kubernetesVersion: v1.8.0-alpha.0
125+
kubernetesVersion: v1.10.0-alpha.0
123126
certificatesDir: /var/lib/localkube/certs/
124127
networking:
125128
serviceSubnet: 10.96.0.0/12
126129
etcd:
127130
dataDir: /data
128131
nodeName: extra-args-minikube
129132
apiServerExtraArgs:
133+
admission-control: "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
130134
fail-no-swap: "true"
131135
kube-api-burst: "32"
132136
`,
@@ -135,7 +139,7 @@ apiServerExtraArgs:
135139
description: "enable feature gates",
136140
cfg: config.KubernetesConfig{
137141
NodeIP: "192.168.1.101",
138-
KubernetesVersion: "v1.8.0-alpha.0",
142+
KubernetesVersion: "v1.10.0-alpha.0",
139143
NodeName: "extra-args-minikube",
140144
FeatureGates: "HugePages=true,OtherFeature=false",
141145
},
@@ -144,14 +148,15 @@ kind: MasterConfiguration
144148
api:
145149
advertiseAddress: 192.168.1.101
146150
bindPort: 8443
147-
kubernetesVersion: v1.8.0-alpha.0
151+
kubernetesVersion: v1.10.0-alpha.0
148152
certificatesDir: /var/lib/localkube/certs/
149153
networking:
150154
serviceSubnet: 10.96.0.0/12
151155
etcd:
152156
dataDir: /data
153157
nodeName: extra-args-minikube
154158
apiServerExtraArgs:
159+
admission-control: "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
155160
feature-gates: "HugePages=true,OtherFeature=false"
156161
controllerManagerExtraArgs:
157162
feature-gates: "HugePages=true,OtherFeature=false"
@@ -163,7 +168,7 @@ schedulerExtraArgs:
163168
description: "enable feature gates and extra config",
164169
cfg: config.KubernetesConfig{
165170
NodeIP: "192.168.1.101",
166-
KubernetesVersion: "v1.8.0-alpha.0",
171+
KubernetesVersion: "v1.10.0-alpha.0",
167172
NodeName: "extra-args-minikube",
168173
FeatureGates: "HugePages=true,OtherFeature=false",
169174
ExtraOptions: util.ExtraOptionSlice{
@@ -179,14 +184,15 @@ kind: MasterConfiguration
179184
api:
180185
advertiseAddress: 192.168.1.101
181186
bindPort: 8443
182-
kubernetesVersion: v1.8.0-alpha.0
187+
kubernetesVersion: v1.10.0-alpha.0
183188
certificatesDir: /var/lib/localkube/certs/
184189
networking:
185190
serviceSubnet: 10.96.0.0/12
186191
etcd:
187192
dataDir: /data
188193
nodeName: extra-args-minikube
189194
apiServerExtraArgs:
195+
admission-control: "Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,ResourceQuota"
190196
fail-no-swap: "true"
191197
feature-gates: "HugePages=true,OtherFeature=false"
192198
controllerManagerExtraArgs:

pkg/minikube/bootstrapper/kubeadm/versions.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,14 @@ var versionSpecificOpts = []VersionedExtraOption{
173173
// Kubeconfig args
174174
NewUnversionedOption(Kubelet, "kubeconfig", "/etc/kubernetes/kubelet.conf"),
175175
NewUnversionedOption(Kubelet, "bootstrap-kubeconfig", "/etc/kubernetes/bootstrap-kubelet.conf"),
176-
NewUnversionedOption(Kubelet, "require-kubeconfig", "true"),
176+
{
177+
Option: util.ExtraOption{
178+
Component: Apiserver,
179+
Key: "require-kubeconfig",
180+
Value: "true",
181+
},
182+
LessThanOrEqual: semver.MustParse("1.9.10"),
183+
},
177184
NewUnversionedOption(Kubelet, "hostname-override", "minikube"),
178185

179186
// System pods args

vendor/k8s.io/kubernetes/cmd/kubelet/app/server.go

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)