Documentation ¶
Index ¶
- Constants
- func FindHelmReleaseContainers(annotations map[string]string, values map[string]interface{}, ...)
- func Load(base string, paths []string, sopsEnabled bool) (map[string]KubeManifest, error)
- func ParseMultidoc(multidoc []byte, source string) (map[string]KubeManifest, error)
- func PoliciesFromAnnotations(annotations map[string]string) policy.Set
- type Args
- type ContainerImageMap
- func (c ContainerImageMap) AllDefined() bool
- func (c ContainerImageMap) GetRegistry() string
- func (c ContainerImageMap) GetRepository() string
- func (c ContainerImageMap) GetTag() string
- func (c ContainerImageMap) MapImageRef(image image.Ref) (map[string]string, bool)
- func (c ContainerImageMap) RegistryRepository() bool
- func (c ContainerImageMap) RepositoryOnly() bool
- func (c ContainerImageMap) RepositoryTag() bool
- type ContainerPort
- type ContainerSpec
- type CronJob
- func (o CronJob) Bytes() []byte
- func (c CronJob) Containers() []resource.Container
- func (o CronJob) GetKind() string
- func (o CronJob) GetName() string
- func (o CronJob) GetNamespace() string
- func (o CronJob) GroupVersion() string
- func (o CronJob) Policies() policy.Set
- func (o CronJob) PolicyAnnotationKey(p string) (string, bool)
- func (o CronJob) ResourceID() resource.ID
- func (c CronJob) SetContainerImage(container string, ref image.Ref) error
- func (o *CronJob) SetNamespace(ns string)
- func (o CronJob) Source() string
- type CronJobSpec
- type DaemonSet
- func (o DaemonSet) Bytes() []byte
- func (ds DaemonSet) Containers() []resource.Container
- func (o DaemonSet) GetKind() string
- func (o DaemonSet) GetName() string
- func (o DaemonSet) GetNamespace() string
- func (o DaemonSet) GroupVersion() string
- func (o DaemonSet) Policies() policy.Set
- func (o DaemonSet) PolicyAnnotationKey(p string) (string, bool)
- func (o DaemonSet) ResourceID() resource.ID
- func (ds DaemonSet) SetContainerImage(container string, ref image.Ref) error
- func (o *DaemonSet) SetNamespace(ns string)
- func (o DaemonSet) Source() string
- type Deployment
- func (o Deployment) Bytes() []byte
- func (d Deployment) Containers() []resource.Container
- func (o Deployment) GetKind() string
- func (o Deployment) GetName() string
- func (o Deployment) GetNamespace() string
- func (o Deployment) GroupVersion() string
- func (o Deployment) Policies() policy.Set
- func (o Deployment) PolicyAnnotationKey(p string) (string, bool)
- func (o Deployment) ResourceID() resource.ID
- func (d Deployment) SetContainerImage(container string, ref image.Ref) error
- func (o *Deployment) SetNamespace(ns string)
- func (o Deployment) Source() string
- type DeploymentSpec
- type Env
- type EnvEntry
- type HelmRelease
- func (o HelmRelease) Bytes() []byte
- func (hr HelmRelease) Containers() []resource.Container
- func (hr HelmRelease) GetContainerImageMap(container string) (ContainerImageMap, error)
- func (o HelmRelease) GetKind() string
- func (o HelmRelease) GetName() string
- func (o HelmRelease) GetNamespace() string
- func (o HelmRelease) GroupVersion() string
- func (o HelmRelease) Policies() policy.Set
- func (o HelmRelease) PolicyAnnotationKey(p string) (string, bool)
- func (o HelmRelease) ResourceID() resource.ID
- func (hr HelmRelease) SetContainerImage(container string, ref image.Ref) error
- func (o *HelmRelease) SetNamespace(ns string)
- func (o HelmRelease) Source() string
- type ImageSetter
- type KubeManifest
- type List
- func (o List) Bytes() []byte
- func (o List) GetKind() string
- func (o List) GetName() string
- func (o List) GetNamespace() string
- func (o List) GroupVersion() string
- func (o List) Policies() policy.Set
- func (o List) PolicyAnnotationKey(p string) (string, bool)
- func (o List) ResourceID() resource.ID
- func (o *List) SetNamespace(ns string)
- func (o List) Source() string
- type Namespace
- func (o Namespace) Bytes() []byte
- func (o Namespace) GetKind() string
- func (o Namespace) GetName() string
- func (o Namespace) GetNamespace() string
- func (o Namespace) GroupVersion() string
- func (o Namespace) Policies() policy.Set
- func (o Namespace) PolicyAnnotationKey(p string) (string, bool)
- func (o Namespace) ResourceID() resource.ID
- func (o *Namespace) SetNamespace(ns string)
- func (o Namespace) Source() string
- type ObjectMeta
- type PodSpec
- type PodTemplate
- type StatefulSet
- func (o StatefulSet) Bytes() []byte
- func (ss StatefulSet) Containers() []resource.Container
- func (o StatefulSet) GetKind() string
- func (o StatefulSet) GetName() string
- func (o StatefulSet) GetNamespace() string
- func (o StatefulSet) GroupVersion() string
- func (o StatefulSet) Policies() policy.Set
- func (o StatefulSet) PolicyAnnotationKey(p string) (string, bool)
- func (o StatefulSet) ResourceID() resource.ID
- func (ss StatefulSet) SetContainerImage(container string, ref image.Ref) error
- func (o *StatefulSet) SetNamespace(ns string)
- func (o StatefulSet) Source() string
- type StatefulSetSpec
- type Volume
- type VolumeMount
Constants ¶
const ( // ReleaseContainerName is the name used when Flux interprets a // HelmRelease as having a container with an image, by virtue of // having a `values` stanza with an image field: // // spec: // ... // values: // image: some/image:version // // The name refers to the source of the image value. ReleaseContainerName = "chart-image" // ImageBasePath is the default base path for image path mappings // in a HelmRelease resource. ImageBasePath = "spec.values." // ImageRegistryPrefix is the annotation key prefix for image // registry path mappings. ImageRegistryPrefix = "registry.fluxcd.io/" // ImageRepositoryPrefix is the annotation key prefix for image // repository path mappings. ImageRepositoryPrefix = "repository.fluxcd.io/" // ImageRepositoryPrefix is the annotation key prefix for image // tag path mappings. ImageTagPrefix = "tag.fluxcd.io/" )
const ( PolicyPrefix = "fluxcd.io/" FilterPolicyPrefix = "filter.fluxcd.io/" // This is the previously-used prefix for annotations; many // manifests in the wild will still be using it, so it's included // here for backward-compatibility. AlternatePolicyPrefix = "flux.weave.works/" ClusterScope = "<cluster>" )
Variables ¶
This section is empty.
Functions ¶
func FindHelmReleaseContainers ¶
func FindHelmReleaseContainers(annotations map[string]string, values map[string]interface{}, visit func(string, image.Ref, ImageSetter) error)
FindHelmReleaseContainers examines the Values from a HelmRelease (manifest, or cluster resource, or otherwise) and calls visit with each container name and image it finds, as well as procedure for changing the image value.
func Load ¶
Load takes paths to directories or files, and creates an object set based on the file(s) therein. Resources are named according to the file content, rather than the file name of directory structure. if sopsEnabled is set to true, sops-encrypted files will be decrypted.
func ParseMultidoc ¶
func ParseMultidoc(multidoc []byte, source string) (map[string]KubeManifest, error)
ParseMultidoc takes a dump of config (a multidoc YAML) and constructs an object set from the resources represented therein.
Types ¶
type ContainerImageMap ¶
ContainerImageMap holds the YAML dot notation paths to a container image.
func (ContainerImageMap) AllDefined ¶
func (c ContainerImageMap) AllDefined() bool
AllDefined returns if all image elements are defined.
func (ContainerImageMap) GetRegistry ¶
func (c ContainerImageMap) GetRegistry() string
GetRegistry returns the full registry path (with base path).
func (ContainerImageMap) GetRepository ¶
func (c ContainerImageMap) GetRepository() string
GetRepository returns the full repository path (with base path).
func (ContainerImageMap) GetTag ¶
func (c ContainerImageMap) GetTag() string
GetTag returns the full tag path (with base path).
func (ContainerImageMap) MapImageRef ¶
MapImageRef maps the given imageRef to the dot notation paths ContainerImageMap holds. It needs at least an Repository to be able to compose the map, and takes the absence of the registry and/or tag paths into account to ensure all image elements (registry, repository, tag) are present in the returned map.
func (ContainerImageMap) RegistryRepository ¶
func (c ContainerImageMap) RegistryRepository() bool
RegistryRepository returns if the registry and repository are defined, but the tag is not.
func (ContainerImageMap) RepositoryOnly ¶
func (c ContainerImageMap) RepositoryOnly() bool
RepositoryOnly returns if only the repository is defined.
func (ContainerImageMap) RepositoryTag ¶
func (c ContainerImageMap) RepositoryTag() bool
RegistryRepository returns if the repository and tag are defined, but the registry is not.
type ContainerPort ¶
type ContainerSpec ¶
type ContainerSpec struct { Name string Image string Args Args Ports []ContainerPort Env Env }
type CronJob ¶
type CronJob struct { Spec CronJobSpec // contains filtered or unexported fields }
func (CronJob) Containers ¶
func (CronJob) GetNamespace ¶
func (o CronJob) GetNamespace() string
GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest
func (CronJob) GroupVersion ¶
func (o CronJob) GroupVersion() string
GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest
func (CronJob) PolicyAnnotationKey ¶
PolicyAnnotationKey returns the key used in this resource to indicate a particular policy; this is to aid in supporting more than one way of using annotations for policy. If the policy is not present, returns `"", false`.
func (CronJob) ResourceID ¶
func (CronJob) SetContainerImage ¶
func (*CronJob) SetNamespace ¶
func (o *CronJob) SetNamespace(ns string)
SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.
type CronJobSpec ¶
type CronJobSpec struct { JobTemplate struct { Spec struct { Template PodTemplate } } `yaml:"jobTemplate"` }
type DaemonSet ¶
type DaemonSet struct { Spec struct { Template PodTemplate } // contains filtered or unexported fields }
func (DaemonSet) Containers ¶
func (DaemonSet) GetKind ¶
func (o DaemonSet) GetKind() string
GetKind implements KubeManifest.GetKind
func (DaemonSet) GetName ¶
func (o DaemonSet) GetName() string
GetName implements KubeManifest.GetName
func (DaemonSet) GetNamespace ¶
func (o DaemonSet) GetNamespace() string
GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest
func (DaemonSet) GroupVersion ¶
func (o DaemonSet) GroupVersion() string
GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest
func (DaemonSet) PolicyAnnotationKey ¶
PolicyAnnotationKey returns the key used in this resource to indicate a particular policy; this is to aid in supporting more than one way of using annotations for policy. If the policy is not present, returns `"", false`.
func (DaemonSet) ResourceID ¶
func (DaemonSet) SetContainerImage ¶
func (*DaemonSet) SetNamespace ¶
func (o *DaemonSet) SetNamespace(ns string)
SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.
type Deployment ¶
type Deployment struct { Spec DeploymentSpec // contains filtered or unexported fields }
func (Deployment) Containers ¶
func (d Deployment) Containers() []resource.Container
func (Deployment) GetKind ¶
func (o Deployment) GetKind() string
GetKind implements KubeManifest.GetKind
func (Deployment) GetName ¶
func (o Deployment) GetName() string
GetName implements KubeManifest.GetName
func (Deployment) GetNamespace ¶
func (o Deployment) GetNamespace() string
GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest
func (Deployment) GroupVersion ¶
func (o Deployment) GroupVersion() string
GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest
func (Deployment) PolicyAnnotationKey ¶
PolicyAnnotationKey returns the key used in this resource to indicate a particular policy; this is to aid in supporting more than one way of using annotations for policy. If the policy is not present, returns `"", false`.
func (Deployment) ResourceID ¶
func (Deployment) SetContainerImage ¶
func (d Deployment) SetContainerImage(container string, ref image.Ref) error
func (*Deployment) SetNamespace ¶
func (o *Deployment) SetNamespace(ns string)
SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.
type DeploymentSpec ¶
type DeploymentSpec struct { Replicas int Template PodTemplate }
type Env ¶
type Env []EnvEntry
Env is a bag of Name, Value pairs that are treated somewhat like a map.
type HelmRelease ¶
type HelmRelease struct { Spec struct { Values map[string]interface{} } // contains filtered or unexported fields }
HelmRelease echoes the generated type for the custom resource definition. It's here so we can 1. get `baseObject` in there, and 3. control the YAML serialisation of fields, which we can't do (easily?) with the generated type.
func (HelmRelease) Containers ¶
func (hr HelmRelease) Containers() []resource.Container
Containers returns the containers that are defined in the HelmRelease.
func (HelmRelease) GetContainerImageMap ¶
func (hr HelmRelease) GetContainerImageMap(container string) (ContainerImageMap, error)
GetContainerImageMap returns the ContainerImageMap for a container, or an error if we were unable to interpret the mapping, or no mapping was found.
func (HelmRelease) GetKind ¶
func (o HelmRelease) GetKind() string
GetKind implements KubeManifest.GetKind
func (HelmRelease) GetName ¶
func (o HelmRelease) GetName() string
GetName implements KubeManifest.GetName
func (HelmRelease) GetNamespace ¶
func (o HelmRelease) GetNamespace() string
GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest
func (HelmRelease) GroupVersion ¶
func (o HelmRelease) GroupVersion() string
GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest
func (HelmRelease) PolicyAnnotationKey ¶
PolicyAnnotationKey returns the key used in this resource to indicate a particular policy; this is to aid in supporting more than one way of using annotations for policy. If the policy is not present, returns `"", false`.
func (HelmRelease) ResourceID ¶
func (HelmRelease) SetContainerImage ¶
func (hr HelmRelease) SetContainerImage(container string, ref image.Ref) error
SetContainerImage mutates this resource by setting the `image` field of `values`, or a subvalue therein, per one of the interpretations in `FindHelmReleaseContainers` above. NB we can get away with a value-typed receiver because we set a map entry.
func (*HelmRelease) SetNamespace ¶
func (o *HelmRelease) SetNamespace(ns string)
SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.
type ImageSetter ¶
type KubeManifest ¶
type KubeManifest interface { resource.Resource GroupVersion() string GetKind() string GetName() string GetNamespace() string SetNamespace(string) PolicyAnnotationKey(string) (string, bool) }
KubeManifest represents a manifest for a Kubernetes resource. For some Kubernetes-specific purposes we need more information that can be obtained from `resource.Resource`.
type List ¶
type List struct { Items []KubeManifest // contains filtered or unexported fields }
func (List) GetNamespace ¶
func (o List) GetNamespace() string
GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest
func (List) GroupVersion ¶
func (o List) GroupVersion() string
GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest
func (List) PolicyAnnotationKey ¶
PolicyAnnotationKey returns the key used in this resource to indicate a particular policy; this is to aid in supporting more than one way of using annotations for policy. If the policy is not present, returns `"", false`.
func (List) ResourceID ¶
func (*List) SetNamespace ¶
func (o *List) SetNamespace(ns string)
SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
func (Namespace) GetKind ¶
func (o Namespace) GetKind() string
GetKind implements KubeManifest.GetKind
func (Namespace) GetName ¶
func (o Namespace) GetName() string
GetName implements KubeManifest.GetName
func (Namespace) GetNamespace ¶
func (o Namespace) GetNamespace() string
GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest
func (Namespace) GroupVersion ¶
func (o Namespace) GroupVersion() string
GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest
func (Namespace) PolicyAnnotationKey ¶
PolicyAnnotationKey returns the key used in this resource to indicate a particular policy; this is to aid in supporting more than one way of using annotations for policy. If the policy is not present, returns `"", false`.
func (Namespace) ResourceID ¶
func (*Namespace) SetNamespace ¶
func (o *Namespace) SetNamespace(ns string)
SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.
type PodSpec ¶
type PodSpec struct { ImagePullSecrets []struct{ Name string } Volumes []Volume Containers []ContainerSpec InitContainers []ContainerSpec `yaml:"initContainers"` }
type PodTemplate ¶
type PodTemplate struct { Metadata ObjectMeta Spec PodSpec }
func (PodTemplate) Containers ¶
func (t PodTemplate) Containers() []resource.Container
func (PodTemplate) SetContainerImage ¶
func (t PodTemplate) SetContainerImage(container string, ref image.Ref) error
type StatefulSet ¶
type StatefulSet struct { Spec StatefulSetSpec // contains filtered or unexported fields }
func (StatefulSet) Containers ¶
func (ss StatefulSet) Containers() []resource.Container
func (StatefulSet) GetKind ¶
func (o StatefulSet) GetKind() string
GetKind implements KubeManifest.GetKind
func (StatefulSet) GetName ¶
func (o StatefulSet) GetName() string
GetName implements KubeManifest.GetName
func (StatefulSet) GetNamespace ¶
func (o StatefulSet) GetNamespace() string
GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest
func (StatefulSet) GroupVersion ¶
func (o StatefulSet) GroupVersion() string
GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest
func (StatefulSet) PolicyAnnotationKey ¶
PolicyAnnotationKey returns the key used in this resource to indicate a particular policy; this is to aid in supporting more than one way of using annotations for policy. If the policy is not present, returns `"", false`.
func (StatefulSet) ResourceID ¶
func (StatefulSet) SetContainerImage ¶
func (ss StatefulSet) SetContainerImage(container string, ref image.Ref) error
func (*StatefulSet) SetNamespace ¶
func (o *StatefulSet) SetNamespace(ns string)
SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.
type StatefulSetSpec ¶
type StatefulSetSpec struct { Replicas int Template PodTemplate }