Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removing health probe #1198

Merged
merged 2 commits into from
Jun 30, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 4 additions & 23 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
kscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
ctrl "sigs.k8s.io/controller-runtime"
healthz "sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/Azure/azure-service-operator/api/v1alpha1"
Expand All @@ -35,7 +34,6 @@ import (
resourcemanagerconfig "github.com/Azure/azure-service-operator/pkg/resourcemanager/config"
resourcemanagercosmosdb "github.com/Azure/azure-service-operator/pkg/resourcemanager/cosmosdbs"
resourcemanagereventhub "github.com/Azure/azure-service-operator/pkg/resourcemanager/eventhubs"
"github.com/Azure/azure-service-operator/pkg/resourcemanager/iam"
resourcemanagerkeyvault "github.com/Azure/azure-service-operator/pkg/resourcemanager/keyvaults"
loadbalancer "github.com/Azure/azure-service-operator/pkg/resourcemanager/loadbalancer"
mysqldatabase "github.com/Azure/azure-service-operator/pkg/resourcemanager/mysql/database"
Expand Down Expand Up @@ -64,9 +62,7 @@ import (
keyvaultSecrets "github.com/Azure/azure-service-operator/pkg/secrets/keyvault"
k8sSecrets "github.com/Azure/azure-service-operator/pkg/secrets/kube"
telemetry "github.com/Azure/azure-service-operator/pkg/telemetry"

// +kubebuilder:scaffold:imports
"net/http"
)

var (
Expand Down Expand Up @@ -101,11 +97,9 @@ func init() {

func main() {
var metricsAddr string
var healthAddr string
var enableLeaderElection bool
var secretClient secrets.SecretClient
flag.StringVar(&metricsAddr, "metrics-addr", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&healthAddr, "health-addr", ":8081", "The address the health endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "enable-leader-election", false,
"Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.")

Expand All @@ -114,11 +108,10 @@ func main() {
ctrl.SetLogger(zap.Logger(true))

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
Scheme: scheme,
MetricsBindAddress: metricsAddr,
HealthProbeBindAddress: healthAddr,
LeaderElection: enableLeaderElection,
LivenessEndpointName: "/healthz",
Scheme: scheme,
MetricsBindAddress: metricsAddr,
LeaderElection: enableLeaderElection,
LivenessEndpointName: "/healthz",
})

if err != nil {
Expand Down Expand Up @@ -199,18 +192,6 @@ func main() {
)
sqlActionManager := resourcemanagersqlaction.NewAzureSqlActionManager(secretClient, scheme)

var AzureHealthCheck healthz.Checker = func(_ *http.Request) error {
_, err := iam.GetResourceManagementAuthorizer()
if err != nil {
return err
}
return nil
}

if err := mgr.AddHealthzCheck("azurehealthz", AzureHealthCheck); err != nil {
setupLog.Error(err, "problem running health check to azure autorizer")
}

err = (&controllers.StorageAccountReconciler{
Reconciler: &controllers.AsyncReconciler{
Client: mgr.GetClient(),
Expand Down