pagesdeployment

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package pagesdeployment implements the Controller for PagesDeployment CRD. This controller directly calls Cloudflare API and writes status back to CRD, following the simplified 3-layer architecture (CRD → Controller → CF API).

Index

Constants

View Source
const (
	FinalizerName = "pagesdeployment.networking.cloudflare-operator.io/finalizer"

	// AnnotationForceRedeploy is the annotation key to force a new deployment.
	// When this annotation value changes, a new deployment will be triggered
	// even if the spec hasn't changed. This is useful for re-deploying the
	// same configuration.
	AnnotationForceRedeploy = "cloudflare-operator.io/force-redeploy"

	// AnnotationLastForceRedeploy stores the last processed force-redeploy value
	AnnotationLastForceRedeploy = "cloudflare-operator.io/last-force-redeploy"

	// AnnotationAutoRetry enables automatic retry for transient failures.
	// Set to "true" to enable, "false" or absent to disable.
	// When enabled, transient failures (e.g., Cloudflare platform issues) will be automatically retried.
	AnnotationAutoRetry = "cloudflare-operator.io/auto-retry"

	// AnnotationRetryCount tracks the current retry count for automatic retries.
	// This is managed internally by the controller.
	AnnotationRetryCount = "cloudflare-operator.io/retry-count"

	// AnnotationLastFailedAt stores the timestamp of the last failure.
	// Used for exponential backoff calculations.
	AnnotationLastFailedAt = "cloudflare-operator.io/last-failed-at"

	// AnnotationFailureReason stores the categorized failure reason.
	// Values: "transient", "permanent", "unknown"
	AnnotationFailureReason = "cloudflare-operator.io/failure-reason"

	// EventReasonProductionConflict indicates another production deployment exists
	EventReasonProductionConflict = "ProductionConflict"
	// EventReasonProductionProtected indicates production deletion is blocked
	EventReasonProductionProtected = "ProductionProtected"
	// EventReasonDeprecationWarning indicates deprecated fields are being used
	EventReasonDeprecationWarning = "DeprecationWarning"
	// EventReasonDeploymentCreated indicates a new deployment was created
	EventReasonDeploymentCreated = "DeploymentCreated"
	// EventReasonDeploymentPolling indicates polling deployment status
	EventReasonDeploymentPolling = "DeploymentPolling"
	// EventReasonDeploymentSucceeded indicates deployment succeeded
	EventReasonDeploymentSucceeded = "DeploymentSucceeded"
	// EventReasonDeploymentFailed indicates deployment failed
	EventReasonDeploymentFailed = "DeploymentFailed"
	// EventReasonDeploymentRetrying indicates deployment is being retried
	EventReasonDeploymentRetrying = "DeploymentRetrying"

	// PollingInterval is the interval for polling in-progress deployments
	PollingInterval = 30 * time.Second

	// MaxAutoRetries is the maximum number of automatic retries for transient failures
	MaxAutoRetries = 3

	// BaseRetryDelay is the base delay for exponential backoff (doubles each retry)
	BaseRetryDelay = 30 * time.Second

	// MaxRetryDelay is the maximum delay between retries
	MaxRetryDelay = 5 * time.Minute
)
View Source
const (
	// ConditionTypeCloudflareResourceExists indicates whether the Cloudflare deployment exists.
	// When False, the deployment was likely cleaned by Cloudflare's retention policy.
	ConditionTypeCloudflareResourceExists = "CloudflareResourceExists"

	// ConditionTypeSpecChangeIgnored indicates that spec changes were ignored for a terminal deployment.
	ConditionTypeSpecChangeIgnored = "SpecChangeIgnored"

	// ConditionTypeDeploymentRecovered indicates that the deployment was recovered by commit hash.
	ConditionTypeDeploymentRecovered = "DeploymentRecovered"
)

Condition types for PagesDeployment

Variables

This section is empty.

Functions

func CommitHashMatches added in v0.51.0

func CommitHashMatches(hash1, hash2 string) bool

CommitHashMatches checks if two commit hashes match. Supports both full hash and short hash (prefix) matching. At least 7 characters are required for short hash matching.

func ExtractCommitHash added in v0.51.0

func ExtractCommitHash(deployment *networkingv1alpha2.PagesDeployment) string

ExtractCommitHash extracts the commit hash from the deployment spec. Returns empty string if no commit hash is specified.

func IsInProgressState added in v0.51.0

func IsInProgressState(state networkingv1alpha2.PagesDeploymentState) bool

IsInProgressState checks if the deployment is actively being processed. In-progress deployments can be recreated if the Cloudflare deployment is lost.

func IsTerminalState added in v0.51.0

func IsTerminalState(state networkingv1alpha2.PagesDeploymentState) bool

IsTerminalState checks if the deployment is in a terminal state. Terminal states represent completed deployments that should not be automatically recreated. Once in a terminal state, the deployment becomes immutable (a historical record).

Types

type PagesDeploymentReconciler

type PagesDeploymentReconciler struct {
	client.Client
	Scheme     *runtime.Scheme
	Recorder   record.EventRecorder
	APIFactory *common.APIClientFactory
}

PagesDeploymentReconciler reconciles a PagesDeployment object. It directly calls Cloudflare API and writes status back to CRD, following the simplified 3-layer architecture.

func (*PagesDeploymentReconciler) Reconcile

func (*PagesDeploymentReconciler) SetupWithManager

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

Jump to

Keyboard shortcuts

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