internal static async Task RemoveKeda(string @namespace)
 {
     foreach (var name in _allResourceNames)
     {
         await KubectlHelper.RunKubectl($"delete {name} --namespace {@namespace}", ignoreError : true, showOutput : true);
     }
 }
        private static async Task <bool> HasKeda()
        {
            var kedaEdgeResult = await KubectlHelper.KubectlGet <SearchResultV1 <DeploymentV1Apps> >("deployments --selector=app=keda-edge --all-namespaces");

            var kedaResult = await KubectlHelper.KubectlGet <SearchResultV1 <DeploymentV1Apps> >("deployments --selector=app=keda --all-namespaces");

            return(kedaResult.Items.Any() || kedaEdgeResult.Items.Any());
        }
        internal static async Task <(string, bool)> ResourceExists(string resourceTypeName, string resourceName, string @namespace, bool returnJsonOutput = false)
        {
            var cmd = $"get {resourceTypeName} {resourceName} --namespace {@namespace}";

            if (returnJsonOutput)
            {
                cmd = string.Concat(cmd, " -o json");
            }

            (string output, _, var exitCode) = await KubectlHelper.RunKubectl(cmd, ignoreError : true, showOutput : false);

            return(output, exitCode == 0);
        }
        internal static async Task <bool> NamespaceExists(string @namespace)
        {
            (_, _, var exitCode) = await KubectlHelper.RunKubectl($"get namespace {@namespace}", ignoreError : true, showOutput : false);

            return(exitCode == 0);
        }
        private static async Task <bool> HasScaledObjectCrd()
        {
            var crdResult = await KubectlHelper.KubectlGet <SearchResultV1 <CustomResourceDefinitionV1Beta1> >("crd");

            return(crdResult.Items.Any(i => i.Metadata.Name == "scaledobjects.keda.k8s.io"));
        }
 internal static Task CreateNamespace(string @namespace)
 => KubectlHelper.RunKubectl($"create namespace {@namespace}", ignoreError: false, showOutput: true);