Documentation ¶
Index ¶
- Constants
- func Apply(ctx context.Context, yamlContent string) error
- func ApplyTemplateWithRender(ctx context.Context, template *corev1.ConfigMap, dataKey string, ...) error
- func CopyFile(sourceFile string, destinationFile string) error
- func Delete(ctx context.Context, yamlContent string) error
- func DeleteTemplateWithRender(ctx context.Context, template *corev1.ConfigMap, dataKey string, ...) error
- func DisableNodeLifeCycleController(filePath string) error
- func EnableNodeLifeCycleController(filePath string) error
- func FileExists(filename string) (bool, error)
- func FileSameContent(sourceFile string, destinationFile string) (bool, error)
- func Get(ctx context.Context, yamlContent string) (*unstructured.Unstructured, error)
- func GetCmdLineByPid(pid int) (string, error)
- func GetContentFormString(content string, regularExpression string) []string
- func GetControlPlaneSize(ctx context.Context, cli client.Client) (int, error)
- func GetNodeCondition(status *corev1.NodeStatus, conditionType corev1.NodeConditionType) (int, *corev1.NodeCondition)
- func GetServiceCmdLine(name string) (string, error)
- func GetSingleContentPreferLastMatchFromFile(filename string, regularExpression string) (string, error)
- func GetSingleContentPreferLastMatchFromString(content string, regularExpression string) (string, error)
- func GetYurtComponentImageByType(yurtCluster *operatorv1alpha1.YurtCluster, imageType YurtImageType) string
- func IsControlPlaneNode(node *corev1.Node) bool
- func IsNodeReady(node *corev1.Node) bool
- func MarshalToYaml(obj runtime.Object, gv schema.GroupVersion) ([]byte, error)
- func MarshalToYamlForCodecs(obj runtime.Object, gv schema.GroupVersion, codecs serializer.CodecFactory) ([]byte, error)
- func ObjectToYaml(obj runtime.Object) (string, error)
- func RenderTemplate(tmpl string, context map[string]string) (string, error)
- func RestartService(service string) error
- func RunCommand(cmd string) ([]byte, error)
- func RunCommandWithCombinedOutput(cmd string) ([]byte, error)
- func ShouldSkip(ctx context.Context, yamlContent string) bool
- func YamlToObject(yamlContent []byte) (client.Object, error)
- type YurtImageType
Constants ¶
const ( // SkipReconcileAnnotation defines the annotation which marks the object should not be reconciled SkipReconcileAnnotation = "operator.openyurt.io/skip-reconcile" // ControlPlaneLabel defines the label for control-plane node ControlPlaneLabel = "node-role.kubernetes.io/master" )
Variables ¶
This section is empty.
Functions ¶
func ApplyTemplateWithRender ¶
func ApplyTemplateWithRender(ctx context.Context, template *corev1.ConfigMap, dataKey string, values map[string]string) error
ApplyTemplateWithRender renders and applies the manifests into cluster.
func DeleteTemplateWithRender ¶
func DeleteTemplateWithRender(ctx context.Context, template *corev1.ConfigMap, dataKey string, values map[string]string) error
DeleteTemplateWithRender renders and deletes the manifests from cluster.
func DisableNodeLifeCycleController ¶
DisableNodeLifeCycleController disables nodelifecycle controller for kube-controller-manager
func EnableNodeLifeCycleController ¶
EnableNodeLifeCycleController enables nodelifecycle controller for kube-controller-manager
func FileExists ¶
FileExists determines whether the file exists
func FileSameContent ¶
FileSameContent determines whether the source file and destination file is same
func Get ¶
func Get(ctx context.Context, yamlContent string) (*unstructured.Unstructured, error)
Get gets object based on the yaml manifests from cluster.
func GetCmdLineByPid ¶
GetCmdLineByPid returns the service CMDLine by PID
func GetContentFormString ¶
GetContentFormString returns all strings that match the regular expression regularExpression
func GetControlPlaneSize ¶
GetControlPlaneSize returns the size of control-plane
func GetNodeCondition ¶
func GetNodeCondition(status *corev1.NodeStatus, conditionType corev1.NodeConditionType) (int, *corev1.NodeCondition)
GetNodeCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetServiceCmdLine ¶
GetServiceCmdLine returns the cmd line of given service
func GetSingleContentPreferLastMatchFromFile ¶
func GetSingleContentPreferLastMatchFromFile(filename string, regularExpression string) (string, error)
GetSingleContentPreferLastMatchFromFile determines whether there is a unique string that matches the regular expression regularExpression and returns it. If multiple values exist, return the last one.
func GetSingleContentPreferLastMatchFromString ¶
func GetSingleContentPreferLastMatchFromString(content string, regularExpression string) (string, error)
GetSingleContentPreferLastMatchFromString determines whether there is a unique string that matches the regular expression regularExpression and returns it. If multiple values exist, return the last one.
func GetYurtComponentImageByType ¶
func GetYurtComponentImageByType(yurtCluster *operatorv1alpha1.YurtCluster, imageType YurtImageType) string
GetYurtComponentImageByType returns the full image name of OpenYurt component by ImageType
func IsControlPlaneNode ¶
IsControlPlaneNode returns true when the node is control-plane node
func IsNodeReady ¶
IsNodeReady returns true if the node is ready
func MarshalToYaml ¶
MarshalToYaml marshals an object into yaml.
func MarshalToYamlForCodecs ¶
func MarshalToYamlForCodecs(obj runtime.Object, gv schema.GroupVersion, codecs serializer.CodecFactory) ([]byte, error)
MarshalToYamlForCodecs marshals an object into yaml using the specified codec
func ObjectToYaml ¶
ObjectToYaml serializes the object to yaml format
func RenderTemplate ¶
RenderTemplate fills out the manifest template with the context.
func RestartService ¶
RestartService tries to restart a service. Currently, only systemd service is supported.
func RunCommand ¶
RunCommand runs a command by sh shell.
func RunCommandWithCombinedOutput ¶
RunCommandWithCombinedOutput runs a command by sh shell with combined output.
func ShouldSkip ¶
ShouldSkip returns true if the object contains SkipReconcileAnnotation annotation with true value.
Types ¶
type YurtImageType ¶
type YurtImageType int
YurtImageType defines the image type for yurt components
const ( // YurtHubImageForCloudNode represents the yurt hub image for cloud node YurtHubImageForCloudNode YurtImageType = iota // YurtHubImageForEdgeNode represents the yurt hub image for edge node YurtHubImageForEdgeNode // YurtTunnelServerImage represents the yurt tunnel server image YurtTunnelServerImage // YurtTunnelAgentImage represents the yurt tunnel agent image YurtTunnelAgentImage )