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

Modify all health checks to be specified via enums #2078

Merged
merged 2 commits into from
Jan 15, 2019
Merged
Show file tree
Hide file tree
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
43 changes: 31 additions & 12 deletions cli/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,52 @@ func configureAndRunChecks(options *checkOptions) error {
if err != nil {
return fmt.Errorf("Validation error when executing check command: %v", err)
}
checks := []healthcheck.Checks{healthcheck.KubernetesAPIChecks}
checks := []healthcheck.Checks{
healthcheck.KubernetesAPIChecks,
healthcheck.KubernetesVersionChecks,
}

if options.preInstallOnly {
if options.singleNamespace {
checks = append(checks, healthcheck.LinkerdPreInstallSingleNamespaceChecks)
} else {
checks = append(checks, healthcheck.LinkerdPreInstallClusterChecks)
}
checks = append(checks, healthcheck.LinkerdPreInstallChecks)
} else if options.dataPlaneOnly {
checks = append(checks, healthcheck.LinkerdControlPlaneExistenceChecks)
checks = append(checks, healthcheck.LinkerdAPIChecks)
if !options.singleNamespace {
checks = append(checks, healthcheck.LinkerdServiceProfileChecks)
}
if options.namespace != "" {
checks = append(checks, healthcheck.LinkerdDataPlaneExistenceChecks)
}
checks = append(checks, healthcheck.LinkerdDataPlaneChecks)
} else {
checks = append(checks, healthcheck.LinkerdControlPlaneExistenceChecks)
checks = append(checks, healthcheck.LinkerdAPIChecks)
if !options.singleNamespace {
checks = append(checks, healthcheck.LinkerdServiceProfileChecks)
}
}

checks = append(checks, healthcheck.LinkerdVersionChecks)
if !(options.preInstallOnly || options.dataPlaneOnly) {
checks = append(checks, healthcheck.LinkerdControlPlaneVersionChecks)
}
if options.dataPlaneOnly {
checks = append(checks, healthcheck.LinkerdDataPlaneVersionChecks)
}

hc := healthcheck.NewHealthChecker(checks, &healthcheck.Options{
ControlPlaneNamespace: controlPlaneNamespace,
DataPlaneNamespace: options.namespace,
KubeConfig: kubeconfigPath,
KubeContext: kubeContext,
APIAddr: apiAddr,
VersionOverride: options.versionOverride,
RetryDeadline: time.Now().Add(options.wait),
ShouldCheckKubeVersion: true,
ShouldCheckControlPlaneVersion: !(options.preInstallOnly || options.dataPlaneOnly),
ShouldCheckDataPlaneVersion: options.dataPlaneOnly,
SingleNamespace: options.singleNamespace,
ControlPlaneNamespace: controlPlaneNamespace,
DataPlaneNamespace: options.namespace,
KubeConfig: kubeconfigPath,
KubeContext: kubeContext,
APIAddr: apiAddr,
VersionOverride: options.versionOverride,
RetryDeadline: time.Now().Add(options.wait),
})

success := runChecks(os.Stdout, hc)
Expand Down
Loading