privilegeddaemonset

package module
v1.0.22 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 12 Imported by: 5

README

K8s Daemonset in privilege mode

Functions

  • Creation of the daemonset in priviledge mode
  • Deletion of a daemonset in a specified namespace
  • Check if a daemonset is ready within a specified time

Usage

  1. Import the library
import k8sPriviledgedDs "github.com/test-network-function/privileged-daemonset"
  1. Set the K8s client to act on Daemonset object
k8sPriviledgedDs.SetDaemonSetClient(myK8sInterface) // myK8sInterface is of type kubernetes.Interface
  1. Invoke the exported functions in a specified namespace with a specified imagename

To create

daemonSetRunningPods, err := k8sPriviledgedDs.CreateDaemonSet(myDaemonSetName, myNameSpace, daemonSetContainerName, imageWithVersion, timeOut)

To delete

err := k8sPriviledgedDs.DeleteDaemonSet(myDaemonSetName, myNameSpace)

To check if the daemonset is ready

err := k8sPriviledgedDs.WaitDaemonsetReady(myDaemonSetName, myNameSpace)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigurePrivilegedServiceAccount added in v1.0.2

func ConfigurePrivilegedServiceAccount(namespace string) error

func CreateDaemonSet

func CreateDaemonSet(daemonSetName, namespace, containerName, imageWithVersion string, labels map[string]string, timeout time.Duration, cpuReq, cpuLim, memReq, memLim string) (aPodList *v1core.PodList, err error)

This function is used to create a daemonset with the specified name, namespace, container name and image with the timeout to check if the deployment is ready and all daemonset pods are running fine

func DeleteDaemonSet

func DeleteDaemonSet(daemonSetName, namespace string) error

This method is used to delete a daemonset specified by the name at a specified namespace

func DeleteNamespaceIfPresent added in v1.0.2

func DeleteNamespaceIfPresent(namespace string) (err error)

func IsDaemonSetReady added in v0.0.8

func IsDaemonSetReady(daemonSetName, namespace, image string) bool

func SetDaemonSetClient

func SetDaemonSetClient(aK8sClient kubernetes.Interface)

func WaitDaemonsetReady

func WaitDaemonsetReady(namespace, name string, timeout time.Duration) error

This function is used to wait until daemonset is ready

Types

type DaemonSetClient

type DaemonSetClient struct {
	K8sClient kubernetes.Interface
}

Jump to

Keyboard shortcuts

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