v1beta1

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package v1beta1 file doc.go required for the doc generator to register this as an API

+groupName=jsonnet.io

Package v1beta1 contains API Schema definitions for the apps v1 API group +kubebuilder:object:generate=true +groupName=jsonnet.io

Index

Constants

View Source
const (
	// HealthyCondition is the condition type used
	// to record the last health assessment result.
	HealthyCondition string = "Healthy"

	// PruneFailedReason represents the fact that the
	// pruning of the Konfiguration failed.
	PruneFailedReason string = "PruneFailed"

	// ArtifactFailedReason represents the fact that the
	// artifact download of the Konfiguration failed.
	ArtifactFailedReason string = "ArtifactFailed"

	// BuildFailedReason represents the fact that the
	// kustomize build of the Konfiguration failed.
	BuildFailedReason string = "BuildFailed"

	// HealthCheckFailedReason represents the fact that
	// one of the health checks of the Konfiguration failed.
	HealthCheckFailedReason string = "HealthCheckFailed"

	// ValidationFailedReason represents the fact that the
	// validation of the Konfiguration manifests has failed.
	ValidationFailedReason string = "ValidationFailed"
)
View Source
const (
	// GitRepositoryIndexKey is the key used for indexing kustomizations
	// based on their Git sources.
	GitRepositoryIndexKey string = ".metadata.gitRepository"
	// BucketIndexKey is the key used for indexing kustomizations
	// based on their S3 sources.
	BucketIndexKey string = ".metadata.bucket"
)
View Source
const (
	// LastAppliedConfigAnnotation isthe annotation added to objects containing the checksum
	// of their last applied configuration. Used to check if a patch is required.
	LastAppliedConfigAnnotation string = "jsonnet.io/last-applied-checksum"

	// KonfigurationNameLabel is the label added to objects to denote the Konfiguration
	// they belong to. Used for garbage collection.
	KonfigurationNameLabel string = "jsonnet.io/konfiguration-name"

	// KonfigurationNamespaceLabel is the label added to objects to denote the Konfiguration's
	// namespace they belong to. Used for garbage collection.
	KonfigurationNamespaceLabel string = "jsonnet.io/konfiguration-namespace"

	// KonfigurationChecksumLabel is the label added to objects containing the full checksum of
	// the built konfiguration being applied. Used for garbage collection.
	KonfigurationChecksumLabel string = "jsonnet.io/konfiguration-checksum"

	// ResourceSkipPruning is the label or annotation that a user can apply to resources to have
	// them skipped during pruning.
	ResourceSkipPruning string = "jsonnet.io/prune"

	// PruningDisabledValue is the value set to ResourceSkipPruningLabel to exclude an object from
	// pruning.
	PruningDisabledValue string = "disabled"
)
View Source
const KonfigurationFinalizer string = "finalizers.jsonnet.io"

KonfigurationFinalizer is the finalizer placed on Konfiguration resources

View Source
const MaxConditionMessageLength int = 20000

MaxConditionMessageLength is the maximum length of a givven condition's message.

View Source
const ServerSideApplyOwner = "jsonnet-controller"

ServerSideApplyOwner is the FieldOwner used for Server-Side Apply.

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "jsonnet.io", Version: "v1beta1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func GetSource

GetSource will retrieve the source object referenced by sref.

Types

type Konfiguration

type Konfiguration struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   KonfigurationSpec   `json:"spec,omitempty"`
	Status KonfigurationStatus `json:"status,omitempty"`
}

Konfiguration is the Schema for the konfigurations API

func (*Konfiguration) DeepCopy

func (in *Konfiguration) DeepCopy() *Konfiguration

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Konfiguration.

func (*Konfiguration) DeepCopyInto

func (in *Konfiguration) DeepCopyInto(out *Konfiguration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Konfiguration) DeepCopyObject

func (in *Konfiguration) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Konfiguration) ForceCreate

func (k *Konfiguration) ForceCreate() bool

ForceCreate returns whether the controller should force recreating resources when patching fails due to an immutable field change.

func (*Konfiguration) GCEnabled

func (k *Konfiguration) GCEnabled() bool

GCEnabled returns whether garbage collection should be conducted on kubecfg manifests.

func (Konfiguration) GetDependsOn

GetDependsOn returns the konfigurations this one depends on.

func (*Konfiguration) GetHealthChecks

func (k *Konfiguration) GetHealthChecks() []meta.NamespacedObjectKindReference

GetHealthChecks returns the health checks for this Konfiguration.

func (*Konfiguration) GetInjectSnippet

func (k *Konfiguration) GetInjectSnippet() string

GetInjectSnippet returns any configured jsonnet snippet to add to the end of the execution.

func (*Konfiguration) GetInterval

func (k *Konfiguration) GetInterval() time.Duration

GetInterval returns the interval at which to reconcile the Konfiguration.

func (*Konfiguration) GetJsonnetPaths

func (k *Konfiguration) GetJsonnetPaths() []string

GetJsonnetPaths returns the search paths to configure in the jsonnet VM.

func (*Konfiguration) GetJsonnetURLs

func (k *Konfiguration) GetJsonnetURLs() []string

GetJsonnetURLs returns the URL paths to configure in the jsonnet VM.

func (*Konfiguration) GetKubeConfig

func (k *Konfiguration) GetKubeConfig() *KubeConfig

GetKubeConfig retrieves the kubeconfig to use for the operation if defined. When nil, it is assumed to use any client the caller already has configured (usually that of the controller-runtime at launch).

func (*Konfiguration) GetKubeConfigSecretName

func (k *Konfiguration) GetKubeConfigSecretName() string

GetKubeConfigSecretName satisfies the Impersonator interface and returns the kubeconfig secret name, if any.

func (*Konfiguration) GetNamespacedName

func (k *Konfiguration) GetNamespacedName() types.NamespacedName

GetNamespacedName returns the namespaced name for this Konfiguration.

func (*Konfiguration) GetPath

func (k *Konfiguration) GetPath() string

GetPath returns the Path to the jsonnet, json, or yaml to evaluate.

func (*Konfiguration) GetRetryInterval

func (k *Konfiguration) GetRetryInterval() time.Duration

GetRetryInterval returns the interval at which to retry a previously failed reconciliation.

func (*Konfiguration) GetServiceAccountName

func (k *Konfiguration) GetServiceAccountName() string

GetServiceAccountName satisfies the Impersonator interface and returns the service account to assume, if any.

func (*Konfiguration) GetSourceRef

GetSourceRef returns the source ref for this konfiguration.

func (*Konfiguration) GetStatusConditions

func (k *Konfiguration) GetStatusConditions() *[]metav1.Condition

GetStatusConditions returns the status conditions for this resource.

func (*Konfiguration) GetTimeout

func (k *Konfiguration) GetTimeout() time.Duration

GetTimeout returns the timeout for validation, apply and health checking operations.

func (*Konfiguration) GetVariables

func (k *Konfiguration) GetVariables() *Variables

GetVariables returns the external and top level arguments to pass to kubecfg.

func (*Konfiguration) IsSuspended

func (k *Konfiguration) IsSuspended() bool

IsSuspended returns whether the controller should not apply any manifests at the moment.

func (*Konfiguration) SetHealthiness

func (k *Konfiguration) SetHealthiness(ctx context.Context, cl client.Client, status metav1.ConditionStatus, statusMeta *StatusMeta) error

SetHealthiness sets the healthiness of this Konfiguration.

func (*Konfiguration) SetNotReady

func (k *Konfiguration) SetNotReady(ctx context.Context, cl client.Client, meta *StatusMeta) error

SetNotReady registers a failed apply attempt of this Konfiguration.

func (*Konfiguration) SetNotReadySnapshot

func (k *Konfiguration) SetNotReadySnapshot(ctx context.Context, cl client.Client, snapshot *Snapshot, meta *StatusMeta) error

SetNotReadySnapshot registers a failed apply attempt of this Konfiguration, including a Snapshot.

func (*Konfiguration) SetProgressing

func (k *Konfiguration) SetProgressing(ctx context.Context, cl client.Client) error

SetProgressing resets the conditions of this Konfiguration to a single ReadyCondition with status ConditionUnknown.

func (*Konfiguration) SetReadiness

func (k *Konfiguration) SetReadiness(ctx context.Context, cl client.Client, status metav1.ConditionStatus, statusMeta *StatusMeta) error

SetReadiness sets the ReadyCondition, ObservedGeneration, and LastAttemptedRevision, on the Konfiguration.

func (*Konfiguration) SetReady

func (k *Konfiguration) SetReady(ctx context.Context, cl client.Client, snapshot *Snapshot, meta *StatusMeta) error

SetReady registers a successful apply attempt of this Konfiguration.

func (*Konfiguration) ShouldValidate

func (k *Konfiguration) ShouldValidate() bool

ShouldValidate returns true if server-side validation is enabled.

type KonfigurationList

type KonfigurationList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Konfiguration `json:"items"`
}

KonfigurationList contains a list of Konfiguration

func (*KonfigurationList) DeepCopy

func (in *KonfigurationList) DeepCopy() *KonfigurationList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonfigurationList.

func (*KonfigurationList) DeepCopyInto

func (in *KonfigurationList) DeepCopyInto(out *KonfigurationList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*KonfigurationList) DeepCopyObject

func (in *KonfigurationList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type KonfigurationSpec

type KonfigurationSpec struct {
	// DependsOn may contain a dependency.CrossNamespaceDependencyReference slice
	// with references to Konfiguration resources that must be ready before this
	// Konfiguration can be reconciled.
	// +optional
	DependsOn []dependency.CrossNamespaceDependencyReference `json:"dependsOn,omitempty"`

	// The interval at which to reconcile the Konfiguration.
	// +required
	Interval metav1.Duration `json:"interval"`

	// The interval at which to retry a previously failed reconciliation.
	// When not specified, the controller uses the KonfigurationSpec.Interval
	// value to retry failures.
	// +optional
	RetryInterval *metav1.Duration `json:"retryInterval,omitempty"`

	// The KubeConfig for reconciling the Konfiguration on a remote cluster.
	// Defaults to the in-cluster configuration.
	// +optional
	KubeConfig *KubeConfig `json:"kubeConfig,omitempty"`

	// Path to the jsonnet, json, or yaml that should be applied to the cluster.
	// Defaults to 'None', which translates to the root path of the SourceRef.
	// When declared as a file path it is assumed to be from the root path of the SourceRef.
	// You may also define a HTTP(S) link to fetch files from a remote location.
	// +required
	Path string `json:"path"`

	// Additional search paths to add to the jsonnet importer. These are relative to
	// the root of the sourceRef.
	// +optional
	JsonnetPaths []string `json:"jsonnetPaths,omitempty"`

	// Additional HTTP(S) URLs to add to the jsonnet importer.
	// +optional
	JsonnetURLs []string `json:"jsonnetURLs,omitempty"`

	// External variables and top-level arguments to supply to the jsonnet
	// at `path`.
	// +optional
	Variables *Variables `json:"variables,omitempty"`

	// Inject raw jsonnet into the evaluation.
	// +optional
	Inject string `json:"inject,omitempty"`

	// The name of the Kubernetes service account to impersonate
	// when reconciling this Konfiguration.
	// +optional
	ServiceAccountName string `json:"serviceAccountName,omitempty"`

	// Reference of the source where the jsonnet, json, or yaml file(s) are.
	// +optional
	SourceRef *meta.NamespacedObjectKindReference `json:"sourceRef,omitempty"`

	// Prune enables garbage collection. This means that when newly rendered
	// jsonnet does not contain objects that were applied previously, they will
	// be removed. When a Konfiguration is removed that had this value set to
	// `true`, all resources created by it will also be removed.
	// +required
	Prune bool `json:"prune"`

	// A list of resources to be included in the health assessment.
	// +optional
	HealthChecks []meta.NamespacedObjectKindReference `json:"healthChecks,omitempty"`

	// This flag tells the controller to suspend subsequent reconciliations,
	// it does not apply to already started executions. Defaults to false.
	// +optional
	Suspend bool `json:"suspend,omitempty"`

	// Timeout for diff, validation, apply, and health checking operations.
	// Defaults to 'Interval' duration.
	// +optional
	Timeout *metav1.Duration `json:"timeout,omitempty"`

	// Validate input against the server schema, defaults to true. At the moment
	// this just implies a dry-run before patch/create operations.
	// This will be updated to support different methods of validation.
	// +kubebuilder:default:=true
	// +optional
	Validate bool `json:"validate,omitempty"`

	// Force instructs the controller to recreate resources
	// when patching fails due to an immutable field change.
	// +kubebuilder:default:=false
	// +optional
	Force bool `json:"force,omitempty"`
}

KonfigurationSpec defines the desired state of a Konfiguration

func (*KonfigurationSpec) DeepCopy

func (in *KonfigurationSpec) DeepCopy() *KonfigurationSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonfigurationSpec.

func (*KonfigurationSpec) DeepCopyInto

func (in *KonfigurationSpec) DeepCopyInto(out *KonfigurationSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type KonfigurationStatus

type KonfigurationStatus struct {
	// ObservedGeneration is the last reconciled generation.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// +optional
	Conditions []metav1.Condition `json:"conditions,omitempty"`

	// The last successfully applied revision.
	// The revision format for Git sources is <branch|tag>/<commit-sha>.
	// For HTTP(S) paths it will just be the URL.
	// +optional
	LastAppliedRevision string `json:"lastAppliedRevision,omitempty"`

	// LastAttemptedRevision is the revision of the last reconciliation attempt.
	// For HTTP(S) paths it will just be the URL.
	// +optional
	LastAttemptedRevision string `json:"lastAttemptedRevision,omitempty"`

	// The last successfully applied revision metadata.
	// +optional
	Snapshot *Snapshot `json:"snapshot,omitempty"`
}

KonfigurationStatus defines the observed state of Konfiguration

func (*KonfigurationStatus) DeepCopy

func (in *KonfigurationStatus) DeepCopy() *KonfigurationStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KonfigurationStatus.

func (*KonfigurationStatus) DeepCopyInto

func (in *KonfigurationStatus) DeepCopyInto(out *KonfigurationStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type KubeConfig

type KubeConfig struct {
	// SecretRef holds the name to a secret that contains a 'value' key with
	// the kubeconfig file as the value. It must be in the same namespace as
	// the Konfiguration.
	// It is recommended that the kubeconfig is self-contained, and the secret
	// is regularly updated if credentials such as a cloud-access-token expire.
	// Cloud specific `cmd-path` auth helpers will not function without adding
	// binaries and credentials to the Pod that is responsible for reconciling
	// the Konfiguration.
	// +required
	SecretRef corev1.LocalObjectReference `json:"secretRef,omitempty"`
}

KubeConfig holds the configuration for where to fetch the contents of a kubeconfig file.

func (*KubeConfig) DeepCopy

func (in *KubeConfig) DeepCopy() *KubeConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KubeConfig.

func (*KubeConfig) DeepCopyInto

func (in *KubeConfig) DeepCopyInto(out *KubeConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*KubeConfig) Fetch

func (k *KubeConfig) Fetch(ctx context.Context, c client.Client, namespace string) (string, error)

Fetch will use the given client and namespace to retrieve the contents of the kubeconfig from the referenced secret.

type Snapshot

type Snapshot struct {
	// The manifests sha1 checksum.
	// +required
	Checksum string `json:"checksum"`

	// A list of Kubernetes kinds grouped by namespace.
	// +required
	Entries []SnapshotEntry `json:"entries"`
}

Snapshot holds the metadata of the Kubernetes objects generated for a source revision

func NewSnapshotFromUnstructured added in v0.0.4

func NewSnapshotFromUnstructured(objects []*unstructured.Unstructured) (*Snapshot, error)

NewSnapshotFromUnstructured creates a new snapshot from the given list of unstructured objects.

func (*Snapshot) DeepCopy

func (in *Snapshot) DeepCopy() *Snapshot

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshot.

func (*Snapshot) DeepCopyInto

func (in *Snapshot) DeepCopyInto(out *Snapshot)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Snapshot) NamespacedKinds

func (s *Snapshot) NamespacedKinds() map[string][]schema.GroupVersionKind

NamespacedKinds returns the namespaced kinds in this snapshot.

func (*Snapshot) NonNamespacedKinds

func (s *Snapshot) NonNamespacedKinds() []schema.GroupVersionKind

NonNamespacedKinds returns the cluster-scoped kinds in this snapshot.

type SnapshotEntry

type SnapshotEntry struct {
	// The namespace of this entry.
	// +optional
	Namespace string `json:"namespace"`

	// The list of Kubernetes kinds.
	// +required
	Kinds map[string]string `json:"kinds"`
}

SnapshotEntry holds the metadata of namespaced Kubernetes objects

func (*SnapshotEntry) DeepCopy

func (in *SnapshotEntry) DeepCopy() *SnapshotEntry

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotEntry.

func (*SnapshotEntry) DeepCopyInto

func (in *SnapshotEntry) DeepCopyInto(out *SnapshotEntry)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StatusMeta

type StatusMeta struct {
	Revision, Reason, Message string
}

StatusMeta is a helper struct for setting the status on custom resources.

func NewStatusMeta

func NewStatusMeta(revision, reason, message string) *StatusMeta

NewStatusMeta returns a new StatusMeta object with the given parameters.

func (*StatusMeta) DeepCopy

func (in *StatusMeta) DeepCopy() *StatusMeta

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StatusMeta.

func (*StatusMeta) DeepCopyInto

func (in *StatusMeta) DeepCopyInto(out *StatusMeta)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Variables

type Variables struct {
	// Values of external variables with string values.
	// +optional
	ExtStr map[string]string `json:"extStr,omitempty"`
	// Values of external variables with values supplied as Jsonnet code.
	// +optional
	ExtCode map[string]string `json:"extCode,omitempty"`
	// Values for external variables. They will be used as strings or code
	// depending on the types encountered.
	// +optional
	ExtVars *extv1.JSON `json:"extVars,omitempty"`
	// Values of top-level-arguments with string values.
	// +optional
	TLAStr map[string]string `json:"tlaStr,omitempty"`
	// Values of top-level-arguments with values supplied as Jsonnet code.
	// +optional
	TLACode map[string]string `json:"tlaCode,omitempty"`
	// Values for top level arguments. They will be used as strings or code
	// depending on the types encountered.
	// +optional
	TLAVars *extv1.JSON `json:"tlaVars,omitempty"`
}

Variables describe code/strings for external variables and top-level arguments.

func (*Variables) DeepCopy

func (in *Variables) DeepCopy() *Variables

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Variables.

func (*Variables) DeepCopyInto

func (in *Variables) DeepCopyInto(out *Variables)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Variables) InjectIntoVM added in v0.0.9

func (v *Variables) InjectIntoVM(vm *jsonnet.VM) error

InjectIntoVM will inject the configured variables into the provided vm.

Jump to

Keyboard shortcuts

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