certconfigmapgenerator

package
v2.27.0 Latest Latest
Warning

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

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

Documentation

Overview

Package certconfigmapgenerator contains generator logic of add cert configmap resource in user namespaces

Index

Constants

This section is empty.

Variables

View Source
var ConfigMapChangedPredicate = predicate.Funcs{
	UpdateFunc: func(e event.UpdateEvent) bool {
		oldCM, _ := e.ObjectOld.(*corev1.ConfigMap)
		newCM, _ := e.ObjectNew.(*corev1.ConfigMap)
		return !reflect.DeepEqual(oldCM.Data, newCM.Data)
	},
}
View Source
var NamespaceCreatedPredicate = predicate.Funcs{
	CreateFunc: func(e event.CreateEvent) bool {
		namespace, isNamespaceObject := e.Object.(*corev1.Namespace)
		if !isNamespaceObject {
			return false
		}
		return trustedcabundle.ShouldInjectTrustedBundle(namespace)
	},

	UpdateFunc: func(e event.UpdateEvent) bool {
		oldNamespace, _ := e.ObjectOld.(*corev1.Namespace)
		newNamespace, _ := e.ObjectNew.(*corev1.Namespace)

		oldNsAnnValue, oldNsAnnExists := oldNamespace.GetAnnotations()[annotation.InjectionOfCABundleAnnotatoion]
		newNsAnnValue, newNsAnnExists := newNamespace.GetAnnotations()[annotation.InjectionOfCABundleAnnotatoion]

		if newNsAnnExists && !oldNsAnnExists {
			return true
		} else if newNsAnnExists && oldNsAnnExists && oldNsAnnValue != newNsAnnValue {
			return true
		}
		return false
	},

	DeleteFunc: func(deleteEvent event.DeleteEvent) bool {
		return false
	},
}

Functions

This section is empty.

Types

type CertConfigmapGeneratorReconciler

type CertConfigmapGeneratorReconciler struct {
	client.Client
}

CertConfigmapGeneratorReconciler holds the controller configuration.

func (*CertConfigmapGeneratorReconciler) Reconcile

Reconcile will generate new configmap, odh-trusted-ca-bundle, that includes cluster-wide trusted-ca bundle and custom ca bundle in every new namespace created.

func (*CertConfigmapGeneratorReconciler) SetupWithManager

func (r *CertConfigmapGeneratorReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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