diff --git a/infrastructure/sandbox/JITProvisioner/ingress_destroyer/main.go b/infrastructure/sandbox/JITProvisioner/ingress_destroyer/main.go index 15556a5d749..cb4ab9fca44 100644 --- a/infrastructure/sandbox/JITProvisioner/ingress_destroyer/main.go +++ b/infrastructure/sandbox/JITProvisioner/ingress_destroyer/main.go @@ -6,13 +6,13 @@ import ( "log" "os" "os/exec" - //"time" + "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/dynamodb" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - //autoscaling "k8s.io/client-go/applyconfigurations/autoscaling/v1" + autoscaling "k8s.io/client-go/applyconfigurations/autoscaling/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" ) @@ -66,14 +66,18 @@ func deleteIngress(id, name, ddbTable string) { log.Fatal(err) } - /* + // Delete the cronjob so we don't spam the database for stuff that's not running + err = clientset.BatchV1().CronJobs("default").Delete(context.Background(), id, v1.DeleteOptions{}) + if err != nil { + log.Fatal(err) + } + // Scale it down to save money - time.sleep(60) + time.Sleep(60) _, err = clientset.AppsV1().Deployments("default").ApplyScale(context.Background(), id, &autoscaling.ScaleApplyConfiguration{Spec: &autoscaling.ScaleSpecApplyConfiguration{Replicas: new(int32)}}, v1.ApplyOptions{}) if err != nil { log.Fatal(err) } - */ svc := dynamodb.New(sess) err = updateFleetInstanceState(id, ddbTable, svc)