Skip to content

Commit c2ba574

Browse files
committed
generate istio document page and layout
1 parent cf50577 commit c2ba574

File tree

10 files changed

+359
-0
lines changed

10 files changed

+359
-0
lines changed

cmd/minikube/cmd/config/config.go

+12
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,18 @@ var settings = []Setting{
147147
validations: []setFn{IsValidAddon},
148148
callbacks: []setFn{EnableOrDisableAddon},
149149
},
150+
{
151+
name: "istio-provisioner",
152+
set: SetBool,
153+
validations: []setFn{IsValidAddon},
154+
callbacks: []setFn{EnableOrDisableAddon},
155+
},
156+
{
157+
name: "istio",
158+
set: SetBool,
159+
validations: []setFn{IsValidAddon},
160+
callbacks: []setFn{EnableOrDisableAddon},
161+
},
150162
{
151163
name: "addon-manager",
152164
set: SetBool,

cmd/minikube/cmd/config/util.go

+11
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"k8s.io/minikube/pkg/minikube/machine"
3333
"k8s.io/minikube/pkg/minikube/out"
3434
"k8s.io/minikube/pkg/minikube/storageclass"
35+
pkgutil "k8s.io/minikube/pkg/util"
3536
)
3637

3738
// defaultStorageClassProvisioner is the name of the default storage class provisioner
@@ -125,6 +126,16 @@ func EnableOrDisableAddon(name string, val string) error {
125126
return nil
126127
}
127128

129+
if name == "istio" && enable {
130+
minMem := 8192
131+
minCpus := 4
132+
memorySizeMB := pkgutil.CalculateSizeInMB(viper.GetString("memory"))
133+
cpuCount := viper.GetInt("cpus")
134+
if memorySizeMB < minMem || cpuCount < minCpus {
135+
out.WarningT("Enable istio needs {{.minMem}} MB of memory and {{.minCpus}} CPUs.", out.V{"minMem": minMem, "minCpus": minCpus})
136+
}
137+
}
138+
128139
// TODO(r2d4): config package should not reference API, pull this out
129140
api, err := machine.NewAPIClient()
130141
if err != nil {

deploy/addons/addon-manager.yaml.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ spec:
3333
value: "5"
3434
- name: ADDON_MANAGER_LEADER_ELECTION
3535
value: "false"
36+
- name: KUBECTL_EXTRA_PRUNE_WHITELIST
37+
value: install.istio.io/v1alpha2/IstioControlPlane
3638
imagePullPolicy: IfNotPresent
3739
resources:
3840
requests:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,271 @@
1+
---
2+
apiVersion: v1
3+
kind: Namespace
4+
metadata:
5+
name: istio-operator
6+
labels:
7+
kubernetes.io/minikube-addons: istio
8+
addonmanager.kubernetes.io/mode: EnsureExists
9+
...
10+
---
11+
apiVersion: apiextensions.k8s.io/v1beta1
12+
kind: CustomResourceDefinition
13+
metadata:
14+
name: istiocontrolplanes.install.istio.io
15+
labels:
16+
kubernetes.io/minikube-addons: istio
17+
addonmanager.kubernetes.io/mode: EnsureExists
18+
spec:
19+
group: install.istio.io
20+
names:
21+
kind: IstioControlPlane
22+
listKind: IstioControlPlaneList
23+
plural: istiocontrolplanes
24+
singular: istiocontrolplane
25+
shortNames:
26+
- icp
27+
scope: Namespaced
28+
subresources:
29+
status: {}
30+
validation:
31+
openAPIV3Schema:
32+
properties:
33+
apiVersion:
34+
description: 'APIVersion defines the versioned schema of this representation
35+
of an object. Servers should convert recognized schemas to the latest
36+
internal value, and may reject unrecognized values.
37+
More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#resources'
38+
type: string
39+
kind:
40+
description: 'Kind is a string value representing the REST resource this
41+
object represents. Servers may infer this from the endpoint the client
42+
submits requests to. Cannot be updated. In CamelCase.
43+
More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
44+
type: string
45+
spec:
46+
description: 'Specification of the desired state of the istio control plane resource.
47+
More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
48+
type: object
49+
status:
50+
description: 'Status describes each of istio control plane component status at the current time.
51+
0 means NONE, 1 means UPDATING, 2 means HEALTHY, 3 means ERROR, 4 means RECONCILING.
52+
More info: https://github.com/istio/operator/blob/master/pkg/apis/istio/v1alpha2/v1alpha2.pb.html &
53+
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
54+
type: object
55+
versions:
56+
- name: v1alpha2
57+
served: true
58+
storage: true
59+
...
60+
---
61+
apiVersion: v1
62+
kind: ServiceAccount
63+
metadata:
64+
namespace: istio-operator
65+
name: istio-operator
66+
labels:
67+
kubernetes.io/minikube-addons: istio
68+
addonmanager.kubernetes.io/mode: EnsureExists
69+
...
70+
---
71+
apiVersion: rbac.authorization.k8s.io/v1
72+
kind: ClusterRole
73+
metadata:
74+
creationTimestamp: null
75+
name: istio-operator
76+
labels:
77+
kubernetes.io/minikube-addons: istio
78+
addonmanager.kubernetes.io/mode: EnsureExists
79+
rules:
80+
# istio groups
81+
- apiGroups:
82+
- authentication.istio.io
83+
resources:
84+
- '*'
85+
verbs:
86+
- '*'
87+
- apiGroups:
88+
- config.istio.io
89+
resources:
90+
- '*'
91+
verbs:
92+
- '*'
93+
- apiGroups:
94+
- install.istio.io
95+
resources:
96+
- '*'
97+
verbs:
98+
- '*'
99+
- apiGroups:
100+
- networking.istio.io
101+
resources:
102+
- '*'
103+
verbs:
104+
- '*'
105+
- apiGroups:
106+
- rbac.istio.io
107+
resources:
108+
- '*'
109+
verbs:
110+
- '*'
111+
- apiGroups:
112+
- security.istio.io
113+
resources:
114+
- '*'
115+
verbs:
116+
- '*'
117+
# k8s groups
118+
- apiGroups:
119+
- admissionregistration.k8s.io
120+
resources:
121+
- mutatingwebhookconfigurations
122+
- validatingwebhookconfigurations
123+
verbs:
124+
- '*'
125+
- apiGroups:
126+
- apiextensions.k8s.io
127+
resources:
128+
- customresourcedefinitions.apiextensions.k8s.io
129+
- customresourcedefinitions
130+
verbs:
131+
- '*'
132+
- apiGroups:
133+
- apps
134+
- extensions
135+
resources:
136+
- daemonsets
137+
- deployments
138+
- deployments/finalizers
139+
- ingresses
140+
- replicasets
141+
- statefulsets
142+
verbs:
143+
- '*'
144+
- apiGroups:
145+
- autoscaling
146+
resources:
147+
- horizontalpodautoscalers
148+
verbs:
149+
- '*'
150+
- apiGroups:
151+
- monitoring.coreos.com
152+
resources:
153+
- servicemonitors
154+
verbs:
155+
- get
156+
- create
157+
- apiGroups:
158+
- policy
159+
resources:
160+
- poddisruptionbudgets
161+
verbs:
162+
- '*'
163+
- apiGroups:
164+
- rbac.authorization.k8s.io
165+
resources:
166+
- clusterrolebindings
167+
- clusterroles
168+
- roles
169+
- rolebindings
170+
verbs:
171+
- '*'
172+
- apiGroups:
173+
- ""
174+
resources:
175+
- configmaps
176+
- endpoints
177+
- events
178+
- namespaces
179+
- pods
180+
- persistentvolumeclaims
181+
- secrets
182+
- services
183+
- serviceaccounts
184+
verbs:
185+
- '*'
186+
...
187+
---
188+
kind: ClusterRoleBinding
189+
apiVersion: rbac.authorization.k8s.io/v1
190+
metadata:
191+
name: istio-operator
192+
labels:
193+
kubernetes.io/minikube-addons: istio
194+
addonmanager.kubernetes.io/mode: EnsureExists
195+
subjects:
196+
- kind: ServiceAccount
197+
name: istio-operator
198+
namespace: istio-operator
199+
roleRef:
200+
kind: ClusterRole
201+
name: istio-operator
202+
apiGroup: rbac.authorization.k8s.io
203+
...
204+
---
205+
apiVersion: v1
206+
kind: Service
207+
metadata:
208+
namespace: istio-operator
209+
labels:
210+
name: istio-operator
211+
kubernetes.io/minikube-addons: istio
212+
addonmanager.kubernetes.io/mode: EnsureExists
213+
name: istio-operator-metrics
214+
spec:
215+
ports:
216+
- name: http-metrics
217+
port: 8383
218+
targetPort: 8383
219+
selector:
220+
name: istio-operator
221+
...
222+
---
223+
apiVersion: apps/v1
224+
kind: Deployment
225+
metadata:
226+
namespace: istio-operator
227+
name: istio-operator
228+
labels:
229+
kubernetes.io/minikube-addons: istio
230+
addonmanager.kubernetes.io/mode: Reconcile
231+
spec:
232+
replicas: 1
233+
selector:
234+
matchLabels:
235+
name: istio-operator
236+
template:
237+
metadata:
238+
labels:
239+
name: istio-operator
240+
kubernetes.io/minikube-addons: istio
241+
addonmanager.kubernetes.io/mode: EnsureExists
242+
spec:
243+
serviceAccountName: istio-operator
244+
containers:
245+
- name: istio-operator
246+
image: docker.io/istio/operator:1.4.0
247+
command:
248+
- istio-operator
249+
- server
250+
imagePullPolicy: Always
251+
resources:
252+
limits:
253+
cpu: 200m
254+
memory: 256Mi
255+
requests:
256+
cpu: 50m
257+
memory: 128Mi
258+
env:
259+
- name: WATCH_NAMESPACE
260+
value: ""
261+
- name: LEADER_ELECTION_NAMESPACE
262+
valueFrom:
263+
fieldRef:
264+
fieldPath: metadata.namespace
265+
- name: POD_NAME
266+
valueFrom:
267+
fieldRef:
268+
fieldPath: metadata.name
269+
- name: OPERATOR_NAME
270+
value: "istio-operator"
271+
...

deploy/addons/istio/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
## istio Addon
2+
[istio](https://istio.io/docs/setup/getting-started/) - Cloud platforms provide a wealth of benefits for the organizations that use them.
3+
4+
### Enabling istio
5+
Propose to startup minikube with at least 8192 MB of memory and 4 CPUs to enable istio.
6+
To enable this addon, simply run:
7+
8+
```shell script
9+
minikube addons enable istio
10+
```
11+
12+
In a minute or so istio default components will be installed into your cluster. You could run `kubectl get po -n istio-system` to see the progress for istio installation.
13+
14+
### Testing installation
15+
16+
```shell script
17+
kubectl get po -n istio-system
18+
```
19+
20+
If everything went well you shouldn't get any errors about istio being installed in your cluster. If you haven't deployed any releases `kubectl get po -n istio-system` won't return anything.
21+
22+
### Deprecation of istio
23+
To disable this addon, simply run:
24+
```shell script
25+
minikube addons disable istio
26+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: install.istio.io/v1alpha2
2+
kind: IstioControlPlane
3+
metadata:
4+
namespace: istio-operator
5+
name: example-istiocontrolplane
6+
labels:
7+
kubernetes.io/minikube-addons: istio
8+
addonmanager.kubernetes.io/mode: Reconcile
9+
spec:
10+
profile: default
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ define "main" }}
2+
<div style="padding-top:20px">
3+
{{ .Render "content" }}
4+
</div>
5+
{{ end }}

pkg/minikube/assets/addons.go

+16
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,22 @@ var Addons = map[string]*Addon{
190190
"0640",
191191
true),
192192
}, false, "ingress"),
193+
"istio-provisioner": NewAddon([]*BinAsset{
194+
MustBinAsset(
195+
"deploy/addons/istio-provisioner/istio-operator.yaml.tmpl",
196+
vmpath.GuestAddonsDir,
197+
"istio-operator.yaml",
198+
"0640",
199+
true),
200+
}, true, "istio-provisioner"),
201+
"istio": NewAddon([]*BinAsset{
202+
MustBinAsset(
203+
"deploy/addons/istio/istio-default-profile.yaml.tmpl",
204+
vmpath.GuestAddonsDir,
205+
"istio-default-profile.yaml",
206+
"0640",
207+
false),
208+
}, false, "istio"),
193209
"metrics-server": NewAddon([]*BinAsset{
194210
MustBinAsset(
195211
"deploy/addons/metrics-server/metrics-apiservice.yaml.tmpl",

0 commit comments

Comments
 (0)