Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Commit

Permalink
adjust healthcheck helpers to be able to check in the shoot and the seed
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfoehrKn committed Jan 10, 2020
1 parent e42d467 commit bceb2f2
Show file tree
Hide file tree
Showing 91 changed files with 226 additions and 437 deletions.
2 changes: 1 addition & 1 deletion controllers/extension-shoot-dns-service/pkg/cmd/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (o *DNSServiceOptions) Completed() *DNSServiceConfig {
return o.config
}

// Completed
// Completed returns the completed HealthOptions. Only call this if `Complete` was successful.
func (o *HealthOptions) Completed() *HealthConfig {
return o.config
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ type HealthCheckConfig struct {

// Health contains configuration for the health check controller
type Health struct {
// HealthCheckSyncPeriod
// HealthCheckSyncPeriod configured how often health checks are being executed. Defaults to '30s'
HealthCheckSyncPeriod metav1.Duration
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
}

// options for the health care controller
healthCareCtrlOpts = &controllercmd.ControllerOptions{
healthCheckCtrlOpts = &controllercmd.ControllerOptions{
MaxConcurrentReconciles: 5,
}

Expand All @@ -60,7 +60,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
restOpts,
mgrOpts,
calicoCtrlOpts,
controllercmd.PrefixOption("healthcheck-", healthCareCtrlOpts),
controllercmd.PrefixOption("healthcheck-", healthCheckCtrlOpts),
reconcileOpts,
configFileOpts,
)
Expand Down Expand Up @@ -90,7 +90,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {

reconcileOpts.Completed().Apply(&calicocontroller.DefaultAddOptions.IgnoreOperationAnnotation)
configFileOpts.Completed().ApplyHealthCheckConfig(&healthcheck.AddOptions.HealthCheckConfig)
healthCareCtrlOpts.Completed().Apply(&healthcheck.AddOptions.Controller)
healthCheckCtrlOpts.Completed().Apply(&healthcheck.AddOptions.Controller)

if err := calicocontroller.AddToManager(mgr); err != nil {
controllercmd.LogErrAndExit(err, "Could not add controllers to manager")
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
}

// options for the health care controller
healthCareCtrlOpts = &controllercmd.ControllerOptions{
healthCheckCtrlOpts = &controllercmd.ControllerOptions{
MaxConcurrentReconciles: 5,
}

Expand Down Expand Up @@ -107,7 +107,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
controllercmd.PrefixOption("controlplane-", controlPlaneCtrlOpts),
controllercmd.PrefixOption("infrastructure-", infraCtrlOpts),
controllercmd.PrefixOption("worker-", &workerCtrlOptsUnprefixed),
controllercmd.PrefixOption("healthcheck-", healthCareCtrlOpts),
controllercmd.PrefixOption("healthcheck-", healthCheckCtrlOpts),
configFileOpts,
controllerSwitches,
reconcileOpts,
Expand Down Expand Up @@ -155,7 +155,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
configFileOpts.Completed().ApplyETCDStorage(&alicloudcontrolplaneexposure.DefaultAddOptions.ETCDStorage)
configFileOpts.Completed().ApplyETCDBackup(&alicloudcontrolplanebackup.DefaultAddOptions.ETCDBackup)
configFileOpts.Completed().ApplyHealthCheckConfig(&healthcheck.DefaultAddOptions.HealthCheckConfig)
healthCareCtrlOpts.Completed().Apply(&healthcheck.DefaultAddOptions.Controller)
healthCheckCtrlOpts.Completed().Apply(&healthcheck.DefaultAddOptions.Controller)
backupBucketCtrlOpts.Completed().Apply(&alicloudbackupbucket.DefaultAddOptions.Controller)
backupEntryCtrlOpts.Completed().Apply(&alicloudbackupentry.DefaultAddOptions.Controller)
controlPlaneCtrlOpts.Completed().Apply(&alicloudcontrolplane.DefaultAddOptions.Controller)
Expand Down
2 changes: 1 addition & 1 deletion controllers/provider-alicloud/hack/generate-code
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ bash "${PROJECT_ROOT}"/vendor/k8s.io/code-generator/generate-internal-groups.sh
github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/apis \
github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/apis \
"config:v1alpha1" \
--extra-peer-dirs=github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/apis/config,github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/apis/config/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/conversion,k8s.io/apimachinery/pkg/runtime, ithub.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/apis/config/v1alpha1 \
--extra-peer-dirs=github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/apis/config,github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/apis/config/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/conversion,k8s.io/apimachinery/pkg/runtime, github.com/gardener/gardener-extensions/controllers/provider-alicloud/pkg/apis/config/v1alpha1 \
--go-header-file "${PROJECT_ROOT}/hack/LICENSE_BOILERPLATE.txt"
4 changes: 2 additions & 2 deletions controllers/provider-alicloud/pkg/alicloud/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ const (
BackupSecretName = "etcd-backup"
// StorageEndpoint is the data field in a secret where the storage endpoint is stored at.
StorageEndpoint = "storageEndpoint"
//CloudControllerManagerDeploymentName is the a constant for the name of the CloudController.
//CloudControllerManagerName is the a constant for the name of the CloudController.
CloudControllerManagerName = "cloud-controller-manager"
//CsiPluginController is the a constant for the name of the CSI Plugin controller
// CsiPluginController is the a constant for the name of the CSI Plugin controller
CsiPluginController = "csi-plugin-controller"
)

Expand Down
10 changes: 5 additions & 5 deletions controllers/provider-alicloud/pkg/controller/healthcheck/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ func RegisterHealthChecks(mgr manager.Manager, opts healthcheck.DefaultAddArgs)
opts,
normalPredicates,
map[healthcheck.HealthCheck]string{
general.CheckSeedDeployment(alicloud.CsiPluginController): string(gardencorev1beta1.ShootControlPlaneHealthy),
general.CheckSeedDeployment(alicloud.CloudControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
general.NewSeedDeploymentHealthChecker(alicloud.CsiPluginController): string(gardencorev1beta1.ShootControlPlaneHealthy),
general.NewSeedDeploymentHealthChecker(alicloud.CloudControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
general.CheckManagedResource(genericcontrolplaneactuator.ControlPlaneShootChartResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
general.CheckManagedResource(genericcontrolplaneactuator.StorageClassesChartResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
}); err != nil {
Expand All @@ -70,9 +70,9 @@ func RegisterHealthChecks(mgr manager.Manager, opts healthcheck.DefaultAddArgs)
opts,
nil,
map[healthcheck.HealthCheck]string{
general.CheckManagedResource(genericworkeractuator.McmShootResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
general.CheckSeedDeployment(alicloud.MachineControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
worker.SufficientNodesAvailable(): string(gardencorev1beta1.ShootEveryNodeReady),
general.CheckManagedResource(genericworkeractuator.McmShootResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
general.NewSeedDeploymentHealthChecker(alicloud.MachineControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
worker.NewSufficientNodesChecker(): string(gardencorev1beta1.ShootEveryNodeReady),
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
}

// options for the health care controller
healthCareCtrlOpts = &controllercmd.ControllerOptions{
healthCheckCtrlOpts = &controllercmd.ControllerOptions{
MaxConcurrentReconciles: 5,
}

Expand Down Expand Up @@ -107,7 +107,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
controllercmd.PrefixOption("controlplane-", controlPlaneCtrlOpts),
controllercmd.PrefixOption("infrastructure-", infraCtrlOpts),
controllercmd.PrefixOption("worker-", &workerCtrlOptsUnprefixed),
controllercmd.PrefixOption("healthcheck-", healthCareCtrlOpts),
controllercmd.PrefixOption("healthcheck-", healthCheckCtrlOpts),
configFileOpts,
controllerSwitches,
reconcileOpts,
Expand Down Expand Up @@ -154,7 +154,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
configFileOpts.Completed().ApplyETCDStorage(&awscontrolplaneexposure.DefaultAddOptions.ETCDStorage)
configFileOpts.Completed().ApplyETCDBackup(&awscontrolplanebackup.DefaultAddOptions.ETCDBackup)
configFileOpts.Completed().ApplyHealthCheckConfig(&healthcheck.DefaultAddOptions.HealthCheckConfig)
healthCareCtrlOpts.Completed().Apply(&healthcheck.DefaultAddOptions.Controller)
healthCheckCtrlOpts.Completed().Apply(&healthcheck.DefaultAddOptions.Controller)
backupBucketCtrlOpts.Completed().Apply(&awsbackupbucket.DefaultAddOptions.Controller)
backupEntryCtrlOpts.Completed().Apply(&awsbackupentry.DefaultAddOptions.Controller)
controlPlaneCtrlOpts.Completed().Apply(&awscontrolplane.DefaultAddOptions.Controller)
Expand Down
8 changes: 4 additions & 4 deletions controllers/provider-aws/pkg/controller/healthcheck/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func RegisterHealthChecks(mgr manager.Manager, opts healthcheck.DefaultAddArgs)
opts,
normalPredicates,
map[healthcheck.HealthCheck]string{
general.CheckSeedDeployment(aws.CloudControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
general.NewSeedDeploymentHealthChecker(aws.CloudControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
general.CheckManagedResource(genericcontrolplaneactuator.ControlPlaneShootChartResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
general.CheckManagedResource(genericcontrolplaneactuator.StorageClassesChartResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
general.CheckManagedResource(genericcontrolplaneactuator.ShootWebhooksResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
Expand All @@ -71,7 +71,7 @@ func RegisterHealthChecks(mgr manager.Manager, opts healthcheck.DefaultAddArgs)
opts,
exposurePredicate,
map[healthcheck.HealthCheck]string{
general.CheckSeedDeployment(aws.LBReadvertiserDeploymentName): string(gardencorev1beta1.ShootControlPlaneHealthy),
general.NewSeedDeploymentHealthChecker(aws.LBReadvertiserDeploymentName): string(gardencorev1beta1.ShootControlPlaneHealthy),
}); err != nil {
return err
}
Expand All @@ -85,8 +85,8 @@ func RegisterHealthChecks(mgr manager.Manager, opts healthcheck.DefaultAddArgs)
nil,
map[healthcheck.HealthCheck]string{
general.CheckManagedResource(genericworkeractuator.McmShootResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
general.CheckSeedDeployment(aws.MachineControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
worker.SufficientNodesAvailable(): string(gardencorev1beta1.ShootEveryNodeReady),
general.NewSeedDeploymentHealthChecker(aws.MachineControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
worker.NewSufficientNodesChecker(): string(gardencorev1beta1.ShootEveryNodeReady),
})
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/provider-aws/pkg/controller/worker/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
extensionscontroller "github.com/gardener/gardener-extensions/pkg/controller"
"github.com/gardener/gardener-extensions/pkg/controller/common"
"github.com/gardener/gardener-extensions/pkg/controller/worker"
genericactuator "github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator"
"github.com/gardener/gardener-extensions/pkg/controller/worker/genericactuator"
"github.com/gardener/gardener-extensions/pkg/util"

extensionsv1alpha1 "github.com/gardener/gardener/pkg/apis/extensions/v1alpha1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
}

// options for the health care controller
healthCareCtrlOpts = &controllercmd.ControllerOptions{
healthCheckCtrlOpts = &controllercmd.ControllerOptions{
MaxConcurrentReconciles: 5,
}

Expand Down Expand Up @@ -107,7 +107,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
controllercmd.PrefixOption("controlplane-", controlPlaneCtrlOpts),
controllercmd.PrefixOption("infrastructure-", infraCtrlOpts),
controllercmd.PrefixOption("worker-", &workerCtrlOptsUnprefixed),
controllercmd.PrefixOption("healthcheck-", healthCareCtrlOpts),
controllercmd.PrefixOption("healthcheck-", healthCheckCtrlOpts),
configFileOpts,
controllerSwitches,
reconcileOpts,
Expand Down Expand Up @@ -155,7 +155,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
configFileOpts.Completed().ApplyETCDStorage(&azurecontrolplaneexposure.DefaultAddOptions.ETCDStorage)
configFileOpts.Completed().ApplyETCDBackup(&azurecontrolplanebackup.DefaultAddOptions.ETCDBackup)
configFileOpts.Completed().ApplyHealthCheckConfig(&healthcheck.DefaultAddOptions.HealthCheckConfig)
healthCareCtrlOpts.Completed().Apply(&healthcheck.DefaultAddOptions.Controller)
healthCheckCtrlOpts.Completed().Apply(&healthcheck.DefaultAddOptions.Controller)
backupBucketCtrlOpts.Completed().Apply(&azurebackupbucket.DefaultAddOptions.Controller)
backupEntryCtrlOpts.Completed().Apply(&azurebackupentry.DefaultAddOptions.Controller)
controlPlaneCtrlOpts.Completed().Apply(&azurecontrolplane.DefaultAddOptions.Controller)
Expand Down
8 changes: 4 additions & 4 deletions controllers/provider-azure/pkg/controller/healthcheck/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func RegisterHealthChecks(mgr manager.Manager, opts healthcheck.DefaultAddArgs)
opts,
normalPredicates,
map[healthcheck.HealthCheck]string{
general.CheckSeedDeployment(azure.CloudControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
general.NewSeedDeploymentHealthChecker(azure.CloudControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
general.CheckManagedResource(genericcontrolplaneactuator.ControlPlaneShootChartResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
general.CheckManagedResource(genericcontrolplaneactuator.StorageClassesChartResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
}); err != nil {
Expand All @@ -69,9 +69,9 @@ func RegisterHealthChecks(mgr manager.Manager, opts healthcheck.DefaultAddArgs)
opts,
nil,
map[healthcheck.HealthCheck]string{
general.CheckManagedResource(genericworkeractuator.McmShootResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
general.CheckSeedDeployment(azure.MachineControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
worker.SufficientNodesAvailable(): string(gardencorev1beta1.ShootEveryNodeReady),
general.CheckManagedResource(genericworkeractuator.McmShootResourceName): string(gardencorev1beta1.ShootSystemComponentsHealthy),
general.NewSeedDeploymentHealthChecker(azure.MachineControllerManagerName): string(gardencorev1beta1.ShootControlPlaneHealthy),
worker.NewSufficientNodesChecker(): string(gardencorev1beta1.ShootEveryNodeReady),
})
}

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
}

// options for the health care controller
healthCareCtrlOpts = &controllercmd.ControllerOptions{
healthCheckCtrlOpts = &controllercmd.ControllerOptions{
MaxConcurrentReconciles: 5,
}

Expand Down Expand Up @@ -107,7 +107,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
controllercmd.PrefixOption("controlplane-", controlPlaneCtrlOpts),
controllercmd.PrefixOption("infrastructure-", infraCtrlOpts),
controllercmd.PrefixOption("worker-", &workerCtrlOptsUnprefixed),
controllercmd.PrefixOption("healthcheck-", healthCareCtrlOpts),
controllercmd.PrefixOption("healthcheck-", healthCheckCtrlOpts),
configFileOpts,
controllerSwitches,
reconcileOpts,
Expand Down Expand Up @@ -155,7 +155,7 @@ func NewControllerManagerCommand(ctx context.Context) *cobra.Command {
configFileOpts.Completed().ApplyETCDStorage(&gcpcontrolplaneexposure.DefaultAddOptions.ETCDStorage)
configFileOpts.Completed().ApplyETCDBackup(&gcpcontrolplanebackup.DefaultAddOptions.ETCDBackup)
configFileOpts.Completed().ApplyHealthCheckConfig(&healthcheck.DefaultAddOptions.HealthCheckConfig)
healthCareCtrlOpts.Completed().Apply(&healthcheck.DefaultAddOptions.Controller)
healthCheckCtrlOpts.Completed().Apply(&healthcheck.DefaultAddOptions.Controller)
backupBucketCtrlOpts.Completed().Apply(&gcpbackupbucket.DefaultAddOptions.Controller)
backupEntryCtrlOpts.Completed().Apply(&gcpbackupentry.DefaultAddOptions.Controller)
controlPlaneCtrlOpts.Completed().Apply(&gcpcontrolplane.DefaultAddOptions.Controller)
Expand Down
Loading

0 comments on commit bceb2f2

Please sign in to comment.