-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.zsh
201 lines (164 loc) · 4.79 KB
/
init.zsh
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
# shellcheck shell=bash
######################################################################
#<
#
# Function: p6df::modules::kubernetes::deps()
#
#>
######################################################################
p6df::modules::kubernetes::deps() {
ModuleDeps=(
p6m7g8-dotfiles/p6df-zsh
p6m7g8-dotfiles/p6kubernetes
ohmyzsh/ohmyzsh:plugins/kubectl
)
}
######################################################################
#<
#
# Function: p6df::modules::kubernetes::vscodes()
#
#>
######################################################################
p6df::modules::kubernetes::vscodes() {
# kubernetes
code --install-extension ipedrazas.kubernetes-snippets
code --install-extension ms-vscode-remote.remote-containers
p6_return_void
}
######################################################################
#<
#
# Function: p6df::modules::kubernetes::external::brew()
#
#>
######################################################################
p6df::modules::kubernetes::external::brew() {
p6df::modules::homebrew::cli::brew::install buildkit
p6df::modules::homebrew::cli::brew::install kind
p6df::modules::homebrew::cli::brew::install kubebuilder
p6df::modules::homebrew::cli::brew::install kubecfg
p6df::modules::homebrew::cli::brew::install kubectx
p6df::modules::homebrew::cli::brew::install kubeseal
p6df::modules::homebrew::cli::brew::install kubespy
p6df::modules::homebrew::cli::brew::install minikube
p6df::modules::homebrew::cli::brew::install --cask kubecontext
p6df::modules::homebrew::cli::brew::install --cask kubernetic
sudo chown root:wheel $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
sudo chmod u+s $(brew --prefix)/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
p6df::modules::homebrew::cli::brew::install --cask minishift
p6_return_void
}
######################################################################
#<
#
# Function: p6df::modules::kubernetes::prompt::line()
#
#>
######################################################################
p6df::modules::kubernetes::prompt::line() {
p6_kubernetes_prompt_info
}
######################################################################
#<
#
# Function: p6df::modules::kubernetes::on()
#
# Environment: KUBECONFIG
#>
######################################################################
p6df::modules::kubernetes::on() {
KUBECONFIG=$HOME/.kube/config
chmod 600 $KUBECONFIG
p6_env_export "KUBECONFIG" "$KUBECONFIG"
p6_return_void
}
######################################################################
#<
#
# Function: p6df::modules::kubernetes::off()
#
# Environment: KUBECONFIG P6_KUBE_CFG P6_KUBE_NS
#>
######################################################################
p6df::modules::kubernetes::off() {
p6_env_export_un "KUBECONFIG"
p6_env_export_un "P6_KUBE_CFG"
p6_env_export_un "P6_KUBE_NS"
p6_return_void
}
######################################################################
#<
#
# Function: p6df::modules::kubernetes::ctx(ctx)
#
# Args:
# ctx -
#
# Environment: P6_KUBE_CFG
#>
######################################################################
p6df::modules::kubernetes::ctx() {
local ctx="$1"
p6_run_code "kubectx $ctx"
p6_env_export "P6_KUBE_CFG" "$ctx"
p6df::modules::kubernetes::on
p6_return_void
}
######################################################################
#<
#
# Function: str ctx = p6df::modules::kubernetes::ctx::get()
#
# Returns:
# str - ctx
#
#>
######################################################################
p6df::modules::kubernetes::ctx::get() {
local ctx=$(p6_run_code "kubectx -c")
p6_return_str "$ctx"
}
######################################################################
#<
#
# Function: p6df::modules::kubernetes::ns(ns)
#
# Args:
# ns -
#
# Environment: P6_KUBE_NS
#>
######################################################################
p6df::modules::kubernetes::ns() {
local ns="$1"
p6_run_code "kubens $ns"
p6_env_export "P6_KUBE_NS" "$ns"
p6_return_void
}
######################################################################
#<
#
# Function: p6df::modules::kubernetes::minikube()
#
# Environment: MINIKUBE_ACTIVE_DOCKERD
#>
######################################################################
p6df::modules::kubernetes::minikube() {
p6_run_code $(p6_run_code minikube -p minikube docker-env)
p6df::modules::kubernetes::ctx "$MINIKUBE_ACTIVE_DOCKERD"
p6df::modules::kubernetes::ns "default"
p6_return_void
}
######################################################################
#<
#
# Function: p6df::modules::kubernetes::minikube::start()
#
#>
######################################################################
p6df::modules::kubernetes::minikube::start() {
p6_run_code "minikube start"
p6df::modules::kubernetes::minikube
p6_return_void
}