kotsutil

package
v1.109.6 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 48 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BrandingFontFileExtensions = map[string]string{
		".woff":  "woff",
		".woff2": "woff2",
		".ttf":   "truetype",
		".otf":   "opentype",
		".eot":   "embedded-opentype",
		".svg":   "svg",
	}
)

Functions

func ContentToDocNode added in v1.103.2

func ContentToDocNode(doc *goyaml.Node, nodes []*goyaml.Node) *goyaml.Node

func EncodeIdentityConfig

func EncodeIdentityConfig(spec kotsv1beta1.IdentityConfig) ([]byte, error)

func EncodeIngressConfig

func EncodeIngressConfig(ingressConfig kotsv1beta1.IngressConfig) ([]byte, error)

func FilterV1Beta1ChartsWithV1Beta2Charts added in v1.99.0

func FilterV1Beta1ChartsWithV1Beta2Charts(v1Beta1Charts []kotsv1beta1.HelmChart, v1Beta2Charts []kotsv1beta2.HelmChart) []kotsv1beta1.HelmChart

FilterV1Beta1ChartsWithV1Beta2Charts filters out any v1beta1 charts where a cooresponding v1beta2 chart exists with the same release name (or chart name if release name is not set)

func FindAirgapMetaInBundle added in v1.82.0

func FindAirgapMetaInBundle(airgapBundle string) (*kotsv1beta1.Airgap, error)

func FindAirgapMetaInDir added in v1.82.0

func FindAirgapMetaInDir(root string) (*kotsv1beta1.Airgap, error)

func FindConfigInPath added in v1.105.0

func FindConfigInPath(fromDir string) (*kotsv1beta1.Config, error)

func FindKotsAppInPath added in v1.105.0

func FindKotsAppInPath(fromDir string) (*kotsv1beta1.Application, error)

func FixUpYAML

func FixUpYAML(inputContent []byte) ([]byte, error)

FixUpYAML is a general purpose function that will ensure that YAML is compatible with KOTS This ensures that lines aren't wrapped at 80 chars which breaks template functions

func GetEmbeddedRegistryCreds added in v1.108.2

func GetEmbeddedRegistryCreds(clientset kubernetes.Interface) (hostname string, username string, password string)

func GetImagesFromKotsKinds

func GetImagesFromKotsKinds(kotsKinds *KotsKinds, destRegistry *registrytypes.RegistryOptions) ([]string, error)

func GetIncompatbileKotsVersionMessage

func GetIncompatbileKotsVersionMessage(kotsApplication kotsv1beta1.Application, isInstall bool) string

func GetKOTSBinPath added in v1.82.0

func GetKOTSBinPath() string

func GetKotsKindsPath added in v1.105.0

func GetKotsKindsPath(archive string) string

GetKotsKindsPath returns the path to load kots kinds from in an app version archive created by kots

func GetKurlS3Secret

func GetKurlS3Secret() (*corev1.Secret, error)

func HasEmbeddedRegistry added in v1.108.2

func HasEmbeddedRegistry(clientset kubernetes.Interface) bool

func IsApiVersionKind added in v1.99.0

func IsApiVersionKind(content []byte, apiVersion, kind string) bool

func IsKotsAutoUpgradeSupported

func IsKotsAutoUpgradeSupported(app *kotsv1beta1.Application) bool

func IsKotsKind added in v1.101.2

func IsKotsKind(apiVersion string, kind string) bool

func IsKotsVersionCompatibleWithApp

func IsKotsVersionCompatibleWithApp(kotsApplication kotsv1beta1.Application, isInstall bool) bool

func LoadAirgapFromBytes added in v1.82.0

func LoadAirgapFromBytes(data []byte) (*kotsv1beta1.Airgap, error)

func LoadApplicationFromBytes added in v1.90.0

func LoadApplicationFromBytes(content []byte) (*kotsv1beta1.Application, error)

func LoadApplicationFromContents

func LoadApplicationFromContents(content []byte) (*applicationv1beta1.Application, error)

func LoadBackupFromContents

func LoadBackupFromContents(content []byte) (*velerov1.Backup, error)

func LoadBrandingArchiveFromPath added in v1.86.2

func LoadBrandingArchiveFromPath(archivePath string) (*bytes.Buffer, error)

func LoadConfigFromBytes

func LoadConfigFromBytes(data []byte) (*kotsv1beta1.Config, error)

func LoadConfigValuesFromBytes

func LoadConfigValuesFromBytes(data []byte) (*kotsv1beta1.ConfigValues, error)

func LoadConfigValuesFromFile

func LoadConfigValuesFromFile(configValuesFilePath string) (*kotsv1beta1.ConfigValues, error)

func LoadEmbeddedClusterConfigFromBytes added in v1.104.5

func LoadEmbeddedClusterConfigFromBytes(data []byte) (*embeddedclusterv1beta1.Config, error)

func LoadIdentityConfigFromContents

func LoadIdentityConfigFromContents(content []byte) (*kotsv1beta1.IdentityConfig, error)

func LoadIdentityFromContents

func LoadIdentityFromContents(content []byte) (*kotsv1beta1.Identity, error)

func LoadIngressConfigFromContents

func LoadIngressConfigFromContents(content []byte) (*kotsv1beta1.IngressConfig, error)

func LoadInstallationFromContents

func LoadInstallationFromContents(installationData []byte) (*kotsv1beta1.Installation, error)

func LoadInstallationFromPath

func LoadInstallationFromPath(installationFilePath string) (*kotsv1beta1.Installation, error)

func LoadKotsAppFromContents

func LoadKotsAppFromContents(data []byte) (*kotsv1beta1.Application, error)

func LoadLicenseFromBytes

func LoadLicenseFromBytes(data []byte) (*kotsv1beta1.License, error)

func LoadLicenseFromPath

func LoadLicenseFromPath(licenseFilePath string) (*kotsv1beta1.License, error)

func LoadPreflightFromContents

func LoadPreflightFromContents(content []byte) (*troubleshootv1beta2.Preflight, error)

func LoadSupportBundleFromContents

func LoadSupportBundleFromContents(data []byte) (*troubleshootv1beta2.SupportBundle, error)

func LoadTSKindsFromPath added in v1.101.0

func LoadTSKindsFromPath(dir string) (*troubleshootloader.TroubleshootKinds, error)

func LoadV1Beta1HelmChartFromContents added in v1.99.0

func LoadV1Beta1HelmChartFromContents(content []byte) (*kotsv1beta1.HelmChart, error)

func LoadV1Beta1HelmChartListFromContents added in v1.99.0

func LoadV1Beta1HelmChartListFromContents(data []byte) (*kotsv1beta1.HelmChartList, error)

func LoadV1Beta2HelmChartFromContents added in v1.99.0

func LoadV1Beta2HelmChartFromContents(content []byte) (*kotsv1beta2.HelmChart, error)

func MarshalRuntimeObject added in v1.107.3

func MarshalRuntimeObject(obj runtime.Object) ([]byte, error)

func MergeYAMLNodes added in v1.103.2

func MergeYAMLNodes(targetNodes []*goyaml.Node, overrideNodes []*goyaml.Node) []*goyaml.Node

func MustMarshalInstallation added in v1.100.0

func MustMarshalInstallation(installation *kotsv1beta1.Installation) []byte

func NodeToYAML added in v1.103.2

func NodeToYAML(node *goyaml.Node) ([]byte, error)

func PrintNode added in v1.103.2

func PrintNode(n *goyaml.Node, i int)

func PrintNodes added in v1.103.2

func PrintNodes(nodes []*goyaml.Node, i int)

Handy functions for printing YAML nodes

func RemoveAppVersionLabelFromInstallationParams

func RemoveAppVersionLabelFromInstallationParams(configMapName string) error

func RemoveNilFieldsFromYAML added in v1.98.2

func RemoveNilFieldsFromYAML(input []byte) ([]byte, error)

RemoveNilFieldsFromYAML removes nil fields from a yaml document. This is necessary because kustomize will fail to apply a kustomization if these fields contain nil values: https://github.com/kubernetes-sigs/kustomize/issues/5050

func SaveInstallation added in v1.106.0

func SaveInstallation(installation *kotsv1beta1.Installation, upstreamDir string) error

this is here to avoid a circular dependency

func WriteKotsKinds added in v1.98.0

func WriteKotsKinds(kotsKinds map[string][]byte, rootDir string) error

Types

type InstallationParams

type InstallationParams struct {
	KotsadmRegistry        string
	SkipImagePush          bool
	SkipPreflights         bool
	SkipCompatibilityCheck bool
	RegistryIsReadOnly     bool
	EnableImageDeletion    bool
	EnsureRBAC             bool
	SkipRBACCheck          bool
	UseMinimalRBAC         bool
	StrictSecurityContext  bool
	WaitDuration           time.Duration
	WithMinio              bool
	AppVersionLabel        string
}

func GetInstallationParams

func GetInstallationParams(configMapName string) (InstallationParams, error)

type KotsKinds

type KotsKinds struct {
	KotsApplication   kotsv1beta1.Application
	Application       *applicationv1beta1.Application
	V1Beta1HelmCharts *kotsv1beta1.HelmChartList
	V1Beta2HelmCharts *kotsv1beta2.HelmChartList

	Collector     *troubleshootv1beta2.Collector
	Preflight     *troubleshootv1beta2.Preflight
	Analyzer      *troubleshootv1beta2.Analyzer
	SupportBundle *troubleshootv1beta2.SupportBundle
	Redactor      *troubleshootv1beta2.Redactor
	HostPreflight *troubleshootv1beta2.HostPreflight

	Config       *kotsv1beta1.Config
	ConfigValues *kotsv1beta1.ConfigValues

	Installation kotsv1beta1.Installation
	License      *kotsv1beta1.License

	Identity       *kotsv1beta1.Identity
	IdentityConfig *kotsv1beta1.IdentityConfig

	Backup    *velerov1.Backup
	Installer *kurlv1beta1.Installer

	LintConfig *kotsv1beta1.LintConfig

	EmbeddedClusterConfig *embeddedclusterv1beta1.Config
}

KotsKinds are all of the special "client-side" kinds that are packaged in an application. These should be pointers because they are all optional. But a few are still expected in the code later, so we make them not pointers, because other codepaths expect them to be present

func EmptyKotsKinds

func EmptyKotsKinds() KotsKinds

create a new kots kinds, ensuring that the require objets exist as empty defaults

func KotsKindsFromMap added in v1.98.0

func KotsKindsFromMap(kotsKindsMap map[string][]byte) (*KotsKinds, error)

func LoadKotsKinds added in v1.105.0

func LoadKotsKinds(archive string) (*KotsKinds, error)

LoadKotsKinds loads kots kinds from an app version archive created by kots. it loads the rendered kots kinds if they exist (should always be the case for app version archives created by newer kots versions). otherwise it loads the non-rendered kots kinds (app version archives created by older kots versions).

func LoadKotsKindsWithOpts added in v1.109.5

func LoadKotsKindsWithOpts(archive string, opts LoadKotsKindsOptions) (*KotsKinds, error)

func (*KotsKinds) DecryptConfigValues

func (k *KotsKinds) DecryptConfigValues() error

func (*KotsKinds) EncryptConfigValues

func (k *KotsKinds) EncryptConfigValues() error

func (*KotsKinds) HasPreflights

func (k *KotsKinds) HasPreflights() bool

func (*KotsKinds) IsConfigurable

func (k *KotsKinds) IsConfigurable() bool

func (KotsKinds) Marshal

func (o KotsKinds) Marshal(g string, v string, k string) (string, error)

type LoadKotsKindsOptions added in v1.109.5

type LoadKotsKindsOptions struct {
	Strict bool
}

When strict is true, it returns an error if it fails to load any kotskinds file. When strict is false, kotskinds with errors will be ignored if they cannot be parsed.

type OverlySimpleGVK added in v1.94.1

type OverlySimpleGVK struct {
	APIVersion string               `yaml:"apiVersion"`
	Kind       string               `yaml:"kind"`
	Metadata   OverlySimpleMetadata `yaml:"metadata"`
}

type OverlySimpleMetadata added in v1.94.1

type OverlySimpleMetadata struct {
	Name      string `yaml:"name"`
	Namespace string `yaml:"namespace"`
}

Jump to

Keyboard shortcuts

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