filesystem

package
v1.20.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package filesystem provides functionality to read Kubernetes objects from a filesystem tree and converting them to Nomos Custom Resource Definition objects.

Index

Constants

View Source
const SourceFormatKey = "SOURCE_FORMAT"

SourceFormatKey is the OS env variable and ConfigMap key for the SOT repository format.

Variables

This section is empty.

Functions

func AsCoreObjects

func AsCoreObjects(fos []ast.FileObject) []client.Object

AsCoreObjects converts a slice of FileObjects to a slice of client.Objects.

func FilterHierarchyFiles

func FilterHierarchyFiles(root cmpath.Absolute, files []cmpath.Absolute) []cmpath.Absolute

FilterHierarchyFiles filters out files that aren't in a top-level directory we care about. root and files are all absolute paths.

Types

type ConfigParser

type ConfigParser interface {
	Parse(filePaths reader.FilePaths) ([]ast.FileObject, status.MultiError)

	// ReadClusterRegistryResources returns the list of Clusters contained in the repo.
	ReadClusterRegistryResources(filePaths reader.FilePaths, sourceFormat configsync.SourceFormat) ([]ast.FileObject, status.MultiError)

	// ReadClusterNamesFromSelector returns the list of cluster names specified in
	// the `cluster-name-selector` annotation.
	ReadClusterNamesFromSelector(filePaths reader.FilePaths) ([]string, status.MultiError)
}

ConfigParser defines the minimum interface required for Reconciler to use a Parser to read configs from a filesystem.

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser reads files on disk and builds Nomos Config objects to be reconciled by the Syncer.

func NewParser

func NewParser(reader reader.Reader) *Parser

NewParser creates a new Parser using the given Reader and parser options.

func (*Parser) Parse

func (p *Parser) Parse(filePaths reader.FilePaths) ([]ast.FileObject, status.MultiError)

Parse parses file tree rooted at root and builds policy CRDs from supported Kubernetes policy resources. Resources are read from the following directories:

clusterName is the spec.clusterName of the cluster's ConfigManagement. enableAPIServerChecks, if true, contacts the API Server if it is unable to determine whether types are namespace- or cluster-scoped.

getSyncedCRDs is a callback that returns the CRDs on the API Server. filePaths is the list of absolute file paths to parse and the absolute and relative paths of the Nomos root.

It is an error for any files not to be present.

func (*Parser) ReadClusterNamesFromSelector

func (p *Parser) ReadClusterNamesFromSelector(filePaths reader.FilePaths) ([]string, status.MultiError)

ReadClusterNamesFromSelector returns the list of cluster names specified in the `cluster-name-selector` annotation.

func (*Parser) ReadClusterRegistryResources

func (p *Parser) ReadClusterRegistryResources(filePaths reader.FilePaths, format configsync.SourceFormat) ([]ast.FileObject, status.MultiError)

ReadClusterRegistryResources reads the manifests declared in clusterregistry/ for hierarchical format. For unstructured format, it reads all files.

Directories

Path Synopsis
Package cmpath is a library dedicated specifically to handling paths in a Nomos repository in a type safe way.
Package cmpath is a library dedicated specifically to handling paths in a Nomos repository in a type safe way.

Jump to

Keyboard shortcuts

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