controllers

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Overview

Copyright 2022 Mondoo, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	WebhookLabelKey   = "control-plane"
	WebhookLabelValue = "webhook-manager"
)
View Source
const (
	NodeDaemonSetNameTemplate = `%s-node`
)
View Source
const (
	WorkloadDeploymentNameTemplate = `%s-workload`
)

Variables

View Source
var (
	Version string
)

Functions

func FindMondooOperatorConfigCondition added in v0.2.0

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

func SetMondooAuditCondition added in v0.2.2

func SetMondooAuditCondition(
	conditions []mondoov1alpha1.MondooAuditConfigCondition,
	conditionType mondoov1alpha1.MondooAuditConfigConditionType,
	status corev1.ConditionStatus,
	reason string,
	message string,
	updateConditionCheck UpdateConditionCheck,
) []mondoov1alpha1.MondooAuditConfigCondition

func SetMondooOperatorConfigCondition added in v0.2.0

func SetMondooOperatorConfigCondition(
	conditions []mondoov1alpha1.MondooOperatorConfigCondition,
	conditionType mondoov1alpha1.MondooOperatorConfigConditionType,
	status corev1.ConditionStatus,
	reason string,
	message string,
	updateConditionCheck UpdateConditionCheck,
) []mondoov1alpha1.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 added in v0.2.0

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

UpdateConditionAlways returns true. The condition will always be updated.

func UpdateConditionIfReasonOrMessageChange added in v0.2.0

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 added in v0.2.0

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 added in v0.2.2

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

func UpdateMondooOperatorConfigStatus added in v0.2.0

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

Types

type CertManagerHandler added in v0.0.11

type CertManagerHandler struct {
	Mondoo          *v1alpha1.MondooAuditConfig
	KubeClient      client.Client
	TargetNamespace string
	Scheme          *runtime.Scheme
}

func (*CertManagerHandler) Cleanup added in v0.0.11

func (c *CertManagerHandler) Cleanup(ctx context.Context) error

func (*CertManagerHandler) Setup added in v0.0.11

type MondooAuditConfigReconciler

type MondooAuditConfigReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

MondooAuditConfigReconciler reconciles a MondooAuditConfig object

func (*MondooAuditConfigReconciler) Reconcile

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state. TODO(user): Modify the Reconcile function to compare the state specified by the MondooAuditConfig object against the actual cluster state, and then perform operations to make the cluster state reflect the state specified by the user.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.10.0/pkg/reconcile

func (*MondooAuditConfigReconciler) SetupWithManager

func (r *MondooAuditConfigReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type MondooOperatorConfigReconciler added in v0.2.0

type MondooOperatorConfigReconciler struct {
	client.Client
	Scheme *runtime.Scheme
}

MondooOperatorConfigReconciler reconciles a MondooOperatorConfig object

func (*MondooOperatorConfigReconciler) Reconcile added in v0.2.0

Reconcile will check for a valid MondooOperatorConfig resource (only "mondoo-operator-config" allowed), and set up the mondoo-operator as indicated in the resource.

func (*MondooOperatorConfigReconciler) SetupWithManager added in v0.2.0

func (r *MondooOperatorConfigReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type Nodes

type Nodes struct {
	Enable               bool
	Mondoo               *v1alpha1.MondooAuditConfig
	Updated              bool
	Image                string
	MondooOperatorConfig *v1alpha1.MondooOperatorConfig
}

func (*Nodes) Reconcile

func (n *Nodes) Reconcile(ctx context.Context, clt client.Client, scheme *runtime.Scheme, req ctrl.Request, inventory string) (ctrl.Result, error)

type ServiceMonitor added in v0.2.0

type ServiceMonitor struct {
	Config          *mondoov1alpha1.MondooOperatorConfig
	TargetNamespace string
}

func (*ServiceMonitor) Reconcile added in v0.2.0

func (s *ServiceMonitor) Reconcile(ctx context.Context, clt client.Client, scheme *runtime.Scheme, req ctrl.Request) (ctrl.Result, error)

type UpdateConditionCheck added in v0.2.0

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.

type Webhooks added in v0.0.11

type Webhooks struct {
	Mondoo               *mondoov1alpha1.MondooAuditConfig
	KubeClient           client.Client
	TargetNamespace      string
	Scheme               *runtime.Scheme
	Image                string
	MondooOperatorConfig *mondoov1alpha1.MondooOperatorConfig
}

func (*Webhooks) Reconcile added in v0.0.11

func (n *Webhooks) Reconcile(ctx context.Context) (ctrl.Result, error)

type Workloads

type Workloads struct {
	Enable               bool
	Mondoo               *v1alpha1.MondooAuditConfig
	Updated              bool
	Image                string
	MondooOperatorConfig *v1alpha1.MondooOperatorConfig
}

func (*Workloads) Reconcile

func (n *Workloads) Reconcile(ctx context.Context, clt client.Client, scheme *runtime.Scheme, req ctrl.Request, inventory string) (ctrl.Result, error)

Jump to

Keyboard shortcuts

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