/
artifacts.go
943 lines (881 loc) · 26.8 KB
/
artifacts.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
// Code generated by go-bindata.
// sources:
// template/galera.cnf
// template/galera.cnf.tpl
// template/hostpath-provisioner.yaml
// template/local-storage-provision.yaml
// template/local-volume-admin-account.yaml
// template/local-volume-static-provisioner.yaml
// template/mariadb-service.yaml.tpl
// template/mariadb-statefulset.gotpl.yaml
// template/provision-example.yaml
// DO NOT EDIT!
package artifact
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
"time"
)
type asset struct {
bytes []byte
info os.FileInfo
}
type bindataFileInfo struct {
name string
size int64
mode os.FileMode
modTime time.Time
}
func (fi bindataFileInfo) Name() string {
return fi.name
}
func (fi bindataFileInfo) Size() int64 {
return fi.size
}
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}
func (fi bindataFileInfo) IsDir() bool {
return false
}
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
var _templateGaleraCnf = []byte(`[mysqld]
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
# Galera Provider Configuration
wsrep_on=ON
wsrep_provider=/usr/lib/libgalera_smm.so
# Galera Cluster Configuration
wsrep_cluster_name="test_cluster"
wsrep_cluster_address="gcomm://first_ip,second_ip,third_ip"
# Galera Synchronization Configuration
wsrep_sst_method=rsync
# Galera Node Configuration
wsrep_node_address="this_node_ip"
wsrep_node_name="this_node_name"`)
func templateGaleraCnfBytes() ([]byte, error) {
return _templateGaleraCnf, nil
}
func templateGaleraCnf() (*asset, error) {
bytes, err := templateGaleraCnfBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/galera.cnf", size: 475, mode: os.FileMode(420), modTime: time.Unix(1517449578, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templateGaleraCnfTpl = []byte(`[mysqld]
# binlog_format=ROW — see Binary Log Formats
# default_storage_engine=InnoDB
# innodb_autoinc_lock_mode=2
# innodb_doublewrite=1 (the default) when using Galera provider of version >= 2.0.
# query_cache_size=0 (only for versions prior to 5.5.40-galera, 10.0.14-galera and 10.1.2)
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
bind-address=0.0.0.0
# Galera Provider Configuration
# wsrep_on=ON — Enable wsrep replication (starting 10.1.1)
# wsrep_provider — Path to the Galera library
wsrep_on=ON
wsrep_provider=/usr/lib/libgalera_smm.so
# Galera Cluster Configuration
# wsrep_cluster_name - Defines the logical cluster name for the node. default is example_cluster
# wsrep_cluster_address — see cluster connection URL
# Refer to https://mariadb.com/kb/en/library/getting-started-with-mariadb-galera-cluster/#restarting-the-cluster
# wsrep_provider_options="pc.wait_prim=FALSE" - Default is TRUE, the node waits for the pc.wait_prim_timeout time period. Useful to bring up a non-primary component and make it primary with pc.bootstrap.
# wsrep_provider_options="pc.wait_prim_timeout=PT30S" - The period of time to wait for a primary component.
# wsrep_provider_options="pc.bootstrap=TRUE" - If you set this value to TRUE is a signal to turn a NON-PRIMARY component into PRIMARY.
wsrep_cluster_name="{{.ClusterName}}"
{{if .DisableClusterAddresses}}#{{end}}wsrep_cluster_address="gcomm://{{with .ClusterAddresses}}{{.}}{{end}}{{with .WsrepProviderOptions}}?{{.}}{{end}}"
# Galera Synchronization Configuration
#wsrep_sst_method mysqldump
wsrep_sst_method=rsync
# Galera Node Configuration
#wsrep_node_address host address:default port
#wsrep_node_name <hostname>
{{if .ThisNodeHost}}wsrep_node_address="{{.ThisNodeHost}}"{{end}}
{{if .ThisNodeName}}wsrep_node_name="{{.ThisNodeName}}"{{end}}`)
func templateGaleraCnfTplBytes() ([]byte, error) {
return _templateGaleraCnfTpl, nil
}
func templateGaleraCnfTpl() (*asset, error) {
bytes, err := templateGaleraCnfTplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/galera.cnf.tpl", size: 1839, mode: os.FileMode(420), modTime: time.Unix(1517571239, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templateHostpathProvisionerYaml = []byte(`kind: StorageClass
apiVersion: storage.k8s.io/v1beta1
metadata:
name: example-hostpath
provisioner: example.com/hostpath
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: hostpath-admin
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: hostpath-provisioner-pv-binding
namespace: default
subjects:
- kind: ServiceAccount
name: hostpath-admin
namespace: default
roleRef:
kind: ClusterRole
name: system:persistent-volume-provisioner
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: hostpath-provisioner-node-binding
namespace: default
subjects:
- kind: ServiceAccount
name: hostpath-admin
namespace: default
roleRef:
kind: ClusterRole
name: system:node
apiGroup: rbac.authorization.k8s.io
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: hostpath-provisioner
labels:
app: hostpath-provisioner
spec:
selector:
matchLabels:
app: hostpath-provisioner
template:
metadata:
labels:
app: hostpath-provisioner
spec:
containers:
- name: hostpath-provisioner
image: docker.io/tangfeixiong/hostpath-provisioner:latest
imagePullPolicy: "IfNotPresent"
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- name: pv-volume
mountPath: /tmp/hostpath-provisioner
serviceAccountName: hostpath-admin
volumes:
- name: pv-volume
hostPath:
path: /tmp/hostpath-provisioner
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: hostpath
annotations:
volume.beta.kubernetes.io/storage-class: "example-hostpath"
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Mi
`)
func templateHostpathProvisionerYamlBytes() ([]byte, error) {
return _templateHostpathProvisionerYaml, nil
}
func templateHostpathProvisionerYaml() (*asset, error) {
bytes, err := templateHostpathProvisionerYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/hostpath-provisioner.yaml", size: 1920, mode: os.FileMode(420), modTime: time.Unix(1517439085, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templateLocalStorageProvisionYaml = []byte(`# https://github.com/kubernetes-incubator/external-storage/tree/master/local-volume
# Only create this for K8s 1.9+
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
# If static provisioner is installed, do not prebind through pv
apiVersion: v1
kind: PersistentVolume
metadata:
name: example-local-pv
annotations:
"volume.alpha.kubernetes.io/node-affinity": '{
"requiredDuringSchedulingIgnoredDuringExecution": {
"nodeSelectorTerms": [
{ "matchExpressions": [
{ "key": "kubernetes.io/hostname",
"operator": "In",
"values": ["rookdev-172-17-4-61", "rookdev-172-17-4-63"]
}
]}
]}
}'
spec:
capacity:
storage: 60Mi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: local-storage
local:
path: /mnt/disks/vol1
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: example-local-claim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 50Mi
storageClassName: local-storage`)
func templateLocalStorageProvisionYamlBytes() ([]byte, error) {
return _templateLocalStorageProvisionYaml, nil
}
func templateLocalStorageProvisionYaml() (*asset, error) {
bytes, err := templateLocalStorageProvisionYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/local-storage-provision.yaml", size: 1191, mode: os.FileMode(420), modTime: time.Unix(1517439458, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templateLocalVolumeAdminAccountYaml = []byte(`apiVersion: v1
kind: ServiceAccount
metadata:
name: local-storage-admin
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: local-storage-provisioner-pv-binding
namespace: default
subjects:
- kind: ServiceAccount
name: local-storage-admin
namespace: default
roleRef:
kind: ClusterRole
name: system:persistent-volume-provisioner
apiGroup: rbac.authorization.k8s.io
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: local-storage-provisioner-node-binding
namespace: default
subjects:
- kind: ServiceAccount
name: local-storage-admin
namespace: default
roleRef:
kind: ClusterRole
name: system:node
apiGroup: rbac.authorization.k8s.io
`)
func templateLocalVolumeAdminAccountYamlBytes() ([]byte, error) {
return _templateLocalVolumeAdminAccountYaml, nil
}
func templateLocalVolumeAdminAccountYaml() (*asset, error) {
bytes, err := templateLocalVolumeAdminAccountYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/local-volume-admin-account.yaml", size: 741, mode: os.FileMode(420), modTime: time.Unix(1517433168, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templateLocalVolumeStaticProvisionerYaml = []byte(`---
# Source: provisioner/templates/provisioner.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: local-provisioner-config
namespace: default
data:
storageClassMap: |
fast-disks:
hostDir: /mnt/fast-disks
mountDir: /mnt/fast-disks
---
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: local-volume-provisioner
namespace: default
labels:
app: local-volume-provisioner
spec:
selector:
matchLabels:
app: local-volume-provisioner
template:
metadata:
labels:
app: local-volume-provisioner
spec:
serviceAccountName: local-storage-admin
containers:
- image: "quay.io/external_storage/local-volume-provisioner:latest"
imagePullPolicy: "Always"
name: provisioner
securityContext:
privileged: true
env:
- name: MY_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
volumeMounts:
- mountPath: /etc/provisioner/config
name: provisioner-config
readOnly: true
- mountPath: /mnt/fast-disks
name: fast-disks
volumes:
- name: provisioner-config
configMap:
name: local-provisioner-config
- name: fast-disks
hostPath:
path: /mnt/fast-disks
`)
func templateLocalVolumeStaticProvisionerYamlBytes() ([]byte, error) {
return _templateLocalVolumeStaticProvisionerYaml, nil
}
func templateLocalVolumeStaticProvisionerYaml() (*asset, error) {
bytes, err := templateLocalVolumeStaticProvisionerYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/local-volume-static-provisioner.yaml", size: 1418, mode: os.FileMode(420), modTime: time.Unix(1517433205, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templateMariadbServiceYamlTpl = []byte(`apiVersion: v1
kind: Service
metadata:
labels:
app: mariadb
component: mariadb-galera
example.com/mysql-operator: {{.CustomResourceName}} # operator reserved!
name: {{.Name}} # e.g. demo-mariadb-galera
#namespace: default
spec:
clusterIP: None
ports:
- name: client
port: 3306
protocol: TCP
targetPort: 3306
- name: traffic
port: 4567
protocol: TCP
targetPort: 4567
- name: trafficu
port: 4567
protocol: UDP
targetPort: 4567
- name: ist
port: 4568
protocol: TCP
targetPort: 4568
- name: sst
port: 4444
protocol: TCP
targetPort: 4444
selector:
app: mariadb
component: mariadb-galera
example.com/mysql-operator: {{.CustomResourceName}} # required by operator itself!
#sessionAffinity: None
#sessionAffinity: ClientIP
#type: ClusterIP`)
func templateMariadbServiceYamlTplBytes() ([]byte, error) {
return _templateMariadbServiceYamlTpl, nil
}
func templateMariadbServiceYamlTpl() (*asset, error) {
bytes, err := templateMariadbServiceYamlTplBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/mariadb-service.yaml.tpl", size: 843, mode: os.FileMode(420), modTime: time.Unix(1517531271, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templateMariadbStatefulsetGotplYaml = []byte(`apiVersion: apps/v1beta2
kind: StatefulSet
metadata:
labels:
app: mariadb
component: mariadb-galera
example.com/mysql-operator: {{.CustomResourceName}} # required by operator itself!
name: {{.Name}} # e.g. demo-mariadb-galera
#namespace: default
spec:
podManagementPolicy: OrderedReady
#podManagementPolicy: Parallel
replicas: {{.Count}}
selector:
matchLabels:
app: mariadb
component: mariadb-galera
example.com/mysql-operator: {{.CustomResourceName}} # required by operator itself!
serviceName: {{.ServiceName}} # e.g. demo-mariadb-galera
template:
metadata:
labels:
app: mariadb
component: mariadb-galera
app-affinity: local-test-affinity
example.com/go-to-kubernetes: {{.Name}} # required by operator itself!
example.com/mysql-operator: {{.CustomResourceName}} # required by operator itself!
spec:
#affinity:
# podAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchExpressions:
# - key: app-affinity
# operator: In
# values:
# - local-test-affinity
# topologyKey: kubernetes.io/hostname
#affinity:
# podAntiAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# - labelSelector:
# matchExpressions:
# - key: app-affinity
# operator: In
# values:
# - local-test-anti-affinity
# topologyKey: kubernetes.io/hostname
containers:
- args: ["/operator-entrypoint/mysql-operator", "agent"]
#- mysqld
command: ["/operator-entrypoint/tini", "-g", "--"]
#- /usr/local/bin/docker-entrypoint.sh
env:
- name: MYSQL_USER
value: {{.MysqlUser}}
- name: MYSQL_PASSWORD
value: {{.MysqlPassword}}
#- name: MYSQL_PASSWORD_FILE
# value: /run/secrets/mysql-user
- name: MYSQL_DATABASE
value: {{.MysqlDatabase}}
- name: MYSQL_ROOT_PASSWORD
value: {{.MysqlRootPassword}}
#- name: MYSQL_ROOT_PASSWORD_FILE
# value: /run/secrets/mysql-root
image: docker.io/mariadb:10.2
imagePullPolicy: IfNotPresent
#livenessProbe:
# exec:
# command:
# - mysqladmin
# - --password={{.MysqlRootPassword}}
# - ping
# failureThreshold: 3
# initialDelaySeconds: 5
# periodSeconds: 10
# successThreshold: 1
# timeoutSeconds: 5
name: mariadb-galera
ports:
- containerPort: 3306
name: client
protocol: TCP
#readinessProbe:
# exec:
# command:
# - mysqladmin
# - --password={{.MysqlRootPassword}}
# - ping
# failureThreshold: 3
# initialDelaySeconds: 15
# periodSeconds: 10
# successThreshold: 1
# timeoutSeconds: 5
resources: {}
securityContext:
privileged: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /docker-entrypoint-initdb.d
name: initdb
- mountPath: /etc/mysql/mariadb.conf.d
name: confd
- mountPath: /operator-entrypoint
name: operatorentry
- mountPath: /var/lib/mysql
#name: local-vol
name: hostpath
dnsPolicy: ClusterFirst
initContainers:
- args:
- --conf_dir=/etc/mysql/mariadb.conf.d
- --logtostderr
- --v=5
command:
- /mysql-operator
- init
env:
- name: MY_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: MY_POD_NAME # important, required to discover StatefulSet name by operator itself!
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: MY_POD_SERVICE_ACCOUNT
valueFrom:
fieldRef:
fieldPath: spec.serviceAccountName
- name: CLUSTER_NAME
value: {{.ClusterName}}
image: docker.io/tangfeixiong/mysql-operator
#imagePullPolicy: IfNotPresent
imagePullPolicy: Always
name: preboot
resources: {}
securityContext:
privileged: true
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /docker-entrypoint-initdb.d
name: initdb
- mountPath: /etc/mysql/mariadb.conf.d
name: confd
- mountPath: /operator-entrypoint
name: operatorentry
- mountPath: /operator-initdb
name: operatorinitdb
- mountPath: /podinfo
name: podinfo
#restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
#securityContext:
# fsGroup: 1234
terminationGracePeriodSeconds: 30
volumes:
- downwardAPI:
defaultMode: 420
items:
- fieldRef:
apiVersion: v1
fieldPath: metadata.annotations
path: annotations
- fieldRef:
apiVersion: v1
fieldPath: metadata.labels
path: labels
- fieldRef:
apiVersion: v1
fieldPath: metadata.name
path: name
- fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
path: namespace
name: podinfo
- emptyDir: {}
name: confd
- emptyDir: {}
name: initdb
- emptyDir: {}
name: operatorentry
- name: operatorinitdb
persistentVolumeClaim:
claimName: example-local-claim
updateStrategy:
#type: RollingUpdate
type: OnDelete
volumeClaimTemplates:
#- metadata:
# name: local-vol
# spec:
# accessModes: [ "ReadWriteOnce" ]
# storageClassName: "local-storage"
# resources:
# requests:
# storage: 100Mi
#- metadata:
# name: mysql-pv-claim
# spec:
# accessModes:
# - ReadWriteOnce
# resources:
# requests:
# storage: 20Gi
# storageClassName: rook-block
- metadata:
name: hostpath
#annotations:
# volume.beta.kubernetes.io/storage-class: "example-hostpath"
spec:
accessModes:
- ReadWriteOnce
#- ReadOnlyMany
#- ReadWriteMany
storageClassName: "example-hostpath"
resources:
requests:
storage: 80Mi
`)
func templateMariadbStatefulsetGotplYamlBytes() ([]byte, error) {
return _templateMariadbStatefulsetGotplYaml, nil
}
func templateMariadbStatefulsetGotplYaml() (*asset, error) {
bytes, err := templateMariadbStatefulsetGotplYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/mariadb-statefulset.gotpl.yaml", size: 6980, mode: os.FileMode(420), modTime: time.Unix(1519277891, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
var _templateProvisionExampleYaml = []byte(`apiVersion: example.com/v1alpha1
kind: Mariadb
metadata:
name: my-galera
spec:
# Optional, default is docker.io/mariadb:10, must suppport:
# mariadb:10.1, mariadb:10.0
# mysql:5
# mysql:5.7, mysql:5.6, mysql:5.5
# May support:
# mariadb:5
# Plan to support custome image, for example:
# image:
# nameValues:
# - name: version
# value: mariadb10.2
# docker: 'docker.io/tangfeixiong/mariadb:latest'
#image: {}
# Follow https://mariadb.com/kb/en/library/what-is-mariadb-galera-cluster/
# clusterMode: Galera, Replication
# Follow https://dev.mysql.com/downloads/cluster/
# clusterMode: CGE, Replication
# No clustering
# clusterMode: None
#clusterMode: Galera
mysqlTemplate: {}
galeraTemplate:
# According documention, https://mariadb.com/kb/en/library/getting-started-with-mariadb-galera-cluster/
# Thus total members of cluster, minimal value is 3
count: 3
# According documention, http://galeracluster.com/documentation-webpages/mysqlwsrepoptions.html#wsrep-cluster-name
#clusterName: example_cluster`)
func templateProvisionExampleYamlBytes() ([]byte, error) {
return _templateProvisionExampleYaml, nil
}
func templateProvisionExampleYaml() (*asset, error) {
bytes, err := templateProvisionExampleYamlBytes()
if err != nil {
return nil, err
}
info := bindataFileInfo{name: "template/provision-example.yaml", size: 1090, mode: os.FileMode(420), modTime: time.Unix(1517533275, 0)}
a := &asset{bytes: bytes, info: info}
return a, nil
}
// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err)
}
return a.bytes, nil
}
return nil, fmt.Errorf("Asset %s not found", name)
}
// MustAsset is like Asset but panics when Asset would return an error.
// It simplifies safe initialization of global variables.
func MustAsset(name string) []byte {
a, err := Asset(name)
if err != nil {
panic("asset: Asset(" + name + "): " + err.Error())
}
return a
}
// AssetInfo loads and returns the asset info for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func AssetInfo(name string) (os.FileInfo, error) {
cannonicalName := strings.Replace(name, "\\", "/", -1)
if f, ok := _bindata[cannonicalName]; ok {
a, err := f()
if err != nil {
return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err)
}
return a.info, nil
}
return nil, fmt.Errorf("AssetInfo %s not found", name)
}
// AssetNames returns the names of the assets.
func AssetNames() []string {
names := make([]string, 0, len(_bindata))
for name := range _bindata {
names = append(names, name)
}
return names
}
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"template/galera.cnf": templateGaleraCnf,
"template/galera.cnf.tpl": templateGaleraCnfTpl,
"template/hostpath-provisioner.yaml": templateHostpathProvisionerYaml,
"template/local-storage-provision.yaml": templateLocalStorageProvisionYaml,
"template/local-volume-admin-account.yaml": templateLocalVolumeAdminAccountYaml,
"template/local-volume-static-provisioner.yaml": templateLocalVolumeStaticProvisionerYaml,
"template/mariadb-service.yaml.tpl": templateMariadbServiceYamlTpl,
"template/mariadb-statefulset.gotpl.yaml": templateMariadbStatefulsetGotplYaml,
"template/provision-example.yaml": templateProvisionExampleYaml,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
// data/
// foo.txt
// img/
// a.png
// b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
node := _bintree
if len(name) != 0 {
cannonicalName := strings.Replace(name, "\\", "/", -1)
pathList := strings.Split(cannonicalName, "/")
for _, p := range pathList {
node = node.Children[p]
if node == nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
}
}
if node.Func != nil {
return nil, fmt.Errorf("Asset %s not found", name)
}
rv := make([]string, 0, len(node.Children))
for childName := range node.Children {
rv = append(rv, childName)
}
return rv, nil
}
type bintree struct {
Func func() (*asset, error)
Children map[string]*bintree
}
var _bintree = &bintree{nil, map[string]*bintree{
"template": &bintree{nil, map[string]*bintree{
"galera.cnf": &bintree{templateGaleraCnf, map[string]*bintree{}},
"galera.cnf.tpl": &bintree{templateGaleraCnfTpl, map[string]*bintree{}},
"hostpath-provisioner.yaml": &bintree{templateHostpathProvisionerYaml, map[string]*bintree{}},
"local-storage-provision.yaml": &bintree{templateLocalStorageProvisionYaml, map[string]*bintree{}},
"local-volume-admin-account.yaml": &bintree{templateLocalVolumeAdminAccountYaml, map[string]*bintree{}},
"local-volume-static-provisioner.yaml": &bintree{templateLocalVolumeStaticProvisionerYaml, map[string]*bintree{}},
"mariadb-service.yaml.tpl": &bintree{templateMariadbServiceYamlTpl, map[string]*bintree{}},
"mariadb-statefulset.gotpl.yaml": &bintree{templateMariadbStatefulsetGotplYaml, map[string]*bintree{}},
"provision-example.yaml": &bintree{templateProvisionExampleYaml, map[string]*bintree{}},
}},
}}
// RestoreAsset restores an asset under the given directory
func RestoreAsset(dir, name string) error {
data, err := Asset(name)
if err != nil {
return err
}
info, err := AssetInfo(name)
if err != nil {
return err
}
err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755))
if err != nil {
return err
}
err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode())
if err != nil {
return err
}
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
if err != nil {
return err
}
return nil
}
// RestoreAssets restores an asset under the given directory recursively
func RestoreAssets(dir, name string) error {
children, err := AssetDir(name)
// File
if err != nil {
return RestoreAsset(dir, name)
}
// Dir
for _, child := range children {
err = RestoreAssets(dir, filepath.Join(name, child))
if err != nil {
return err
}
}
return nil
}
func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
}