Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabled operator installation for karmor #5

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ var installCmd = &cobra.Command{
Short: "Install KubeArmor in a Kubernetes Cluster",
Long: `Install KubeArmor in a Kubernetes Clusters`,
RunE: func(cmd *cobra.Command, args []string) error {
if err := installOptions.Env.CheckAndSetValidEnvironmentOption(cmd.Flag("env").Value.String()); err != nil {
return fmt.Errorf("error in checking environment option: %v", err)
}
if err := install.K8sInstaller(client, installOptions); err != nil {
return err
if installOptions.Legacy {
if err := install.K8sLegacyInstaller(client, installOptions); err != nil {
return fmt.Errorf("error installing kubearmor in legacy mode: %v", err)
}
} else {
if err := install.K8sInstaller(client, installOptions); err != nil {
return fmt.Errorf("error installing kubearmor: %v", err)
}
}
return nil
},
Expand All @@ -43,7 +46,6 @@ func init() {
installCmd.Flags().BoolVar(&installOptions.Save, "save", false, "Save KubeArmor Manifest ")
installCmd.Flags().BoolVar(&installOptions.Verify, "verify", true, "Verify whether all KubeArmor resources are created, running and also probes whether KubeArmor has armored the cluster or not")
installCmd.Flags().BoolVar(&installOptions.Local, "local", false, "Use Local KubeArmor Images (sets ImagePullPolicy to 'IfNotPresent') ")
installCmd.Flags().StringVarP(&installOptions.Env.Environment, "env", "e", "", "Supported KubeArmor Environment [k0s,k3s,microK8s,minikube,gke,bottlerocket,eks,docker,oke,generic]")
installCmd.Flags().StringVarP(&installOptions.ImageRegistry, "registry", "r", "", "Image registry to use to pull the images")

installCmd.Flags().BoolVar(&installOptions.Legacy, "legacy", false, "Installs kubearmor in legacy mode if set to true")
}
9 changes: 7 additions & 2 deletions cmd/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
Use: "uninstall",
Short: "Uninstall KubeArmor from a Kubernetes Cluster",
Long: `Uninstall KubeArmor from a Kubernetes Clusters`,
RunE: func(cmd *cobra.Command, args []string) error {

Check warning on line 18 in cmd/uninstall.go

View workflow job for this annotation

GitHub Actions / go-lint

parameter 'cmd' seems to be unused, consider removing or renaming it as _
err := install.K8sUninstaller(client, uninstallOptions)
return err
if err := install.K8sUninstaller(client, uninstallOptions); err != nil {
if err := install.K8sLegacyUninstaller(client, uninstallOptions); err != nil {
return err
}
}
return nil
},
}

Expand All @@ -27,4 +31,5 @@
uninstallCmd.Flags().StringVarP(&uninstallOptions.Namespace, "namespace", "n", "", "If no namespace is specified, it defaults to all namespaces and deletes all KubeArmor objects across them.")
uninstallCmd.Flags().BoolVar(&uninstallOptions.Force, "force", false, "Force remove KubeArmor annotations from deployments. (Deployments might be restarted)")
uninstallCmd.Flags().BoolVar(&uninstallOptions.Verify, "verify", true, "Verify whether all KubeArmor resources are cleaned up or not")
uninstallCmd.Flags().BoolVar(&uninstallOptions.Legacy, "legacy", false, "Legacy uninstallation for kubearmor")
}
Loading
Loading