mondoo

package
v1.12.5 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: MPL-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CnspecImage              = "docker.io/mondoo/cnspec"
	CnspecTag                = "8-rootless"
	OpenShiftMondooClientTag = "8-ubi-rootless"
	MondooOperatorImage      = "ghcr.io/mondoohq/mondoo-operator"
)

Variables

View Source
var MondooOperatorTag = version.Version

On a normal mondoo-operator build, the Version variable will be set at build time to match the $VERSION being built (or default to the git SHA). In the event that someone did a manual build of mondoo-operator and failed to set the Version variable it will get a default value of "latest".

Functions

func CreateServiceAccountFromToken added in v0.7.1

func CreateServiceAccountFromToken(ctx context.Context, kubeClient client.Client, mondooClientBuilder MondooClientBuilder, withConsoleIntegration bool, serviceAccountSecret types.NamespacedName, tokenSecretData string, log logr.Logger) error

CreateServiceAccountFromToken will take the provided Mondoo token and exchange it with the Mondoo API for a long lived Mondoo ServiceAccount

func CreateSignedToken added in v0.6.0

func CreateSignedToken(pk *ecdsa.PrivateKey, sa mondooclient.ServiceAccountCredentials, logger logr.Logger) (string, error)

func FindMondooOperatorConfigCondition

FindMondooOperatorConfigCondition iterates all conditions on a MondooOperatorConfig looking for the specified condition type. If none exists nil will be returned.

func GenerateTokenFromServiceAccount added in v0.6.0

func GenerateTokenFromServiceAccount(serviceAccount mondooclient.ServiceAccountCredentials, logger logr.Logger) (string, error)

func IntegrationCheckIn added in v0.7.1

func IntegrationCheckIn(
	ctx context.Context,
	integrationMrn string,
	sa mondooclient.ServiceAccountCredentials,
	mondooClientBuilder func(mondooclient.ClientOptions) mondooclient.Client,
	logger logr.Logger,
) error

func SetMondooOperatorConfigCondition

func SetMondooOperatorConfigCondition(
	conditions []mondoov1alpha2.MondooOperatorConfigCondition,
	conditionType mondoov1alpha2.MondooOperatorConfigConditionType,
	status corev1.ConditionStatus,
	reason string,
	message string,
	updateConditionCheck UpdateConditionCheck,
) []mondoov1alpha2.MondooOperatorConfigCondition

SetMondooOperatorConfigCondition sets the condition for the MondooOperatorConfig and returns the new slice of conditions. If the MondooAuditCOnfi does not already have a condition with the specified type, a condition will be added to the slice if and only if the specified status is True. If the MondooAuditConfig does already have a condition with the specified type, the condition will be updated if either of the following are true. 1) Requested status is different than existing status. 2) The updateConditionCheck function returns true.

func UpdateConditionAlways

func UpdateConditionAlways(_, _, _, _ string) bool

UpdateConditionAlways returns true. The condition will always be updated.

func UpdateConditionIfReasonOrMessageChange

func UpdateConditionIfReasonOrMessageChange(oldReason, oldMessage, newReason, newMessage string) bool

UpdateConditionIfReasonOrMessageChange returns true if there is a change in the reason or the message of the condition.

func UpdateConditionNever

func UpdateConditionNever(_, _, _, _ string) bool

UpdateConditionNever return false. The condition will never be updated, unless there is a change in the status of the condition.

func UpdateMondooAuditStatus

func UpdateMondooAuditStatus(ctx context.Context, client client.Client, origMOC, newMOC *mondoov1alpha2.MondooAuditConfig, log logr.Logger) error

func UpdateMondooOperatorConfigStatus

func UpdateMondooOperatorConfigStatus(ctx context.Context, client client.Client, origMOC, newMOC *mondoov1alpha2.MondooOperatorConfig, log logr.Logger) error

Types

type ContainerImageResolver

type ContainerImageResolver interface {
	// MondooClientImage return the Mondoo client image. If skipResolveImage is false, then the image tag is replaced
	// by a digest. If userImage or userTag are empty strings, default values are used.
	MondooClientImage(userImage, userTag string, skipImageResolution bool) (string, error)

	// MondooOperatorImage return the Mondoo operator image. If skipResolveImage is false, then the image tag is replaced
	// by a digest. If userImage or userTag are empty strings, default values are used.
	MondooOperatorImage(userImage, userTag string, skipImageResolution bool) (string, error)
}

func NewContainerImageResolver

func NewContainerImageResolver(isOpenShift bool) ContainerImageResolver

type MondooClientBuilder added in v0.7.1

type MondooClientBuilder func(mondooclient.ClientOptions) mondooclient.Client

type UpdateConditionCheck

type UpdateConditionCheck func(oldReason, oldMessage, newReason, newMessage string) bool

UpdateConditionCheck tests whether a condition should be updated from the old condition to the new condition. Returns true if the condition should be updated.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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