func DeleteKeda(ctx context.Context) error {
	namespace, err := env.Get(NAMESPACE_ENV_VAR)
	if err != nil {
		namespace = DEFAULT_NAMESPACE
	}
	if err := sh.RunV(
		"helm",
		"delete",
		"-n",
		namespace,
		"keda",
	); err != nil {
		return err
	}
	return nil
}
Deletes the installed release of KEDA in the given namespaces
package main
import (
	"context"
	"fmt"
	"github.com/kedacore/http-add-on/pkg/build"
	"github.com/kedacore/http-add-on/pkg/env"
	"github.com/magefile/mage/mg"
	"github.com/magefile/mage/sh"
)
const (
	DEFAULT_NAMESPACE string = "kedahttp"
	ACR_REGISTRY_NAME         = "KEDAHTTP_ACR_REGISTRY"
	SCALER_IMAGE_ENV_VAR      = "KEDAHTTP_SCALER_IMAGE"
	INTERCEPTOR_IMAGE_ENV_VAR = "KEDAHTTP_INTERCEPTOR_IMAGE"
	OPERATOR_IMAGE_ENV_VAR    = "KEDAHTTP_OPERATOR_IMAGE"
	NAMESPACE_ENV_VAR         = "KEDAHTTP_NAMESPACE"
)
var goBuild = sh.OutCmd("go", "build", "-o")
type Scaler mg.Namespace
func (Scaler) Build(ctx context.Context) error {
	fmt.Println("Running scaler binary build")
	out, err := goBuild("bin/scaler", "./scaler")
	if err != nil {
		return err
	}
	fmt.Println("Finished building scaler")
	fmt.Println("Command Output: ", out)
	return nil
}
func (Scaler) Test(ctx context.Context) error {
	fmt.Println("Running scaler tests")
	testOutput, err := sh.Output("go", "test", "./scaler/...")
	fmt.Println(testOutput)
	if err != nil {
		return err
	}
	return nil
}
func (Scaler) DockerBuild(ctx context.Context) error {
	img, err := build.GetImageName(SCALER_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuild(img, "scaler/Dockerfile", ".")
}
func (Scaler) DockerBuildACR(ctx context.Context) error {
	registry, err := env.Get(ACR_REGISTRY_NAME)
	if err != nil {
		return err
	}
	image, err := build.GetImageName(SCALER_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuildACR(registry, image, "scaler/Dockerfile", ".")
}
func (Scaler) DockerPush(ctx context.Context) error {
	image, err := build.GetImageName(SCALER_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerPush(image)
}
type Operator mg.Namespace
func (Operator) Build(ctx context.Context) error {
	fmt.Println("Running operator binary build")
	out, err := goBuild("bin/operator", "./operator")
	if err != nil {
		return err
	}
	fmt.Println("Finished building operator")
	fmt.Println("Command Output: ", out)
	return nil
}
func (Operator) Test(ctx context.Context) error {
	fmt.Println("Running operator tests")
	testOutput, err := sh.Output("go", "test", "./operator/...")
	if err != nil {
		return err
	}
	fmt.Println(testOutput)
	return nil
}
func (Operator) DockerBuild(ctx context.Context) error {
	img, err := build.GetImageName(OPERATOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuild(img, "operator/Dockerfile", ".")
}
func (Operator) DockerBuildACR(ctx context.Context) error {
	registry, err := env.Get(ACR_REGISTRY_NAME)
	if err != nil {
		return err
	}
	image, err := build.GetImageName(OPERATOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuildACR(registry, image, "operator/Dockerfile", ".")
}
func (Operator) DockerPush(ctx context.Context) error {
	image, err := build.GetImageName(OPERATOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerPush(image)
}
type Interceptor mg.Namespace
func (Interceptor) Build(ctx context.Context) error {
	fmt.Println("Running interceptor binary build")
	out, err := goBuild("bin/interceptor", "./interceptor")
	if err != nil {
		return err
	}
	fmt.Println("Finished building interceptor")
	fmt.Println("Command Output: ", out)
	return nil
}
func (Interceptor) Test(ctx context.Context) error {
	fmt.Println("Running interceptor tests")
	testOutput, err := sh.Output("go", "test", "./interceptor/...")
	if err != nil {
		return err
	}
	fmt.Println(testOutput)
	return nil
}
func (Interceptor) DockerBuild(ctx context.Context) error {
	image, err := build.GetImageName(INTERCEPTOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuild(image, "interceptor/Dockerfile", ".")
}
func (Interceptor) DockerBuildACR(ctx context.Context) error {
	registry, err := env.Get(ACR_REGISTRY_NAME)
	if err != nil {
		return err
	}
	image, err := build.GetImageName(INTERCEPTOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerBuildACR(registry, image, "interceptor/Dockerfile", ".")
}
func (Interceptor) DockerPush(ctx context.Context) error {
	image, err := build.GetImageName(INTERCEPTOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	return build.DockerPush(image)
}
func Build() {
	fmt.Println("Building all binaries")
	scaler := Scaler{}
	interceptor := Interceptor{}
	operator := Operator{}
	mg.Deps(scaler.Build, operator.Build, interceptor.Build)
}
func Test() error {
	return sh.RunV("go", "test", "-timeout=20s", "./...")
}
func DockerBuild(ctx context.Context) error {
	scaler, operator, interceptor := Scaler{}, Interceptor{}, Operator{}
	mg.Deps(scaler.DockerBuild, operator.DockerBuild, interceptor.DockerBuild)
	return nil
}
func DockerBuildACR(ctx context.Context) error {
	scaler, operator, interceptor := Scaler{}, Interceptor{}, Operator{}
	mg.Deps(scaler.DockerBuildACR, operator.DockerBuildACR, interceptor.DockerBuildACR)
	return nil
}
func DockerPush(ctx context.Context) error {
	scaler, operator, interceptor := Scaler{}, Interceptor{}, Operator{}
	mg.Deps(scaler.DockerPush, operator.DockerPush, interceptor.DockerPush)
	return nil
}
func UpgradeOperator(ctx context.Context) error {
	namespace, err := env.Get(NAMESPACE_ENV_VAR)
	if err != nil {
		namespace = DEFAULT_NAMESPACE
	}
	operatorImg, err := build.GetImageName(OPERATOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	scalerImg, err := build.GetImageName(SCALER_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	interceptorImg, err := build.GetImageName(INTERCEPTOR_IMAGE_ENV_VAR)
	if err != nil {
		return err
	}
	if err := sh.RunV(
		"helm",
		"upgrade",
		"kedahttp",
		"./charts/keda-http-operator",
		"--install",
		"--namespace",
		namespace,
		"--create-namespace",
		"--set",
		fmt.Sprintf("images.operator=%s", operatorImg),
		"--set",
		fmt.Sprintf("images.scaler=%s", scalerImg),
		"--set",
		fmt.Sprintf("images.interceptor=%s", interceptorImg),
	); err != nil {
		return err
	}
	return nil
}
func DeleteOperator(ctx context.Context) error {
	namespace, err := env.Get(NAMESPACE_ENV_VAR)
	if err != nil {
		namespace = DEFAULT_NAMESPACE
	}
	if err := sh.RunV("helm", "delete", "-n", namespace, "kedahttp"); err != nil {
		return err
	}
	return nil
}
func InstallKeda(ctx context.Context) error {
	namespace, err := env.Get(NAMESPACE_ENV_VAR)
	if err != nil {
		namespace = DEFAULT_NAMESPACE
	}
	if err := sh.RunV(
		"helm",
		"upgrade",
		"kedacore/keda",
		"--install",
		"--namespace",
		namespace,
		"--create-namespace",
		"--set",
		fmt.Sprintf("watchNamespace=%s", namespace),
	); err != nil {
		return err
	}
	return nil
}