Skip to content

Commit f1fb26a

Browse files
committed
Add ingress controller to addons
This uses a custom version of the ingress controller. We should move it over to the official one when it is released.
1 parent 49c0c35 commit f1fb26a

File tree

6 files changed

+195
-0
lines changed

6 files changed

+195
-0
lines changed

cmd/minikube/cmd/config/config.go

+6
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ var settings = []Setting{
136136
validations: []setFn{IsValidAddon},
137137
callbacks: []setFn{EnableOrDisableAddon},
138138
},
139+
{
140+
name: "ingress",
141+
set: SetBool,
142+
validations: []setFn{IsValidAddon},
143+
callbacks: []setFn{EnableOrDisableAddon},
144+
},
139145
}
140146

141147
var ConfigCmd = &cobra.Command{
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2016 The Kubernetes Authors All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
data:
17+
map-hash-bucket-size: "128"
18+
kind: ConfigMap
19+
metadata:
20+
name: nginx-load-balancer-conf
21+
namespace: kube-system
22+
labels:
23+
kubernetes.io/cluster-service: "true"

deploy/addons/ingress/ingress-rc.yaml

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# Copyright 2016 The Kubernetes Authors All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: ReplicationController
17+
metadata:
18+
name: default-http-backend
19+
namespace: kube-system
20+
labels:
21+
kubernetes.io/cluster-service: "true"
22+
spec:
23+
replicas: 1
24+
selector:
25+
app: default-http-backend
26+
kubernetes.io/cluster-service: "true"
27+
template:
28+
metadata:
29+
labels:
30+
app: default-http-backend
31+
kubernetes.io/cluster-service: "true"
32+
spec:
33+
terminationGracePeriodSeconds: 60
34+
containers:
35+
- name: default-http-backend
36+
# Any image is permissable as long as:
37+
# 1. It serves a 404 page at /
38+
# 2. It serves 200 on a /healthz endpoint
39+
image: gcr.io/google_containers/defaultbackend:1.0
40+
imagePullPolicy: IfNotPresent
41+
livenessProbe:
42+
httpGet:
43+
path: /healthz
44+
port: 8080
45+
scheme: HTTP
46+
initialDelaySeconds: 30
47+
timeoutSeconds: 5
48+
ports:
49+
- containerPort: 8080
50+
resources:
51+
limits:
52+
cpu: 10m
53+
memory: 20Mi
54+
requests:
55+
cpu: 10m
56+
memory: 20Mi
57+
---
58+
apiVersion: v1
59+
kind: ReplicationController
60+
metadata:
61+
name: nginx-ingress-controller
62+
namespace: kube-system
63+
labels:
64+
app: nginx-ingress-lb
65+
kubernetes.io/cluster-service: "true"
66+
spec:
67+
replicas: 1
68+
selector:
69+
app: nginx-ingress-lb
70+
kubernetes.io/cluster-service: "true"
71+
template:
72+
metadata:
73+
labels:
74+
app: nginx-ingress-lb
75+
name: nginx-ingress-lb
76+
kubernetes.io/cluster-service: "true"
77+
spec:
78+
terminationGracePeriodSeconds: 60
79+
containers:
80+
# TODO(r2d4): Use official k8s/ingress controller
81+
- image: gcr.io/k8s-minikube/nginx-ingress-controller:0.8.4
82+
name: nginx-ingress-lb
83+
imagePullPolicy: IfNotPresent
84+
readinessProbe:
85+
httpGet:
86+
path: /ingress-controller-healthz
87+
port: 80
88+
scheme: HTTP
89+
livenessProbe:
90+
httpGet:
91+
path: /ingress-controller-healthz
92+
port: 80
93+
scheme: HTTP
94+
initialDelaySeconds: 10
95+
timeoutSeconds: 1
96+
# use downward API
97+
env:
98+
- name: POD_NAME
99+
valueFrom:
100+
fieldRef:
101+
fieldPath: metadata.name
102+
- name: POD_NAMESPACE
103+
valueFrom:
104+
fieldRef:
105+
fieldPath: metadata.namespace
106+
ports:
107+
- containerPort: 80
108+
hostPort: 80
109+
- containerPort: 443
110+
hostPort: 443
111+
# we expose 18080 to access nginx stats in url /nginx-status
112+
# this is optional
113+
- containerPort: 18080
114+
hostPort: 18080
115+
args:
116+
- /nginx-ingress-controller
117+
- --default-backend-service=$(POD_NAMESPACE)/default-http-backend
118+
- --nginx-configmap=$(POD_NAMESPACE)/nginx-load-balancer-conf
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Copyright 2016 The Kubernetes Authors All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: v1
16+
kind: Service
17+
metadata:
18+
name: default-http-backend
19+
namespace: kube-system
20+
labels:
21+
app: default-http-backend
22+
kubernetes.io/cluster-service: "true"
23+
spec:
24+
type: NodePort
25+
ports:
26+
- port: 80
27+
targetPort: 8080
28+
nodePort: 30001
29+
selector:
30+
app: default-http-backend

docs/minikube_config.md

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Configurable fields:
2626
* addon-manager
2727
* kube-dns
2828
* heapster
29+
* ingress
2930

3031
```
3132
minikube config SUBCOMMAND [flags]

pkg/minikube/assets/addons.go

+17
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,23 @@ var Addons = map[string]*Addon{
113113
"heapster-svc.yaml",
114114
"0640"),
115115
}, false, "heapster"),
116+
"ingress": NewAddon([]*MemoryAsset{
117+
NewMemoryAsset(
118+
"deploy/addons/ingress/ingress-configmap.yaml",
119+
constants.AddonsPath,
120+
"ingress-configmap.yaml",
121+
"0640"),
122+
NewMemoryAsset(
123+
"deploy/addons/ingress/ingress-rc.yaml",
124+
constants.AddonsPath,
125+
"ingress-rc.yaml",
126+
"0640"),
127+
NewMemoryAsset(
128+
"deploy/addons/ingress/ingress-svc.yaml",
129+
constants.AddonsPath,
130+
"ingress-svc.yaml",
131+
"0640"),
132+
}, false, "ingress"),
116133
}
117134

118135
func AddMinikubeAddonsDirToAssets(assetList *[]CopyableFile) {

0 commit comments

Comments
 (0)