preflight

package
v0.30.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2025 Nutanix. All rights reserved. SPDX-License-Identifier: Apache-2.0

Copyright 2025 Nutanix. All rights reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cause

type Cause struct {
	Message string
	Field   string
}

Cause represents a cause of a check failure. It contains a message and an optional field that the cause relates to. The field is used to indicate which part of the cluster configuration the cause relates to.

type Check

type Check interface {
	Name() string
	Run(ctx context.Context) CheckResult
}

Check represents a single preflight check that can be run against a cluster. It has a Name method that returns the name of the check, and a Run method executes the check, and returns a CheckResult. The Name method is used to identify the check if Run fails to return a result, for example if it panics.

type CheckResult

type CheckResult struct {
	Allowed bool
	Error   bool

	Causes   []Cause
	Warnings []string
}

CheckResult represents the result of a check. It contains the name of the check, a boolean indicating whether the check passed, an error boolean indicating whether there was an internal error running the check, and a list of causes for the failure. It also contains a list of warnings that were generated during the check.

type Checker

type Checker interface {
	// Init returns the checks that should run for the cluster.
	Init(ctx context.Context, client ctrlclient.Client, cluster *clusterv1.Cluster) []Check
}

Checker returns a set of checks that have been initialized with common dependencies, such as an infrastructure API client.

type WebhookHandler

type WebhookHandler struct {
	// contains filtered or unexported fields
}

func New

func New(client ctrlclient.Client, decoder admission.Decoder, checkers ...Checker) *WebhookHandler

func (*WebhookHandler) Handle

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL