@@ -41,7 +41,7 @@ type Options struct {
4141 Force bool
4242 Local bool
4343 Save bool
44- Animation bool
44+ Verify bool
4545 Env envOption
4646}
4747
@@ -50,7 +50,7 @@ type envOption struct {
5050 Environment string
5151}
5252
53- var animation bool
53+ var verify bool
5454var progress int
5555var cursorcount int
5656var validEnvironments = []string {"k3s" , "microK8s" , "minikube" , "gke" , "bottlerocket" , "eks" , "docker" , "oke" , "generic" }
@@ -102,17 +102,17 @@ func printBar(msg string, total int) int {
102102func printAnimation (msg string , flag bool ) int {
103103 clearLine (90 )
104104 fmt .Printf (msg + "\n " )
105- if flag {
106- progress ++
105+ if verify {
106+ if flag {
107+ progress ++
108+ }
109+ printBar ("\t KubeArmor Installing " , 17 )
107110 }
108- printBar ("\t KubeArmor Installing " , 17 )
109111 return 0
110112}
111113
112114func printMessage (msg string , flag bool ) int {
113- if animation {
114- printAnimation (msg , flag )
115- }
115+ printAnimation (msg , flag )
116116 return 0
117117}
118118
@@ -142,7 +142,8 @@ func checkPods(c *k8s.Client, o Options) {
142142 }
143143 }
144144 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+
146147 defer cancel ()
147148
148149 for {
@@ -210,7 +211,7 @@ func checkTerminatingPods(c *k8s.Client) int {
210211
211212// K8sInstaller for karmor install
212213func K8sInstaller (c * k8s.Client , o Options ) error {
213- animation = o .Animation
214+ verify = o .Verify
214215 var env string
215216 if o .Env .Auto {
216217 env = k8s .AutoDetectEnvironment (c )
@@ -353,8 +354,9 @@ func K8sInstaller(c *k8s.Client, o Options) error {
353354 if o .Block == "all" || strings .Contains (o .Block , "capabilities" ) {
354355 daemonset .Spec .Template .Spec .Containers [0 ].Args = append (daemonset .Spec .Template .Spec .Containers [0 ].Args , "-defaultCapabilitiesPosture=block" )
355356 }
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 )
358360
359361 if ! o .Save {
360362 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 {
369371
370372 caCert , tlsCrt , tlsKey , err := GeneratePki (o .Namespace , deployments .KubeArmorControllerWebhookServiceName )
371373 if err != nil {
372- printMessage ("C \t ldn 't generate TLS secret " , false )
374+ printMessage ("Couldn 't generate TLS secret " , false )
373375 return err
374376 }
375377 kubearmorControllerTLSSecret := deployments .GetKubeArmorControllerTLSSecret (o .Namespace , caCert .String (), tlsCrt .String (), tlsKey .String ())
@@ -561,7 +563,7 @@ func K8sInstaller(c *k8s.Client, o Options) error {
561563 printMessage ("🤩\t KubeArmor manifest file saved to \033 [1m" + s3 + "\033 [0m" , false )
562564
563565 }
564- if animation && ! o .Save {
566+ if verify && ! o .Save {
565567 checkPods (c , o )
566568 }
567569 return nil
@@ -616,7 +618,7 @@ func removeAnnotations(c *k8s.Client) {
616618
617619// K8sUninstaller for karmor uninstall
618620func K8sUninstaller (c * k8s.Client , o Options ) error {
619- animation = o .Animation
621+ verify = o .Verify
620622
621623 fmt .Print ("❌ KubeArmor Deployments ...\n " )
622624 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 {
787789
788790 removeAnnotations (c )
789791 }
790- if animation {
792+ if verify {
791793 checkTerminatingPods (c )
792794 }
793795 return nil
0 commit comments