schemas

package
v2.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package schemas provides the JSON schemas embedded into the nelm binary, so that resources can be validated without network access. The archives are committed rather than built, so that importing nelm as a library gets them too; they are regenerated by scripts/schemagen, see data/README.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KubeVersion

func KubeVersion() (string, error)

KubeVersion returns the Kubernetes version resources are validated against: the newest the embedded schemas were collected from, pinned when they are generated.

func KubeVersions

func KubeVersions() ([]string, error)

KubeVersions returns the Kubernetes versions the embedded schemas were collected from, newest first.

Types

type Bundle

type Bundle struct {
	FilesCount int `json:"filesCount"`
	// KubeVersions are ordered newest first, and only set for the Kubernetes bundle.
	KubeVersions     []string `json:"kubeVersions,omitempty"`
	SHA256           string   `json:"sha256"`
	UncompressedSize int64    `json:"uncompressedSize"`
	UpstreamCommit   string   `json:"upstreamCommit"`
	UpstreamRef      string   `json:"upstreamRef"`
	UpstreamRepo     string   `json:"upstreamRepo"`
	// UpstreamTrees maps each collected Kubernetes version to the git tree sha of the upstream
	// directory its schemas came from, which is what tells a moved ref that changed those schemas from
	// one that did not. Only set for the Kubernetes bundle.
	UpstreamTrees map[string]string `json:"upstreamTrees,omitempty"`
}

Bundle describes one embedded archive. It is generated alongside the archive itself.

type Index

type Index struct {
	CRDs *Bundle `json:"crds"`
	// Kubernetes holds several minor versions merged into one flat set: the newest contributes all of
	// its schemas, every older one only what no newer version has any more, which is what keeps
	// resources of API versions removed along the way validatable.
	Kubernetes *Bundle `json:"kubernetes"`
}

Index describes the bundles embedded into this binary. Both are always present: a binary that cannot validate resources on its own is not a supported build.

func ReadIndex

func ReadIndex() (*Index, error)

ReadIndex returns the index of the embedded bundles.

type Source

type Source struct {
	// Template is a kubeconform schema source: a path template into the unpacked bundle.
	Template string
	// contains filtered or unexported fields
}

Source is a kubeconform schema source backed by an embedded bundle.

func CRDsSource

func CRDsSource() (*Source, error)

CRDsSource returns the schema source backed by the embedded CRD catalog.

func KubernetesSource

func KubernetesSource() (*Source, error)

KubernetesSource returns the schema source backed by the embedded Kubernetes schemas.

func (*Source) EnsureExtracted

func (s *Source) EnsureExtracted(ctx context.Context) error

EnsureExtracted unpacks the bundle backing this source. Callers must do this before reading it.

Jump to

Keyboard shortcuts

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