From e3fc07adbfdde79601c5f76f0e9c1a30112edb9b Mon Sep 17 00:00:00 2001 From: Erin Corson Date: Tue, 21 Apr 2020 16:14:51 -0600 Subject: [PATCH 1/3] preventing separate k8s service from being started --- controllers/suite_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 2c143a82683..170c08233f8 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -676,12 +676,12 @@ func setup() error { return err } - go func() { - err = k8sManager.Start(ctrl.SetupSignalHandler()) - if err != nil { - log.Fatal(err) - } - }() + // go func() { + // err = k8sManager.Start(ctrl.SetupSignalHandler()) + // if err != nil { + // log.Fatal(err) + // } + // }() k8sClient, err := client.New(cfg, client.Options{Scheme: scheme.Scheme}) if err != nil { From a0732b2dee5c95c4d279fc9cd313aff2d9a2abcc Mon Sep 17 00:00:00 2001 From: Erin Corson Date: Tue, 21 Apr 2020 16:54:32 -0600 Subject: [PATCH 2/3] more testing --- controllers/suite_test.go | 12 ++++++------ devops/azure-pipelines.yaml | 32 ++++++++++++++++---------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 170c08233f8..2c143a82683 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -676,12 +676,12 @@ func setup() error { return err } - // go func() { - // err = k8sManager.Start(ctrl.SetupSignalHandler()) - // if err != nil { - // log.Fatal(err) - // } - // }() + go func() { + err = k8sManager.Start(ctrl.SetupSignalHandler()) + if err != nil { + log.Fatal(err) + } + }() k8sClient, err := client.New(cfg, client.Options{Scheme: scheme.Scheme}) if err != nil { diff --git a/devops/azure-pipelines.yaml b/devops/azure-pipelines.yaml index 77a307db075..b7b1c928d58 100644 --- a/devops/azure-pipelines.yaml +++ b/devops/azure-pipelines.yaml @@ -111,25 +111,25 @@ steps: kind create cluster export KUBECONFIG=$(kind get kubeconfig-path --name="kind") kubectl cluster-info - kubectl create namespace cert-manager - kubectl label namespace cert-manager cert-manager.io/disable-validation=true - kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.12.0/cert-manager.yaml - kubectl create namespace azureoperator-system - kubectl --namespace azureoperator-system \ - create secret generic azureoperatorsettings \ - --from-literal=AZURE_CLIENT_ID=${AZURE_CLIENT_ID} \ - --from-literal=AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET} \ - --from-literal=AZURE_SUBSCRIPTION_ID=${AZURE_SUBSCRIPTION_ID} \ - --from-literal=AZURE_TENANT_ID=${AZURE_TENANT_ID} + # kubectl create namespace cert-manager + # kubectl label namespace cert-manager cert-manager.io/disable-validation=true + # kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.12.0/cert-manager.yaml + # kubectl create namespace azureoperator-system + # kubectl --namespace azureoperator-system \ + # create secret generic azureoperatorsettings \ + # --from-literal=AZURE_CLIENT_ID=${AZURE_CLIENT_ID} \ + # --from-literal=AZURE_CLIENT_SECRET=${AZURE_CLIENT_SECRET} \ + # --from-literal=AZURE_SUBSCRIPTION_ID=${AZURE_SUBSCRIPTION_ID} \ + # --from-literal=AZURE_TENANT_ID=${AZURE_TENANT_ID} #create image and load it into cluster - IMG="docker.io/controllertest:1" make docker-build - kind load docker-image docker.io/controllertest:1 --loglevel "trace" + # IMG="docker.io/controllertest:1" make docker-build + # kind load docker-image docker.io/controllertest:1 --loglevel "trace" make install kubectl get namespaces - kubectl -n cert-manager rollout status deployment.v1.apps/cert-manager - kubectl get pods --namespace cert-manager - echo "all the pods should be running" - make deploy + # kubectl -n cert-manager rollout status deployment.v1.apps/cert-manager + # kubectl get pods --namespace cert-manager + # echo "all the pods should be running" + #make deploy make test-existing-controllers continueOnError: 'false' displayName: 'Set kind cluster and Run int tests' From 6df78cf246d43178121db45c88f22f871a3febaf Mon Sep 17 00:00:00 2001 From: Erin Corson Date: Wed, 22 Apr 2020 13:43:21 -0600 Subject: [PATCH 3/3] need to register myql vnet reconciler in tests --- controllers/suite_test.go | 17 +++++++++++++++++ main.go | 1 + 2 files changed, 18 insertions(+) diff --git a/controllers/suite_test.go b/controllers/suite_test.go index 2c143a82683..0b330a16f02 100644 --- a/controllers/suite_test.go +++ b/controllers/suite_test.go @@ -34,6 +34,7 @@ import ( mysqlDatabaseManager "github.com/Azure/azure-service-operator/pkg/resourcemanager/mysql/database" mysqlFirewallManager "github.com/Azure/azure-service-operator/pkg/resourcemanager/mysql/firewallrule" mysqlServerManager "github.com/Azure/azure-service-operator/pkg/resourcemanager/mysql/server" + mysqlvnetrule "github.com/Azure/azure-service-operator/pkg/resourcemanager/mysql/vnetrule" resourcemanagernic "github.com/Azure/azure-service-operator/pkg/resourcemanager/nic" resourcemanagerpip "github.com/Azure/azure-service-operator/pkg/resourcemanager/pip" resourcemanagerpsqldatabase "github.com/Azure/azure-service-operator/pkg/resourcemanager/psql/database" @@ -612,6 +613,22 @@ func setup() error { return err } + err = (&MySQLVNetRuleReconciler{ + Reconciler: &AsyncReconciler{ + Client: k8sManager.GetClient(), + AzureClient: mysqlvnetrule.NewMySQLVNetRuleClient(), + Telemetry: telemetry.InitializeTelemetryDefault( + "MySQLVNetRule", + ctrl.Log.WithName("controllers").WithName("MySQLVNetRule"), + ), + Recorder: k8sManager.GetEventRecorderFor("MySQLVNetRule-controller"), + Scheme: k8sManager.GetScheme(), + }, + }).SetupWithManager(k8sManager) + if err != nil { + return err + } + err = (&PostgreSQLServerReconciler{ Reconciler: &AsyncReconciler{ Client: k8sManager.GetClient(), diff --git a/main.go b/main.go index a46481c13c1..0b579e02334 100644 --- a/main.go +++ b/main.go @@ -645,6 +645,7 @@ func main() { setupLog.Error(err, "unable to create controller", "controller", "NetworkInterface") os.Exit(1) } + if err = (&controllers.MySQLVNetRuleReconciler{ Reconciler: &controllers.AsyncReconciler{ Client: mgr.GetClient(),