webhosting

package
v0.0.0-...-7573625 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2025 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ControllerName = "website"
)

Variables

View Source
var ConfigMapDataChanged = predicate.Funcs{
	UpdateFunc: func(e event.UpdateEvent) bool {
		if e.ObjectOld == nil || e.ObjectNew == nil {
			return false
		}

		oldConfigMap, ok := e.ObjectOld.(*corev1.ConfigMap)
		if !ok {
			return false
		}
		newConfigMap, ok := e.ObjectNew.(*corev1.ConfigMap)
		if !ok {
			return false
		}
		return !apiequality.Semantic.DeepEqual(oldConfigMap.Data, newConfigMap.Data)
	},
}

ConfigMapDataChanged is a predicate for filtering relevant ConfigMap events. Similar to predicate.GenerationChangedPredicate (ConfigMaps don't have a generation).

View Source
var DeploymentAvailabilityChanged = predicate.Funcs{
	UpdateFunc: func(e event.UpdateEvent) bool {
		if e.ObjectOld == nil || e.ObjectNew == nil {
			return false
		}

		oldDeployment, ok := e.ObjectOld.(*appsv1.Deployment)
		if !ok {
			return false
		}
		newDeployment, ok := e.ObjectNew.(*appsv1.Deployment)
		if !ok {
			return false
		}

		return utils.IsDeploymentReady(oldDeployment) != utils.IsDeploymentReady(newDeployment)
	},
}

DeploymentAvailabilityChanged is a predicate for filtering relevant Deployment events.

View Source
var WebsiteStatusChanged = predicate.Funcs{
	UpdateFunc: func(e event.UpdateEvent) bool {
		if e.ObjectOld == nil || e.ObjectNew == nil {
			return false
		}

		oldWebsite, ok := e.ObjectOld.(*webhostingv1alpha1.Website)
		if !ok {
			return false
		}
		newWebsite, ok := e.ObjectNew.(*webhostingv1alpha1.Website)
		if !ok {
			return false
		}

		return !apiequality.Semantic.DeepEqual(oldWebsite.Status, newWebsite.Status)
	},
}

WebsiteStatusChanged is a predicate that triggers when the Website status changes. The controller skips updating the status if it didn't change the cached object. In fast consecutive retries, this can lead to a Website in Error state, where the controller doesn't observe its own status update, and skips the transition to Ready afterward because the cached object was still in Ready state. To fix this, we trigger the controller one more time when observing its own status updates to ensure a correct status. This shouldn't hurt the standard case, because the controller doesn't cause any API calls if not needed.

Functions

This section is empty.

Types

type WebsiteReconciler

type WebsiteReconciler struct {
	Client   client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder

	Config *configv1alpha1.WebhostingOperatorConfig
	// contains filtered or unexported fields
}

WebsiteReconciler reconciles a Website object.

func (*WebsiteReconciler) MapThemeToWebsites

func (r *WebsiteReconciler) MapThemeToWebsites(ctx context.Context, theme client.Object) []reconcile.Request

MapThemeToWebsites maps a theme to all websites that use it.

func (*WebsiteReconciler) Reconcile

Reconcile reconciles a Website object.

func (*WebsiteReconciler) SetupWithManager

func (r *WebsiteReconciler) SetupWithManager(mgr manager.Manager, enableSharding bool, controllerRingName, shardName string) error

SetupWithManager sets up the controller with the Manager.

Directories

Path Synopsis
testserver command

Jump to

Keyboard shortcuts

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