crdutils

package
v0.40.6 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 5

Documentation

Index

Constants

View Source
const (
	CRDVersionKey  = "crd.solo.io/version"
	CRDSpecHashKey = "crd.solo.io/specHash"
	CRDMetadataKey = "crd.solo.io/crdMetadata"
)

Chart provides the input data structure for generating Helm charts from the skv2 chart "meta-templates" (templates whose outputs are templates and other files used by generated Helm charts)

Variables

This section is empty.

Functions

func DoesCrdNeedUpgrade

func DoesCrdNeedUpgrade(newProductVersion, newCrdHash string, deployedCrdAnnotations map[string]string) (bool, error)

*

  • The idea behind this function is that we only want to ugprade a CRD if the version of the new CRD
  • is higher than version of the CRD in the cluser **and** the specHash is different.
  • The reasoning:
  • if the spec hash is the same, then the CRD's json schema is the same, and it is pointless to upgrade it.
  • if the spec hash is different, then we want to make sure we only update a CRD when it is backwards compatible.
  • under the assumption that we don't make backwards incompatible changes, then this means that we
  • should only upgrade a CRD if it's version is higher than what's deployed on the cluster.

Types

type CRDAnnotations

type CRDAnnotations struct {
	Name string `json:"name"`
	Hash string `json:"hash"`
}

type CRDMetadata

type CRDMetadata struct {
	CRDS    []CRDAnnotations `json:"crds"`
	Version string           `json:"version"`
}

func ParseCRDMetadataFromAnnotations

func ParseCRDMetadataFromAnnotations(annotations map[string]string) (*CRDMetadata, error)

type CrdNeedsUpgrade

type CrdNeedsUpgrade struct {
	CRDName string
}

func (*CrdNeedsUpgrade) Error

func (e *CrdNeedsUpgrade) Error() string

type CrdNotFound

type CrdNotFound struct {
	CRDName string
}

func (*CrdNotFound) Error

func (e *CrdNotFound) Error() string

type ErrMap

type ErrMap map[string]error

func DoCrdsNeedUpgrade

func DoCrdsNeedUpgrade(newProdCrdInfo CRDMetadata, deployedInClusterCrds []apiextv1.CustomResourceDefinition) ErrMap

Jump to

Keyboard shortcuts

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