Documentation ¶
Index ¶
- func AppendMissingDefaultMCPManifests(currentMCPs []*mcfgv1.MachineConfigPool) []*mcfgv1.MachineConfigPool
- func Delete(file string) error
- func DeleteDeferredUpdateAnnotation(anns map[string]string) map[string]string
- func DeserializeObjectFromData(data []byte, addToSchemeFn ...func(scheme2 *runtime.Scheme) error) (runtime.Object, error)
- func GetLeaderElectionConfig(restcfg *rest.Config, enabled bool) configv1.LeaderElection
- func GetProviderName(providerID string) string
- func IsDeferredUpdate(value DeferMode) bool
- func IsImmediateUpdate(value DeferMode) bool
- func IsNoMatchError(err error) bool
- func KernelArgumentsEqual(args1, args2 string, exclude ...string) bool
- func ListFiles(dirPaths string) ([]string, error)
- func ListFilesFromMultiplePaths(dirPaths []string) ([]string, error)
- func MapOfStringsContains(a, b map[string]string) bool
- func MapOfStringsCopy(a map[string]string) map[string]string
- func MapOfStringsEqual(a, b map[string]string) bool
- func ObjectInfo(o interface{}) string
- func ParseManifests(filename string, r io.Reader) ([]manifest, error)
- func PtrBoolEqual(a, b *bool) bool
- func SetDeferredUpdateAnnotation(anns map[string]string, value DeferMode) map[string]string
- func SetLogLevel(targetLevel int) error
- func SplitKernelArguments(args string) []string
- func SplitKernelArgumentsWithout(args string, exclude []string) []string
- func StringSlicesAsSetsEqual(a, b []string) bool
- func StringSlicesEqual(a, b []string) bool
- func Symlink(target, linkName string) error
- type DeferMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendMissingDefaultMCPManifests ¶
func AppendMissingDefaultMCPManifests(currentMCPs []*mcfgv1.MachineConfigPool) []*mcfgv1.MachineConfigPool
AppendMissingDefaultMCPManifests When default MCPs are missing, it is desirable to still generate the relevant files based off of the standard MCP labels and node selectors.
Here we create the default `master` and `worker` MCP if they are missing with their respective base Labels and NodeSelector Labels, this allows any resource such as PAO to utilize the default during bootstrap rendering.
func GetLeaderElectionConfig ¶
func GetLeaderElectionConfig(restcfg *rest.Config, enabled bool) configv1.LeaderElection
GetLeaderElectionConfig returns leader election configs defaults based on the cluster topology
func GetProviderName ¶
GetProviderName returns ProviderName part of 'providerID' in the format: <ProviderName>://<ProviderSpecificNodeID>
func IsDeferredUpdate ¶
func IsImmediateUpdate ¶
func IsNoMatchError ¶
IsNoMatchError checks if error is for a non existent resource, there is a meaningful difference between a resource type not existing on the cluster as a whole versus an individual resource not being found.
Example: OLM can be an optional operator, when the OLM resources do not exist, the returned error is a discovery error of meta.NoResourceMatchError.
A bug is present in controller-runtime@v0.16.1 and older where the returned error type is a DiscoveryFailedError this was fixed in https://github.com/kubernetes-sigs/controller-runtime/pull/2472 and versions of controller-runtime@v0.16.2 going forward will return the meta.NoResourceMatchError error. Here we check if either one is true.
func KernelArgumentsEqual ¶
KernelArgumentsEqual compares kernel arguments 'args1' and 'args2' excluding parameters 'exclude'. Returns true when they're equal. Note the order of kernel arguments matters. For example, "hugepagesz=1G hugepages=1" vs. "hugepages=1 hugepagesz=1G".
func MapOfStringsContains ¶
MapOfStringsContains returns true if map of strings a contains all entries of the map of strings b. Use MapOfStringsEqual for checking if two maps of strings are equal. For example MapOfStringsContains(map[string]string{"a": "a","b": "b"}, map[string]string{"a": "a"}) will return true, but MapOfStringsContains(map[string]string{"a": "a"}, map[string]string{"a": "a","b": "b"}) will return false.
func MapOfStringsCopy ¶
MapOfStringsCopy returns a copy of a map of strings 'a'.
func MapOfStringsEqual ¶
MapOfStringsEqual returns true if maps of strings 'a' and 'b' are equal. reflect.DeepEqual is roughly 10x slower than this.
func ObjectInfo ¶
func ObjectInfo(o interface{}) string
func ParseManifests ¶
ParseManifests parses a YAML or JSON document that may contain one or more kubernetes resources.
func PtrBoolEqual ¶
PtrBoolEqual returns true if the booleans pointed to by 'a' and 'b' are equal or both 'a' and 'b' are nil.
func SetLogLevel ¶
SetLogLevel was lifted with minor modifications from library-go. In their own words, it is a nasty hack and attempt to manipulate the global flags as klog does not expose a way to dynamically change the loglevel in runtime.
func SplitKernelArguments ¶
SplitKernelArguments splits kernel parameters into a slice of strings one parameter per string. Workaround for rhbz#1812605.
func SplitKernelArgumentsWithout ¶
SplitKernelArgumentsWithout splits kernel parameters excluding any parameters in the 'exclude' slice into a slice of strings one parameter per string.
func StringSlicesAsSetsEqual ¶
StringSlicesAsSetsEqual returns true if slices of strings 'a' and 'b' with their items sorted equally with duplicate items removed are the same.
func StringSlicesEqual ¶
StringSlicesEqual returns true if slices of strings 'a' and 'b' are the same.
Types ¶
type DeferMode ¶
type DeferMode string
DeferMode controls the deferred feature. Default is "never", which is the value assumed when no annotation is set, and which cause all objects to be processed immediately (never deferred)
const ( // DeferNever means deferred mode is disabled; treat as immediate update, like the annotation is not present. DeferNever DeferMode = "never" // DeferAlways means the changes carried will be deferred until the next node restart: both for the first application and for profile changes. DeferAlways DeferMode = "always" // DeferUpdate means in-place updates/changes to only the contents of the currently used profile. Switches to different TuneD profiles are processed immediately without the need to reboot. DeferUpdate DeferMode = "update" )