1
+ # This Script can be used to spinup a knative enabled kubernetes cluster (We are using Minikube here, you can also use k3s).
2
+
1
3
import subprocess
2
4
import shutil
5
+ import os
6
+ import stat
3
7
4
8
def run_command (command , check = True ):
5
9
try :
@@ -17,7 +21,7 @@ def install_minikube():
17
21
else :
18
22
print ("Installing Minikube..." )
19
23
run_command ("curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64" )
20
- run_command ("sudo install minikube-linux-amd64 /usr/ local/bin/minikube && rm minikube-linux-amd64" )
24
+ run_command ("install minikube-linux-amd64 ~/. local/bin/minikube && rm minikube-linux-amd64" )
21
25
22
26
def install_kubectl ():
23
27
if is_installed ("kubectl" ):
@@ -27,17 +31,16 @@ def install_kubectl():
27
31
run_command ('curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"' )
28
32
run_command ('curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"' )
29
33
run_command ('echo "$(cat kubectl.sha256) kubectl" | sha256sum --check' )
30
- run_command ("sudo install -o root -g root -m 0755 kubectl /usr/ local/bin/kubectl" )
34
+ run_command ("install kubectl ~/. local/bin/kubectl" )
31
35
32
36
def install_cosign ():
33
37
if is_installed ("cosign" ):
34
38
print ("Cosign is already installed." )
35
39
else :
36
40
print ("Installing Cosign..." )
37
41
run_command ('curl -O -L "https://github.com/sigstore/cosign/releases/latest/download/cosign-linux-amd64"' )
38
- run_command ('sudo mv cosign-linux-amd64 /usr/local/bin/cosign' )
39
- run_command ('sudo chmod +x /usr/local/bin/cosign' )
40
-
42
+ run_command ('install cosign-linux-amd64 ~/.local/bin/cosign' )
43
+ os .chmod (os .path .expanduser ('~/.local/bin/cosign' ), stat .S_IXUSR | stat .S_IRUSR | stat .S_IWUSR )
41
44
42
45
def install_knative ():
43
46
print ("Extracting images from the manifest and verifying signatures..." )
0 commit comments