dryrun

package
v0.14.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dryrun asks the cluster whether it would accept a GitOps change from the caller, before the change goes to Git. Every object the GitOps controller would apply is server-side applied, and every object it would prune is deleted, both with DryRunAll and the caller's client: RBAC and admission decide for the caller's identity exactly as for a real write, and nothing is persisted. The change must be committed with the same identity, or the check proves nothing about the commit.

The package reads no GitOps controller object, so it holds for Flux, Argo CD or any other controller.

Index

Constants

This section is empty.

Variables

View Source
var ErrRefused = errors.New("the cluster refuses the change")

ErrRefused is the cluster refusing at least one object of a change for the caller's identity: RBAC (Forbidden) or admission (Forbidden or Invalid). The error Check returns also wraps each refusal, so apierrors.IsForbidden and apierrors.IsInvalid hold for the first one.

Functions

func Check

func Check(ctx context.Context, client dynamic.Interface, mapper meta.RESTMapper, fieldManager string, change manifest.Change) error

Check dry-runs change with client, the caller's client, mapping each object's kind with mapper. fieldManager names the server-side apply.

It returns nil when the cluster accepts every object, and an error wrapping ErrRefused that names each refused object otherwise. A namespace that does not exist yet is an error: admission cannot validate its objects until the namespace exists. An object to prune that is already gone passes. A namespaced object without a namespace, a kind the mapper does not know and a request that fails are errors without ErrRefused: the cluster did not answer for the caller.

An applied object is sent without metadata.managedFields and metadata.resourceVersion, as a file in Git carries neither: server-side apply rejects the first and takes the second as a precondition.

Types

This section is empty.

Jump to

Keyboard shortcuts

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