k8s

package
v0.2.14 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

defaultMondooClientResources for Mondoo Client container

Functions

func AreCronJobsEqual added in v0.2.8

func AreCronJobsEqual(a, b batchv1.CronJob) bool

AreCronJobsEqual returns a value indicating whether 2 cron jobs are equal. Note that it does not perform a full comparison but checks just some of the properties of a deployment (only the ones we are currently interested at).

func AreCronJobsSuccessful added in v0.2.8

func AreCronJobsSuccessful(cs []batchv1.CronJob) bool

AreCronJobsSuccessful returns true if the latest runs of all of the provided CronJobs has been successful.

func AreDeploymentsEqual

func AreDeploymentsEqual(a, b appsv1.Deployment) bool

AreDeploymentsEqual returns a value indicating whether 2 deployments are equal. Note that it does not perform a full comparison but checks just some of the properties of a deployment (only the ones we are currently interested at).

func AreResouceRequirementsEqual

func AreResouceRequirementsEqual(x corev1.ResourceRequirements, y corev1.ResourceRequirements) bool

AreResouceRequirementsEqual returns a value indicating whether 2 resource requirements are equal.

func AreServicesEqual

func AreServicesEqual(a, b corev1.Service) bool

AreServicesEqual return a value indicating whether 2 services are equal. Note that it does not perform a full comparison but checks just some of the properties of a deployment (only the ones we are currently interested at).

func CheckIfExists added in v0.2.8

func CheckIfExists(ctx context.Context, kubeClient client.Client, retrieveObj, checkObj client.Object) (bool, error)

CheckIfExists will attempt to Get() the object, and report whether or not the object was found to exist.

func CreateIfNotExist

func CreateIfNotExist(ctx context.Context, kubeClient client.Client, retrieveObj, createObj client.Object) (bool, error)

CreateIfNotExist creates an object if it doesn't already exist. The returned boolean indicates whether the object has been created. If the object already existed or an error occurred, then "false" is returned. If the object exists, no AlreadyExists error is returned.

func DeleteIfExists

func DeleteIfExists(ctx context.Context, kubeClient client.Client, obj client.Object) error

DeleteIfExists deletes a Kubernetes object if it exists. Any errors that might pop up because the object does not exist are ignored.

func GetRunningNamespace added in v0.2.6

func GetRunningNamespace() (string, error)

GetRunningNamespace will return the namespace the Pod is running under Can fake the returned value (useful for local testing) by setting MONDOO_NAMESPACE_OVERRIDE

func ResourcesRequirementsWithDefaults

func ResourcesRequirementsWithDefaults(m corev1.ResourceRequirements) corev1.ResourceRequirements

ResourcesRequirementsWithDefaults will return the resource requirements from the parameter if such are specified. If not requirements are specified, default values will be returned.

func TaintToToleration added in v0.2.8

func TaintToToleration(t corev1.Taint) corev1.Toleration

func TaintsToTolerations added in v0.2.8

func TaintsToTolerations(taints []corev1.Taint) []corev1.Toleration

func UpdateDeployment

func UpdateDeployment(current *appsv1.Deployment, desired appsv1.Deployment)

UpdateDeployment updates a deployment such that it matches a desired state. The function does not replace all fields but only a set of fields that we are interested at.

func UpdateService

func UpdateService(current *corev1.Service, desired corev1.Service)

UpdateService updates a service such that it matches a desired state. The function does not replace all fields but only a set of fields that we are interested at.

Types

type IgnoreGenericEventsPredicate added in v0.2.8

type IgnoreGenericEventsPredicate struct{}

CreateOrDeletePredicate will completely generic events.

func (IgnoreGenericEventsPredicate) Create added in v0.2.8

func (IgnoreGenericEventsPredicate) Delete added in v0.2.8

func (IgnoreGenericEventsPredicate) Generic added in v0.2.8

func (IgnoreGenericEventsPredicate) Update added in v0.2.8

Jump to

Keyboard shortcuts

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