@@ -41,7 +41,7 @@ type Options struct {
41
41
Force bool
42
42
Local bool
43
43
Save bool
44
- Animation bool
44
+ Verify bool
45
45
Env envOption
46
46
}
47
47
@@ -50,7 +50,7 @@ type envOption struct {
50
50
Environment string
51
51
}
52
52
53
- var animation bool
53
+ var verify bool
54
54
var progress int
55
55
var cursorcount int
56
56
var validEnvironments = []string {"k3s" , "microK8s" , "minikube" , "gke" , "bottlerocket" , "eks" , "docker" , "oke" , "generic" }
@@ -102,17 +102,17 @@ func printBar(msg string, total int) int {
102
102
func printAnimation (msg string , flag bool ) int {
103
103
clearLine (90 )
104
104
fmt .Printf (msg + "\n " )
105
- if flag {
106
- progress ++
105
+ if verify {
106
+ if flag {
107
+ progress ++
108
+ }
109
+ printBar ("\t KubeArmor Installing " , 17 )
107
110
}
108
- printBar ("\t KubeArmor Installing " , 17 )
109
111
return 0
110
112
}
111
113
112
114
func printMessage (msg string , flag bool ) int {
113
- if animation {
114
- printAnimation (msg , flag )
115
- }
115
+ printAnimation (msg , flag )
116
116
return 0
117
117
}
118
118
@@ -142,7 +142,8 @@ func checkPods(c *k8s.Client, o Options) {
142
142
}
143
143
}
144
144
fmt .Print ("\n 🔧\t Verifying KubeArmor functionality (this may take upto a minute) ..." )
145
- ctx , cancel := context .WithTimeout (context .Background (), 40 * time .Second )
145
+ ctx , cancel := context .WithTimeout (context .Background (), 5 * time .Minute )
146
+
146
147
defer cancel ()
147
148
148
149
for {
@@ -210,7 +211,7 @@ func checkTerminatingPods(c *k8s.Client) int {
210
211
211
212
// K8sInstaller for karmor install
212
213
func K8sInstaller (c * k8s.Client , o Options ) error {
213
- animation = o .Animation
214
+ verify = o .Verify
214
215
var env string
215
216
if o .Env .Auto {
216
217
env = k8s .AutoDetectEnvironment (c )
@@ -353,8 +354,9 @@ func K8sInstaller(c *k8s.Client, o Options) error {
353
354
if o .Block == "all" || strings .Contains (o .Block , "capabilities" ) {
354
355
daemonset .Spec .Template .Spec .Containers [0 ].Args = append (daemonset .Spec .Template .Spec .Containers [0 ].Args , "-defaultCapabilitiesPosture=block" )
355
356
}
356
- s := strings .Join (daemonset .Spec .Template .Spec .Containers [0 ].Args , " " )
357
- printMessage ("🛡\t KubeArmor DaemonSet - Init " + daemonset .Spec .Template .Spec .InitContainers [0 ].Image + ", Container " + daemonset .Spec .Template .Spec .Containers [0 ].Image + s + " " , true )
357
+
358
+ args := strings .Join (daemonset .Spec .Template .Spec .Containers [0 ].Args , " " )
359
+ printMessage ("🛡\t KubeArmor DaemonSet - Init " + daemonset .Spec .Template .Spec .InitContainers [0 ].Image + ", Container " + daemonset .Spec .Template .Spec .Containers [0 ].Image + " " + args + " " , true )
358
360
359
361
if ! o .Save {
360
362
if _ , err := c .K8sClientset .AppsV1 ().DaemonSets (o .Namespace ).Create (context .Background (), daemonset , metav1.CreateOptions {}); err != nil {
@@ -369,7 +371,7 @@ func K8sInstaller(c *k8s.Client, o Options) error {
369
371
370
372
caCert , tlsCrt , tlsKey , err := GeneratePki (o .Namespace , deployments .KubeArmorControllerWebhookServiceName )
371
373
if err != nil {
372
- printMessage ("C \t ldn 't generate TLS secret " , false )
374
+ printMessage ("Couldn 't generate TLS secret " , false )
373
375
return err
374
376
}
375
377
kubearmorControllerTLSSecret := deployments .GetKubeArmorControllerTLSSecret (o .Namespace , caCert .String (), tlsCrt .String (), tlsKey .String ())
@@ -561,7 +563,7 @@ func K8sInstaller(c *k8s.Client, o Options) error {
561
563
printMessage ("🤩\t KubeArmor manifest file saved to \033 [1m" + s3 + "\033 [0m" , false )
562
564
563
565
}
564
- if animation && ! o .Save {
566
+ if verify && ! o .Save {
565
567
checkPods (c , o )
566
568
}
567
569
return nil
@@ -616,7 +618,7 @@ func removeAnnotations(c *k8s.Client) {
616
618
617
619
// K8sUninstaller for karmor uninstall
618
620
func K8sUninstaller (c * k8s.Client , o Options ) error {
619
- animation = o .Animation
621
+ verify = o .Verify
620
622
621
623
fmt .Print ("❌ KubeArmor Deployments ...\n " )
622
624
kaDeployments , _ := c .K8sClientset .AppsV1 ().Deployments ("" ).List (context .TODO (), metav1.ListOptions {LabelSelector : "kubearmor-app" })
@@ -787,7 +789,7 @@ func K8sUninstaller(c *k8s.Client, o Options) error {
787
789
788
790
removeAnnotations (c )
789
791
}
790
- if animation {
792
+ if verify {
791
793
checkTerminatingPods (c )
792
794
}
793
795
return nil
0 commit comments