tags

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ResourceLifecycleOwned is the value we use when tagging resources to indicate
	// that the resource is considered owned and managed by the cluster,
	// and in particular that the lifecycle is tied to the lifecycle of the cluster.
	ResourceLifecycleOwned = ResourceLifecycle("owned")

	// ResourceLifecycleShared is the value we use when tagging resources to indicate
	// that the resource is shared between multiple clusters, and should not be destroyed
	// if the cluster is destroyed.
	ResourceLifecycleShared = ResourceLifecycle("shared")

	// NameKubernetesClusterPrefix is the tag name we use to differentiate multiple
	// logically independent clusters running in the same AZ.
	// The tag key = NameKubernetesClusterPrefix + clusterID
	// The tag value is an ownership value
	NameKubernetesClusterPrefix = "kubernetes.io/cluster/"

	// NameAWSProviderPrefix is the tag prefix we use to differentiate
	// cluster-api-provider-aws owned components from other tooling that
	// uses NameKubernetesClusterPrefix
	NameAWSProviderPrefix = "sigs.k8s.io/cluster-api-provider-aws/"

	// NameAWSProviderManaged is the tag name we use to differentiate
	// cluster-api-provider-aws owned components from other tooling that
	// uses NameKubernetesClusterPrefix
	NameAWSProviderManaged = NameAWSProviderPrefix + "managed"

	// NameAWSClusterAPIRole is the tag name we use to mark roles for resources
	// dedicated to this cluster api provider implementation.
	NameAWSClusterAPIRole = NameAWSProviderPrefix + "role"

	// ValueAPIServerRole describes the value for the apiserver role
	ValueAPIServerRole = "apiserver"

	// ValueBastionRole describes the value for the bastion role
	ValueBastionRole = "bastion"

	// ValueCommonRole describes the value for the common role
	ValueCommonRole = "common"

	// ValuePublicRole describes the value for the public role
	ValuePublicRole = "public"

	// ValuePrivateRole describes the value for the private role
	ValuePrivateRole = "private"
)

Variables

This section is empty.

Functions

func Apply

func Apply(params *ApplyParams) error

Apply tags a resource with tags including the cluster tag.

func ClusterKey

func ClusterKey(name string) string

ClusterKey generates the key for resources associated with a cluster.

func Ensure

func Ensure(current Map, params *ApplyParams) error

Ensure applies the tags if the current tags differ from the params.

Types

type ApplyParams

type ApplyParams struct {
	BuildParams
	EC2Client ec2iface.EC2API
}

ApplyParams are function parameters used to apply tags on an aws resource.

type BuildParams

type BuildParams struct {
	// Lifecycle determines the resource lifecycle.
	Lifecycle ResourceLifecycle

	// ClusterName is the cluster associated with the resource.
	ClusterName string

	// ResourceID is the unique identifier of the resource to be tagged.
	ResourceID string

	// Name is the name of the resource, it's applied as the tag "Name" on AWS.
	// +optional
	Name *string

	// Role is the role associated to the resource.
	// +optional
	Role *string

	// Any additional tags to be added to the resource.
	// +optional
	Additional Map
}

BuildParams is used to build tags around an aws resource.

type Map

type Map map[string]string

Map defines a map of tags.

func Build

func Build(params BuildParams) Map

Build builds tags including the cluster tag and returns them in map form.

func (Map) Difference

func (m Map) Difference(other Map) Map

Difference returns the difference between this map and the other map. Items are considered equals if key and value are equals.

func (Map) Equals

func (m Map) Equals(other Map) bool

Equals returns true if the maps are equal.

func (Map) GetRole added in v0.1.1

func (m Map) GetRole() string

GetRole returns the Cluster API role for the tagged resource

func (Map) HasManaged

func (m Map) HasManaged() bool

HasManaged returns true if the map contains NameAWSProviderManaged key set to true.

func (Map) HasOwned

func (m Map) HasOwned(cluster string) bool

HasOwned returns true if the tags contains a tag that marks the resource as owned by the cluster.

type ResourceLifecycle

type ResourceLifecycle string

ResourceLifecycle configures the lifecycle of a resource

Jump to

Keyboard shortcuts

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