bootstrap

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	CloudProviderConfig     *cloud.ProviderConfig
	CloudProviderConfigPath string        `json:"cloudProviderConfigPath"`
	APIServerFQDN           string        `json:"apiServerFqdn"`
	UserAssignedIdentityID  string        `json:"userAssignedIdentityId"`
	NextProto               string        `json:"nextProto"`
	AADResource             string        `json:"aadResource"`
	ClusterCAFilePath       string        `json:"clusterCaFilePath"`
	KubeconfigPath          string        `json:"kubeconfigPath"`
	CertDir                 string        `json:"credFilePath"`
	InsecureSkipTLSVerify   bool          `json:"insecureSkipTlsVerify"`
	EnsureAuthorizedClient  bool          `json:"ensureAuthorizedClient"`
	Deadline                time.Duration `json:"deadline"`
}

func (*Config) DefaultAndValidate

func (c *Config) DefaultAndValidate() error

func (*Config) LoadFromFile

func (c *Config) LoadFromFile(path string) error

type ErrorLog

type ErrorLog map[ErrorType]int

func Bootstrap

func Bootstrap(ctx context.Context, config *Config) (err error, errLog ErrorLog, traces *telemetry.TraceStore)

Bootstrap performs the secure TLS bootstrapping wrapped in a retry loop. The retry loop will continue indefinitely until the specified context is done, whether that be through a timeout or cancellation. If all retries fail, the last error encountered will be returned in finalErr. In any case, a record of all errors encountered during the bootstrap process will be returned in errs, where error type is mapped to the corresponding occurrence count. Additionally, a map of traces is returned in traces, which records how long each bootstrapping step took, mapping task name to a corresponding time.Duration. Trace data is separately recorded for each retry attempt.

type ErrorType

type ErrorType string
const (
	ErrorTypeGetAccessTokenFailure     ErrorType = "GetAccessTokenFailure"
	ErrorTypeGetServiceClientFailure   ErrorType = "GetServiceClientFailure"
	ErrorTypeGetInstanceDataFailure    ErrorType = "GetInstanceDataFailure"
	ErrorTypeGetAttestedDataFailure    ErrorType = "GetAttestedDataFailure"
	ErrorTypeGetNonceFailure           ErrorType = "GetNonceFailure"
	ErrorTypeGetCSRFailure             ErrorType = "GetCSRFailure"
	ErrorTypeGetCredentialFailure      ErrorType = "GetCredentialFailure"
	ErrorTypeGenerateKubeconfigFailure ErrorType = "GenerateKubeconfigFailure"
)

type Event

type Event struct {
	Level   string
	Message string
	Start   time.Time
	End     time.Time
}

func (*Event) MarshalJSON

func (e *Event) MarshalJSON() ([]byte, error)

Event instances are marshaled according to the GuestAgentGenericLogsSchema object used by the azure guest agent (WALinuxAgent). For details, see: https://github.com/Azure/WALinuxAgent/blob/master/azurelinuxagent/common/telemetryevent.py#L49

func (*Event) WriteWithResult

func (e *Event) WriteWithResult(result *Result) (string, error)

type Result

type Result struct {
	// Status is terminal status of the bootstrapping event.
	Status Status `json:"Status"`
	// ElapsedMilliseconds measures how long the bootstrapping event took to execute, in milliseconds.
	ElapsedMilliseconds int64 `json:"ElapsedMilliseconds"`
	// Errors is a mapping from top-level bootstrapping error type of the number of times it occurred during the event.
	Errors map[ErrorType]int `json:"Errors,omitempty"`
	// Traces is a mapping from retry attempt to corresponding Trace. A Trace maps span names to their respective durations.
	// This will only ever contain data for the last 3 retries to avoid truncating guest agent event data.
	Traces map[int]telemetry.Trace `json:"Traces,omitempty"`
	// TraceSummary is a special Trace which maps span names to their total durations across all retry attempts.
	TraceSummary telemetry.Trace `json:"TraceSummary,omitempty"`
	// FinalError is the the error returned by the last retry attempt, assuming the overall bootstrapping event failed.
	FinalError string `json:"FinalError,omitempty"`
}

type Status

type Status string
const (
	StatusSuccess Status = "Success"
	StatusFailure Status = "Failure"
)

Jump to

Keyboard shortcuts

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