sourceview

package
v0.2.11 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package sourceview reduces the source a PtahSchema or a PtahMigration last resolved to what `kubectl ptah` prints: which kind of source it is, where it was read from, and what it resolved to.

Everything comes from the resource's status, which records no credential, so neither does a view. A Git repository URL cannot carry one: the API refuses a URL with user information other than an SSH user name.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Name, Value string
}

Field is one line of the text a view prints.

type Kind

type Kind string

Kind is the kind of source a resource resolved.

const (
	// KindOCI is an artifact in an OCI registry.
	KindOCI Kind = "OCI"
	// KindConfigMap is a ConfigMap in the resource's namespace.
	KindConfigMap Kind = "ConfigMap"
	// KindGit is a commit of a Git repository.
	KindGit Kind = "Git"
)

type View

type View struct {
	Kind Kind `json:"kind"`

	// Reference is an OCI artifact with its tag replaced by the digest it
	// resolved to, and Digest that digest on its own.
	Reference string `json:"reference,omitempty"`
	Digest    string `json:"digest,omitempty"`
	// Verified says an OCI artifact's verification policy accepted it.
	Verified bool `json:"verified,omitempty"`

	// ConfigMap is the ConfigMap the files were read from, and Snapshot the
	// immutable copy every operation reads.
	ConfigMap string `json:"configMap,omitempty"`
	Snapshot  string `json:"snapshot,omitempty"`

	// Repository, Ref and Path are what a Git source asked for, and Commit
	// what the ref named when it resolved.
	Repository string                   `json:"repository,omitempty"`
	Ref        *operatorv1alpha1.GitRef `json:"ref,omitempty"`
	Path       string                   `json:"path,omitempty"`
	Commit     string                   `json:"commit,omitempty"`

	// ContentDigest is the digest of a ConfigMap or Git source's selected
	// files, the content a plan computed from them is bound to.
	ContentDigest string `json:"contentDigest,omitempty"`
	// SourcePolicyDigest is the content of the source policy the resolution
	// was checked against, when the resource names one.
	SourcePolicyDigest string `json:"sourcePolicyDigest,omitempty"`
}

View is one resolved source. The fields of the other kinds stay empty.

func FromMigration

FromMigration is the source a migration last resolved, or nil before the first resolution. A migration's verification is a condition rather than a status field, so an OCI view says nothing about it.

func FromSchema

func FromSchema(status operatorv1alpha1.SchemaSourceStatus) *View

FromSchema is the source a schema last resolved, or nil before the first resolution.

func (*View) Fields

func (v *View) Fields() []Field

Fields are the lines a view prints, in order. An OCI source prints what it always printed: the artifact, and whether it was verified.

Jump to

Keyboard shortcuts

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