deployment

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Copyright 2026 The BlanketOps Authors. 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.

Package deployment implements the Deployment prerequisite mediator. The mediator owns the cross-cutting prerequisites a Deployment requires before the application layer may act: the git SSH secret, the Flux git SSH keypair, the GitOps manifests repository, and the runtime infrastructure. It is invoked by the Deployment domain during command handling — after resolution, before execution — and again during teardown. Prerequisite provisioning is gated on the Environment: the Environment CR must pre-exist as the root of the delivery chain, and it is the sole authority for the ClusterSecretStore binding used by every store-dependent secret this mediator reconciles. The Flux keypair is the exception — it is generated locally and has no store dependency.

Copyright 2026 The BlanketOps Authors. 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

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mediator

type Mediator struct {
	// Client is the Kubernetes client used for all prerequisite operations.
	Client client.Client

	// Scheme is the runtime scheme used for owner reference wiring.
	Scheme *runtime.Scheme

	// Log is the logger instance for this mediator.
	Log logr.Logger

	// Recorder handles logging of Kubernetes events.
	Recorder events.EventRecorder

	// DeploymentFluxGitSSHSecretReconciler has no store dependency — generates keypair locally.
	DeploymentFluxGitSSHSecretReconciler *gitFluxcd.DeploymentFluxGitSSHSecretReconciler
}

Mediator manages the prerequisite resources a Deployment depends on.

func New

func New(c client.Client, scheme *runtime.Scheme, log logr.Logger, recorder events.EventRecorder) *Mediator

New returns a new Mediator instance configured with the necessary dependencies.

func (*Mediator) CleanupPrerequisites

func (m *Mediator) CleanupPrerequisites(ctx context.Context, resolved *deploymentResolution.ResolvedDeployment) error

CleanupPrerequisites reverses EnsurePrerequisites — tears down the GitOps manifests repository (remote and local clone), the Flux git SSH keypair, and the git SSH secret this mediator provisioned. Called from the domain's CmdDelete branch, gated by the finalizer at the controller level. Teardown runs in reverse provisioning order. All teardown steps are attempted regardless of individual failures, and errors are aggregated — a stuck repository deletion shouldn't block cleanup of the secrets. Any returned error keeps the finalizer in place for retry on next reconcile.

func (*Mediator) EnsurePrerequisites

func (m *Mediator) EnsurePrerequisites(ctx context.Context, resolved *deploymentResolution.ResolvedDeployment) error

EnsurePrerequisites provisions the prerequisites a Deployment requires before execution: the git SSH secret, the Flux git SSH keypair, the GitOps manifests repository, and the runtime infrastructure. Called from the domain's CmdCreate/CmdUpdate branch after resolution succeeds. Provisioning is fail-fast — the first failing step returns its error and the domain records DeploymentPrerequisitesCreateFailed.

Jump to

Keyboard shortcuts

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