From 33755c01289f7596c18e9b74da85111ec4e6a8dc Mon Sep 17 00:00:00 2001 From: Mariia Kotliarevskaia Date: Sun, 15 Oct 2023 17:42:58 +0200 Subject: [PATCH] feat: allow to set default ingressclass Signed-off-by: Mariia Kotliarevskaia --- cmd/apps/nginx_app.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/apps/nginx_app.go b/cmd/apps/nginx_app.go index d9e2f8d6f..29280c4e4 100644 --- a/cmd/apps/nginx_app.go +++ b/cmd/apps/nginx_app.go @@ -28,6 +28,7 @@ flag and the ingress-nginx docs for more info`, nginx.Flags().StringP("namespace", "n", "default", "The namespace used for installation") nginx.Flags().Bool("update-repo", true, "Update the helm repo") nginx.Flags().Bool("host-mode", false, "If we should install ingress-nginx in host mode.") + nginx.Flags().Bool("default-ingress", true, "Is this the default ingressClass for the cluster?") nginx.Flags().StringArray("set", []string{}, "Use custom flags or override existing flags \n(example --set image=org/repo:tag)") nginx.RunE = func(command *cobra.Command, args []string) error { @@ -57,6 +58,14 @@ flag and the ingress-nginx docs for more info`, overrides["controller.kind"] = "DaemonSet" } + defaultIngress, flagErr := command.Flags().GetBool("default-ingress") + if flagErr != nil { + return flagErr + } + if defaultIngress { + overrides["controller.ingressClassResource.default"] = "true" + } + customFlags, _ := command.Flags().GetStringArray("set") if err := config.MergeFlags(overrides, customFlags); err != nil {