flux: github.com/weaveworks/flux/pkg/cluster/kubernetes/resource Index | Files

package resource

import "github.com/weaveworks/flux/pkg/cluster/kubernetes/resource"

Index

Package Files

cronjob.go daemonset.go deployment.go doc.go helmrelease.go list.go load.go namespace.go resource.go spec.go statefulset.go

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>"
)

func FindHelmReleaseContainers Uses

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 Uses

func Load(base string, paths []string, sopsEnabled bool) (map[string]KubeManifest, error)

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 Uses

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.

func PoliciesFromAnnotations Uses

func PoliciesFromAnnotations(annotations map[string]string) policy.Set

type Args Uses

type Args []string

type ContainerImageMap Uses

type ContainerImageMap struct {
    BasePath   string
    Registry   string
    Repository string
    Tag        string
}

ContainerImageMap holds the YAML dot notation paths to a container image.

func (ContainerImageMap) AllDefined Uses

func (c ContainerImageMap) AllDefined() bool

AllDefined returns if all image elements are defined.

func (ContainerImageMap) GetRegistry Uses

func (c ContainerImageMap) GetRegistry() string

GetRegistry returns the full registry path (with base path).

func (ContainerImageMap) GetRepository Uses

func (c ContainerImageMap) GetRepository() string

GetRepository returns the full repository path (with base path).

func (ContainerImageMap) GetTag Uses

func (c ContainerImageMap) GetTag() string

GetTag returns the full tag path (with base path).

func (ContainerImageMap) MapImageRef Uses

func (c ContainerImageMap) MapImageRef(image image.Ref) (map[string]string, bool)

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 Uses

func (c ContainerImageMap) RegistryRepository() bool

RegistryRepository returns if the registry and repository are defined, but the tag is not.

func (ContainerImageMap) RepositoryOnly Uses

func (c ContainerImageMap) RepositoryOnly() bool

RepositoryOnly returns if only the repository is defined.

func (ContainerImageMap) RepositoryTag Uses

func (c ContainerImageMap) RepositoryTag() bool

RegistryRepository returns if the repository and tag are defined, but the registry is not.

type ContainerPort Uses

type ContainerPort struct {
    ContainerPort int
    Name          string
}

type ContainerSpec Uses

type ContainerSpec struct {
    Name  string
    Image string
    Args  Args
    Ports []ContainerPort
    Env   Env
}

type CronJob Uses

type CronJob struct {
    Spec CronJobSpec
    // contains filtered or unexported fields
}

func (CronJob) Bytes Uses

func (o CronJob) Bytes() []byte

func (CronJob) Containers Uses

func (c CronJob) Containers() []resource.Container

func (CronJob) GetKind Uses

func (o CronJob) GetKind() string

GetKind implements KubeManifest.GetKind

func (CronJob) GetName Uses

func (o CronJob) GetName() string

GetName implements KubeManifest.GetName

func (CronJob) GetNamespace Uses

func (o CronJob) GetNamespace() string

GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest

func (CronJob) GroupVersion Uses

func (o CronJob) GroupVersion() string

GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest

func (CronJob) Policies Uses

func (o CronJob) Policies() policy.Set

func (CronJob) PolicyAnnotationKey Uses

func (o CronJob) PolicyAnnotationKey(p string) (string, bool)

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 Uses

func (o CronJob) ResourceID() resource.ID

func (CronJob) SetContainerImage Uses

func (c CronJob) SetContainerImage(container string, ref image.Ref) error

func (*CronJob) SetNamespace Uses

func (o *CronJob) SetNamespace(ns string)

SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.

func (CronJob) Source Uses

func (o CronJob) Source() string

type CronJobSpec Uses

type CronJobSpec struct {
    JobTemplate struct {
        Spec struct {
            Template PodTemplate
        }
    } `yaml:"jobTemplate"`
}

type DaemonSet Uses

type DaemonSet struct {
    Spec struct {
        Template PodTemplate
    }
    // contains filtered or unexported fields
}

func (DaemonSet) Bytes Uses

func (o DaemonSet) Bytes() []byte

func (DaemonSet) Containers Uses

func (ds DaemonSet) Containers() []resource.Container

func (DaemonSet) GetKind Uses

func (o DaemonSet) GetKind() string

GetKind implements KubeManifest.GetKind

func (DaemonSet) GetName Uses

func (o DaemonSet) GetName() string

GetName implements KubeManifest.GetName

func (DaemonSet) GetNamespace Uses

func (o DaemonSet) GetNamespace() string

GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest

func (DaemonSet) GroupVersion Uses

func (o DaemonSet) GroupVersion() string

GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest

func (DaemonSet) Policies Uses

func (o DaemonSet) Policies() policy.Set

func (DaemonSet) PolicyAnnotationKey Uses

func (o DaemonSet) PolicyAnnotationKey(p string) (string, bool)

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 Uses

func (o DaemonSet) ResourceID() resource.ID

func (DaemonSet) SetContainerImage Uses

func (ds DaemonSet) SetContainerImage(container string, ref image.Ref) error

func (*DaemonSet) SetNamespace Uses

func (o *DaemonSet) SetNamespace(ns string)

SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.

func (DaemonSet) Source Uses

func (o DaemonSet) Source() string

type Deployment Uses

type Deployment struct {
    Spec DeploymentSpec
    // contains filtered or unexported fields
}

func (Deployment) Bytes Uses

func (o Deployment) Bytes() []byte

func (Deployment) Containers Uses

func (d Deployment) Containers() []resource.Container

func (Deployment) GetKind Uses

func (o Deployment) GetKind() string

GetKind implements KubeManifest.GetKind

func (Deployment) GetName Uses

func (o Deployment) GetName() string

GetName implements KubeManifest.GetName

func (Deployment) GetNamespace Uses

func (o Deployment) GetNamespace() string

GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest

func (Deployment) GroupVersion Uses

func (o Deployment) GroupVersion() string

GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest

func (Deployment) Policies Uses

func (o Deployment) Policies() policy.Set

func (Deployment) PolicyAnnotationKey Uses

func (o Deployment) PolicyAnnotationKey(p string) (string, bool)

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 Uses

func (o Deployment) ResourceID() resource.ID

func (Deployment) SetContainerImage Uses

func (d Deployment) SetContainerImage(container string, ref image.Ref) error

func (*Deployment) SetNamespace Uses

func (o *Deployment) SetNamespace(ns string)

SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.

func (Deployment) Source Uses

func (o Deployment) Source() string

type DeploymentSpec Uses

type DeploymentSpec struct {
    Replicas int
    Template PodTemplate
}

type Env Uses

type Env []EnvEntry

Env is a bag of Name, Value pairs that are treated somewhat like a map.

type EnvEntry Uses

type EnvEntry struct {
    Name, Value string
}

type HelmRelease Uses

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) Bytes Uses

func (o HelmRelease) Bytes() []byte

func (HelmRelease) Containers Uses

func (hr HelmRelease) Containers() []resource.Container

Containers returns the containers that are defined in the HelmRelease.

func (HelmRelease) GetContainerImageMap Uses

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 Uses

func (o HelmRelease) GetKind() string

GetKind implements KubeManifest.GetKind

func (HelmRelease) GetName Uses

func (o HelmRelease) GetName() string

GetName implements KubeManifest.GetName

func (HelmRelease) GetNamespace Uses

func (o HelmRelease) GetNamespace() string

GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest

func (HelmRelease) GroupVersion Uses

func (o HelmRelease) GroupVersion() string

GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest

func (HelmRelease) Policies Uses

func (o HelmRelease) Policies() policy.Set

func (HelmRelease) PolicyAnnotationKey Uses

func (o HelmRelease) PolicyAnnotationKey(p string) (string, bool)

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 Uses

func (o HelmRelease) ResourceID() resource.ID

func (HelmRelease) SetContainerImage Uses

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 Uses

func (o *HelmRelease) SetNamespace(ns string)

SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.

func (HelmRelease) Source Uses

func (o HelmRelease) Source() string

type ImageSetter Uses

type ImageSetter func(image.Ref)

type KubeManifest Uses

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 Uses

type List struct {
    Items []KubeManifest
    // contains filtered or unexported fields
}

func (List) Bytes Uses

func (o List) Bytes() []byte

func (List) GetKind Uses

func (o List) GetKind() string

GetKind implements KubeManifest.GetKind

func (List) GetName Uses

func (o List) GetName() string

GetName implements KubeManifest.GetName

func (List) GetNamespace Uses

func (o List) GetNamespace() string

GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest

func (List) GroupVersion Uses

func (o List) GroupVersion() string

GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest

func (List) Policies Uses

func (o List) Policies() policy.Set

func (List) PolicyAnnotationKey Uses

func (o List) PolicyAnnotationKey(p string) (string, bool)

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 Uses

func (o List) ResourceID() resource.ID

func (*List) SetNamespace Uses

func (o *List) SetNamespace(ns string)

SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.

func (List) Source Uses

func (o List) Source() string

type Namespace Uses

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

func (Namespace) Bytes Uses

func (o Namespace) Bytes() []byte

func (Namespace) GetKind Uses

func (o Namespace) GetKind() string

GetKind implements KubeManifest.GetKind

func (Namespace) GetName Uses

func (o Namespace) GetName() string

GetName implements KubeManifest.GetName

func (Namespace) GetNamespace Uses

func (o Namespace) GetNamespace() string

GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest

func (Namespace) GroupVersion Uses

func (o Namespace) GroupVersion() string

GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest

func (Namespace) Policies Uses

func (o Namespace) Policies() policy.Set

func (Namespace) PolicyAnnotationKey Uses

func (o Namespace) PolicyAnnotationKey(p string) (string, bool)

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 Uses

func (o Namespace) ResourceID() resource.ID

func (*Namespace) SetNamespace Uses

func (o *Namespace) SetNamespace(ns string)

SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.

func (Namespace) Source Uses

func (o Namespace) Source() string

type ObjectMeta Uses

type ObjectMeta struct {
    Labels      map[string]string
    Annotations map[string]string
}

type PodSpec Uses

type PodSpec struct {
    ImagePullSecrets []struct{ Name string }
    Volumes          []Volume
    Containers       []ContainerSpec
    InitContainers   []ContainerSpec `yaml:"initContainers"`
}

type PodTemplate Uses

type PodTemplate struct {
    Metadata ObjectMeta
    Spec     PodSpec
}

func (PodTemplate) Containers Uses

func (t PodTemplate) Containers() []resource.Container

func (PodTemplate) SetContainerImage Uses

func (t PodTemplate) SetContainerImage(container string, ref image.Ref) error

type StatefulSet Uses

type StatefulSet struct {
    Spec StatefulSetSpec
    // contains filtered or unexported fields
}

func (StatefulSet) Bytes Uses

func (o StatefulSet) Bytes() []byte

func (StatefulSet) Containers Uses

func (ss StatefulSet) Containers() []resource.Container

func (StatefulSet) GetKind Uses

func (o StatefulSet) GetKind() string

GetKind implements KubeManifest.GetKind

func (StatefulSet) GetName Uses

func (o StatefulSet) GetName() string

GetName implements KubeManifest.GetName

func (StatefulSet) GetNamespace Uses

func (o StatefulSet) GetNamespace() string

GetNamespace implements KubeManifest.GetNamespace, so things embedding baseObject are < KubeManifest

func (StatefulSet) GroupVersion Uses

func (o StatefulSet) GroupVersion() string

GroupVersion implements KubeManifest.GroupVersion, so things with baseObject embedded are < KubeManifest

func (StatefulSet) Policies Uses

func (o StatefulSet) Policies() policy.Set

func (StatefulSet) PolicyAnnotationKey Uses

func (o StatefulSet) PolicyAnnotationKey(p string) (string, bool)

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 Uses

func (o StatefulSet) ResourceID() resource.ID

func (StatefulSet) SetContainerImage Uses

func (ss StatefulSet) SetContainerImage(container string, ref image.Ref) error

func (*StatefulSet) SetNamespace Uses

func (o *StatefulSet) SetNamespace(ns string)

SetNamespace implements KubeManifest.SetNamespace, so things with *baseObject embedded are < KubeManifest. NB pointer receiver.

func (StatefulSet) Source Uses

func (o StatefulSet) Source() string

type StatefulSetSpec Uses

type StatefulSetSpec struct {
    Replicas int
    Template PodTemplate
}

type Volume Uses

type Volume struct {
    Name   string
    Secret struct {
        SecretName string
    }
}

type VolumeMount Uses

type VolumeMount struct {
    Name      string
    MountPath string
    ReadOnly  bool
}

Package resource imports 18 packages (graph). Updated 2020-10-19. Refresh now. Tools for package owners.