Documentation
¶
Index ¶
- func AppendToListIfNotExists(list []string, value string) []string
- func BackupKubeadminPasswordHash(ctx context.Context, client runtimeclient.Client, cryptoDir string) (bool, error)
- func BackupKubeconfigCrypto(ctx context.Context, client runtimeclient.Client, cryptoDir string) error
- func BuildKernelArgumentsFromMCOData(data []byte) ([]string, error)
- func BuildKernelArgumentsFromMCOFile(path string) ([]string, error)
- func BuildKernelArgumentsFromMCOObject(mc *mcfgv1.MachineConfig) ([]string, error)
- func ConvertToRawExtension(config any) (runtime.RawExtension, error)
- func CopyFileIfExists(source, dest string) error
- func CopyToTempFile(sourceFileName, directory, pattern string) (string, error)
- func CreateDynamicClient(kubeconfig string, isTestEnvAllowed bool, log logr.Logger) (dynamic.Interface, error)
- func CreateKubeClient(scheme *runtime.Scheme, kubeconfig string) (runtimeclient.Client, error)
- func CreateKubeClientFromBytes(scheme *runtime.Scheme, kubeconfigData []byte) (runtimeclient.Client, error)
- func ExtractBrExUplinkName(state NmState) (string, error)
- func ExtractBrExVLANID(state NmState) (*int, error)
- func ExtractDNSServers(state NmState) []string
- func ExtractRegistryFromImage(image string) string
- func FindDefaultGateways(state NmState, bridgeName, defaultRouteV4, defaultRouteV6 string) (string, string)
- func FindMatchingCIDR(ipStr string, cidrs []string) string
- func GenerateNMState(interfaceName string, ips []string, machineNetworks []string, ...) (string, error)
- func GetAdditionalTrustBundleFromConfigmap(ctx context.Context, client runtimeclient.Client, configmapName string) (string, error)
- func GetCSVDeployment(ctx context.Context, client runtimeclient.Client) (*appsv1.Deployment, error)
- func GetClusterAdditionalTrustBundleState(ctx context.Context, client runtimeclient.Client) (bool, string, error)
- func GetClusterBaseDomain(ctx context.Context, client runtimeclient.Client) (string, error)
- func GetClusterName(ctx context.Context, client runtimeclient.Client) (string, error)
- func GetConfigMapData(ctx context.Context, name, namespace, key string, client runtimeclient.Client) (string, error)
- func GetInfrastructure(ctx context.Context, client runtimeclient.Client) (*ocp_config_v1.Infrastructure, error)
- func GetIngressCertificateCN(ctx context.Context, client runtimeclient.Client) (string, error)
- func GetInstallConfig(ctx context.Context, client runtimeclient.Reader) (string, error)
- func GetLocalNodeName(ctx context.Context, client runtimeclient.Reader) (string, error)
- func GetMCDManagedVarLibFiles(mcdConfigPath string) ([]string, error)
- func GetMachineNetworks(ctx context.Context, client runtimeclient.Reader) ([]string, error)
- func GetMirrorRegistrySourceRegistries(ctx context.Context, client runtimeclient.Client) ([]string, error)
- func GetNodeInternalIPs(ctx context.Context, client runtimeclient.Reader) ([]string, error)
- func GetReleaseRegistry(ctx context.Context, client runtimeclient.Client) (string, error)
- func GetSNOMasterNode(ctx context.Context, client runtimeclient.Client) (*corev1.Node, error)
- func GetSecretData(ctx context.Context, name, namespace, key string, client runtimeclient.Client) (string, error)
- func GetYamlOrJsonDecoder(fp string) (*yaml.YAMLOrJSONDecoder, error)
- func HandleFilesWithCallback(folder string, action func(string) error) error
- func HasFIPS(ctx context.Context, client runtimeclient.Client) (bool, error)
- func HasProxy(ctx context.Context, client runtimeclient.Client) (bool, error)
- func InitIBU(ctx context.Context, c runtimeclient.Client, log *logr.Logger) error
- func InitIPConfig(ctx context.Context, c runtimeclient.Client, log *logr.Logger) error
- func IsIpv6(provideIp string) bool
- func LoadGroupedManifestsFromPath(basePath string, log *logr.Logger) ([][]*unstructured.Unstructured, error)
- func LoadKubeadminPasswordHash(cryptoDir string) (string, error)
- func MarshalToFile(data any, filePath string) error
- func MarshalToYamlFile(data any, filePath string) error
- func ReadIBIConfigFile(configFile string) (*ibiconfig.IBIPrepareConfig, error)
- func ReadImageFromStaticPodDefinition(podFile, containerName string) (string, error)
- func ReadSeedReconfigurationFromFile(path string) (*seedreconfig.SeedReconfiguration, error)
- func ReadYamlOrJSONFile(fp string, into any) error
- func RemoveListOfFiles(log *logrus.Logger, files []string) error
- func RenderTemplate(templateData string, params any) ([]byte, error)
- func ReplaceImageRegistry(image, targetRegistry, sourceRegistry string) (string, error)
- func RetryMiddleware(logger logr.Logger) func(rt http.RoundTripper) http.RoundTripper
- func RunOnce(name, directory string, log *logrus.Logger, f any, args ...any) error
- func SeedReconfigurationKubeconfigRetentionFromCluster(ctx context.Context, client runtimeclient.Client) (*seedreconfig.KubeConfigCryptoRetention, error)
- func SeedReconfigurationKubeconfigRetentionToCryptoDir(cryptoDir string, ...) error
- func ShouldOverrideSeedRegistry(seedMirrorRegistryConfigured bool, seedReleaseRegistry string, ...) (bool, error)
- func UpdatePullSecretFromDockerConfig(ctx context.Context, c runtimeclient.Client, dockerConfigJSON []byte) (*corev1.Secret, error)
- func ValidateIPFamilyConfig(family string, addr string, networkCIDR string, gateway string) error
- func WaitForApi(ctx context.Context, client runtimeclient.Client, log *logrus.Logger)
- type ClusterInfo
- type IPConfig
- type NMStateConfig
- type NMStateTemplateData
- type NmAddr
- type NmBridge
- type NmDNS
- type NmDNSList
- type NmIPConf
- type NmIf
- type NmRoute
- type NmRoutes
- type NmState
- type NmVLAN
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToListIfNotExists ¶
func BackupKubeconfigCrypto ¶
func BuildKernelArgumentsFromMCOFile ¶
BuildKernelArguementsFromMCOFile reads the kernel arguments from MCO file and builds the string arguments that ostree admin deploy requires
func BuildKernelArgumentsFromMCOObject ¶
func BuildKernelArgumentsFromMCOObject(mc *mcfgv1.MachineConfig) ([]string, error)
func ConvertToRawExtension ¶
func ConvertToRawExtension(config any) (runtime.RawExtension, error)
func CopyFileIfExists ¶
func CopyToTempFile ¶
CopyToTempFile copies a file to a temporary file. WARNING: This function only preserves POSIX permissions to the new file If you want to use it, take that into account and extend it if needed to also preserve other things like owner, extended attributes, selinux contexts or whatever might be needed
func CreateDynamicClient ¶
func CreateKubeClient ¶
func ExtractBrExUplinkName ¶
ExtractBrExUplinkName returns the uplink port name connected to the given bridge (excluding the bridge internal and patch ports).
func ExtractBrExVLANID ¶
ExtractBrExVLANID inspects the bridge uplink port; if it's a VLAN interface, returns its VLAN ID.
func ExtractDNSServers ¶
ExtractDNSServers returns the ordered DNS server list from nmstate
func FindDefaultGateways ¶
func FindDefaultGateways(state NmState, bridgeName, defaultRouteV4, defaultRouteV6 string) (string, string)
FindDefaultGateways searches nmstate routes to find default IPv4 and IPv6 gateways for the given bridge name and default route destinations.
func FindMatchingCIDR ¶
FindMatchingCIDR returns the first CIDR from the list that matches the given IP's IP family (IPv4 vs IPv6). If none is found, returns an empty string.
func GenerateNMState ¶
func GenerateNMState( interfaceName string, ips []string, machineNetworks []string, desiredGatewayV4 string, desiredGatewayV6 string, dnsServers []string, vlanID int, currentGatewayV4 string, currentGatewayV6 string, ) (string, error)
GenerateNMState generates NMState YAML from IPs and their machine network CIDRs. It derives the prefix length from the provided CIDRs.
func GetCSVDeployment ¶
func GetCSVDeployment(ctx context.Context, client runtimeclient.Client) (*appsv1.Deployment, error)
func GetClusterBaseDomain ¶
func GetClusterName ¶
func GetConfigMapData ¶
func GetInfrastructure ¶
func GetInfrastructure(ctx context.Context, client runtimeclient.Client) (*ocp_config_v1.Infrastructure, error)
func GetIngressCertificateCN ¶
func GetInstallConfig ¶
func GetLocalNodeName ¶
getLocalNodeName returns the current node's name from the hostname.
func GetMCDManagedVarLibFiles ¶
GetMCDManagedVarLibFiles parses the MCD currentconfig to get the list of managed files under /var/lib.
func GetMachineNetworks ¶
func GetNodeInternalIPs ¶
func GetReleaseRegistry ¶
func GetSNOMasterNode ¶
func GetSecretData ¶
func GetYamlOrJsonDecoder ¶
func GetYamlOrJsonDecoder(fp string) (*yaml.YAMLOrJSONDecoder, error)
func HandleFilesWithCallback ¶
func InitIPConfig ¶
func LoadGroupedManifestsFromPath ¶
func LoadGroupedManifestsFromPath(basePath string, log *logr.Logger) ([][]*unstructured.Unstructured, error)
func MarshalToFile ¶
MarshalToFile marshals anything and writes it to the given file path. file only readable by root
func MarshalToYamlFile ¶
MarshalToYamlFile marshals any object to YAML and writes it to the given file path file only readable by root
func ReadIBIConfigFile ¶
func ReadIBIConfigFile(configFile string) (*ibiconfig.IBIPrepareConfig, error)
func ReadSeedReconfigurationFromFile ¶
func ReadSeedReconfigurationFromFile(path string) (*seedreconfig.SeedReconfiguration, error)
func ReadYamlOrJSONFile ¶
func RenderTemplate ¶
RenderTemplate render template
func ReplaceImageRegistry ¶
func RetryMiddleware ¶
func RetryMiddleware(logger logr.Logger) func(rt http.RoundTripper) http.RoundTripper
RetryMiddleware pass this into your client config (with .Wrap()) to make it retriable
func SeedReconfigurationKubeconfigRetentionFromCluster ¶
func SeedReconfigurationKubeconfigRetentionFromCluster(ctx context.Context, client runtimeclient.Client) (*seedreconfig.KubeConfigCryptoRetention, error)
func SeedReconfigurationKubeconfigRetentionToCryptoDir ¶
func SeedReconfigurationKubeconfigRetentionToCryptoDir(cryptoDir string, kubeconfigCryptoRetention *seedreconfig.KubeConfigCryptoRetention) error
func ValidateIPFamilyConfig ¶
func ValidateIPFamilyConfig( family string, addr string, networkCIDR string, gateway string, ) error
ValidateIPFamilyConfig performs family-specific validation for addr, CIDR, gateway and DNS.
func WaitForApi ¶
Types ¶
type ClusterInfo ¶
type ClusterInfo struct {
BaseDomain string
ClusterName string
ClusterID string
OCPVersion string
NodeIPs []string
ReleaseRegistry string
Hostname string
MirrorRegistryConfigured bool
ClusterNetworks []string
ServiceNetworks []string
MachineNetworks []string
NodeLabels map[string]string
IngressCertificateCN string
}
func GetClusterInfo ¶
func GetClusterInfo(ctx context.Context, client runtimeclient.Client) (*ClusterInfo, error)
type IPConfig ¶
type IPConfig struct {
Address string
PrefixLen int
Enabled bool
DHCPEnabled bool
DesiredGateway string
CurrentGateway string
}
IPConfig represents IP configuration for a specific protocol
type NMStateConfig ¶
type NMStateConfig struct {
InterfaceName string
VLAN bool
VLANID int
IPv4Config *IPConfig
IPv6Config *IPConfig
DNSServers []string
}
NMStateConfig represents the configuration for generating NMState YAML
type NMStateTemplateData ¶
type NMStateTemplateData struct {
InterfaceName string
VLANID int
IPv4 IPConfig
IPv6 IPConfig
DNSServers []string
}
NMStateTemplateData represents the template data for NMState YAML generation
type NmBridge ¶
type NmBridge struct {
Port []struct {
Name string `json:"name"`
} `json:"port"`
}
NmBridge represents bridge configuration for an interface.
type NmDNSList ¶
type NmDNSList struct {
Server []string `json:"server"`
}
NmDNSList represents a list of DNS servers in nmstate output.
type NmIPConf ¶
type NmIPConf struct {
Enabled bool `json:"enabled"`
DHCP bool `json:"dhcp"`
Autoconf bool `json:"autoconf,omitempty"`
Address []NmAddr `json:"address"`
}
NmIPConf represents IPv4/IPv6 configuration for an interface.
type NmIf ¶
type NmIf struct {
Name string `json:"name"`
Type string `json:"type"`
IPv4 NmIPConf `json:"ipv4"`
IPv6 NmIPConf `json:"ipv6"`
Bridge NmBridge `json:"bridge,omitempty"`
VLAN *NmVLAN `json:"vlan,omitempty"`
}
NmIf represents a network interface in nmstate output.
func GetBrExInterface ¶
type NmRoute ¶
type NmRoute struct {
Destination string `json:"destination"`
NextHopAddress string `json:"next-hop-address"`
NextHopInterface string `json:"next-hop-interface"`
}
NmRoute represents a route entry in nmstate output.