helpers

package
v0.20260213.1 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 13 Imported by: 1

Documentation

Overview

Portions Copyright (c) Microsoft Corporation.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	VMTypeStandard       = "standard"
	VMTypeVmss           = "vmss"
	NetworkPluginAzure   = "azure"
	NetworkPluginKubenet = "kubenet"
	NetworkPolicyAzure   = "azure"
	NetworkPolicyCalico  = "calico"
	LoadBalancerBasic    = "basic"
	LoadBalancerStandard = "standard"
	VMSizeStandardDc2s   = "Standard_DC2s"
	VMSizeStandardDc4s   = "Standard_DC4s"
	DefaultLinuxUser     = "azureuser"
	DefaultCloudName     = "AzurePublicCloud"
	AksCustomCloudName   = "akscustom"
	AzureStackCloud      = "AzureStackCloud"
)

Variables

This section is empty.

Functions

func GetDefaultOutboundCommand

func GetDefaultOutboundCommand() string

GetDefaultOutboundCommand returns a default outbound traffic command.

func GetKubeletConfigFlag

func GetKubeletConfigFlag(k map[string]string, cs *datamodel.ContainerService, profile *datamodel.AgentPoolProfile,
	kubeletConfigFileToggleEnabled bool) map[string]string

GetOrderedKubeletConfigFlagString returns an ordered string of key/val pairs. copied from AKS-Engine and filter out flags that already translated to config file.

func GetKubeletNodeLabels

func GetKubeletNodeLabels(agentPool *datamodel.AgentPoolProfile) map[string]string

func GetLoadBalancerSKU

func GetLoadBalancerSKU(sku string) aksnodeconfigv1.LoadBalancerSku

GetLoadBalancerSKI returns the LoadBalancerSku enum based on the input string.

func GetNetworkPluginType

func GetNetworkPluginType(networkPlugin string) aksnodeconfigv1.NetworkPlugin

GetNetworkPluginType returns the NetworkPluginType enum based on the input string.

func GetNetworkPolicyType

func GetNetworkPolicyType(networkPolicy string) aksnodeconfigv1.NetworkPolicy

GetNetworkPolicyType returns the NetworkPolicyType enum based on the input string.

func GetOutBoundCmd

func GetOutBoundCmd(nbc *datamodel.NodeBootstrappingConfiguration) string

GetOutBoundCmd returns a proper outbound traffic command based on some cloud and Linux distro configs.

func IsKubernetesVersionGe

func IsKubernetesVersionGe(actualVersion, version string) bool

IsKubernetesVersionGe returns true if actualVersion is greater than or equal to version.

func ValidateAndSetLinuxKubeletFlags

func ValidateAndSetLinuxKubeletFlags(kubeletFlags map[string]string, cs *datamodel.ContainerService, profile *datamodel.AgentPoolProfile)

Types

type EventLevel added in v0.20260210.0

type EventLevel string

EventLevel represents the severity level of a guest agent event.

const (
	// EventLevelInformational indicates a successful operation or informational message.
	EventLevelInformational EventLevel = "Informational"
	// EventLevelError indicates a failure or error condition.
	EventLevelError EventLevel = "Error"
)

type EventLogger added in v0.20260210.0

type EventLogger struct {
	Dir string
}

EventLogger writes guest agent events to a directory.

func NewEventLogger added in v0.20260210.0

func NewEventLogger(dir string) *EventLogger

NewEventLogger creates an EventLogger that writes to the specified directory.

func (*EventLogger) Events added in v0.20260210.0

func (l *EventLogger) Events() []GuestAgentEvent

Events reads all guest agent event files from the directory. Events are returned in filename order (which corresponds to creation time since filenames are nanosecond timestamps). This method is primarily useful for testing.

func (*EventLogger) LogEvent added in v0.20260210.0

func (l *EventLogger) LogEvent(taskName, message string, eventLevel EventLevel, startTime, endTime time.Time)

LogEvent creates an event file for the Azure VM guest agent.

The implementation follows the established bash pattern used across the codebase for event contents, with one intentional divergence in the filename scheme:

  • Filename: Uses current time in nanoseconds to ensure uniqueness. Most bash event emitters use millisecond-based filenames (e.g., `date +%s%3N`); this implementation uses nanoseconds for greater collision resistance.
  • Timestamp: Event start time in format "2006-01-02 15:04:05.000"
  • OperationId: Event end time in format "2006-01-02 15:04:05.000"
  • Message: Includes timing information (startTime, endTime, durationMs)

type GuestAgentEvent added in v0.20260210.0

type GuestAgentEvent struct {
	Timestamp   string `json:"Timestamp"`
	OperationId string `json:"OperationId"`
	Version     string `json:"Version"`
	TaskName    string `json:"TaskName"`
	EventLevel  string `json:"EventLevel"`
	Message     string `json:"Message"`
	EventPid    string `json:"EventPid"`
	EventTid    string `json:"EventTid"`
}

GuestAgentEvent represents an event to be logged for the Azure VM guest agent.

Jump to

Keyboard shortcuts

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