Documentation ¶
Index ¶
- Variables
- func AnnotationCharmModifiedVersionKey(legacy bool) string
- func AnnotationControllerIsControllerKey(legacy bool) string
- func AnnotationControllerUUIDKey(legacy bool) string
- func AnnotationDisableNameKey(legacy bool) string
- func AnnotationJujuStorageKey(legacy bool) string
- func AnnotationKeyApplicationUUID(legacy bool) string
- func AnnotationModelUUIDKey(legacy bool) string
- func AnnotationUnitKey(legacy bool) string
- func AnnotationVersionKey(legacy bool) string
- func AnnotationsForStorage(name string, legacy bool) annotations.Annotation
- func AnnotationsForVersion(vers string, legacy bool) annotations.Annotation
- func CreateDockerConfigJSON(username, password, imagePath string) ([]byte, error)
- func ExtractRegistryURL(imagePath string) (string, error)
- func GetSvcAddresses(svc *core.Service, includeClusterIP bool) []network.ProviderAddress
- func HasLabels(src, has labels.Set) bool
- func IntPtr(i int) *int
- func IsLegacyModelLabels(ctx context.Context, namespace, model string, ...) (bool, error)
- func LabelForKeyValue(key, value string) labels.Set
- func LabelsForApp(name string, legacy bool) labels.Set
- func LabelsForModel(name string, legacy bool) labels.Set
- func LabelsForOperator(name, target string, legacy bool) labels.Set
- func LabelsForStorage(name string, legacy bool) labels.Set
- func LabelsMerge(a labels.Set, merges ...labels.Set) labels.Set
- func LabelsToSelector(ls labels.Set) labels.Selector
- func MakeK8sDomain(components ...string) string
- func NewPreconditionDeleteOptions(uid k8stypes.UID) metav1.DeleteOptions
- func NewUIDPreconditions(uid k8stypes.UID) *metav1.Preconditions
- func PurifyResource(resource interface{ ... })
- func RandomPrefix() (string, error)
- func ResourceTagsToAnnotations(in map[string]string, legacy bool) annotations.Annotation
- func RunCleanUps(cleanUps []func())
- func SelectorLabelsForApp(name string, legacy bool) labels.Set
- func StorageNameFromLabels(labels labels.Set) string
- type AnnotationKeySupplier
- type DockerConfig
- type DockerConfigEntry
- type DockerConfigJSON
- type RandomPrefixFunc
Constants ¶
This section is empty.
Variables ¶
var ( // LabelsJuju is a common set LabelsJuju = map[string]string{ constants.LabelKubernetesAppManaged: "juju", } // LabelsJujuModelOperatorDisableWebhook is a set of labels needed on a // given object to disable admission webhook validation. LabelsJujuModelOperatorDisableWebhook = map[string]string{ constants.LabelJujuModelOperatorDisableWebhook: "true", } )
Functions ¶
func AnnotationCharmModifiedVersionKey ¶
AnnotationCharmModifiedVersionKey returns the key used in annotations to describe the charm modified version.
func AnnotationControllerIsControllerKey ¶
AnnotationControllerIsControllerKey returns the key used in annotations to describe if this pod is a controller pod.
func AnnotationControllerUUIDKey ¶
AnnotationControllerUUIDKey returns the key used in annotations to describe the controller UUID.
func AnnotationDisableNameKey ¶
AnnotationDisableNameKey returns the key used in annotations to describe the disabled name prefix.
func AnnotationJujuStorageKey ¶
AnnotationJujuStorageKey returns the key used in annotations to describe the storage UUID.
func AnnotationKeyApplicationUUID ¶
AnnotationKeyApplicationUUID is the key of annotation for recording pvc unique ID.
func AnnotationModelUUIDKey ¶
AnnotationModelUUIDKey returns the key used in annotations to describe the model UUID.
func AnnotationUnitKey ¶
AnnotationUnitKey returns the key used in annotations to describe the Juju unit.
func AnnotationVersionKey ¶
AnnotationVersionKey returns the key used in annotations to describe the Juju version. Legacy controls if the key returns is a legacy annotation key or newer style.
func AnnotationsForStorage ¶
func AnnotationsForStorage(name string, legacy bool) annotations.Annotation
AnnotationsForStorage provides the annotations that should be placed on a storage object. The annotations returned by this function are storage specific only and should be combined with other annotations where appropriate.
func AnnotationsForVersion ¶
func AnnotationsForVersion(vers string, legacy bool) annotations.Annotation
AnnotationsForVersion provides the annotations that should be placed on an object that requires juju version information. The annotations returned by this function are version specific and may need to be combined with other annotations for a complete set.
func CreateDockerConfigJSON ¶
func ExtractRegistryURL ¶
ExtractRegistryName returns the registry URL part of an images path
func GetSvcAddresses ¶
func GetSvcAddresses(svc *core.Service, includeClusterIP bool) []network.ProviderAddress
GetSvcAddresses returns the network addresses for the given service.
func IsLegacyModelLabels ¶
func IsLegacyModelLabels(ctx context.Context, namespace, model string, namespaceI core.NamespaceInterface) (bool, error)
IsLegacyModelLabels checks to see if the provided model is running on an older labeling scheme or a newer one.
func LabelForKeyValue ¶
LabelForKeyValue returns a Kubernetes label set for the supplied key value.
func LabelsForApp ¶
LabelsForApp returns the labels that should be on a k8s object for a given application name
func LabelsForModel ¶
LabelsForModel returns the labels that should be on a k8s object for a given model name
func LabelsForOperator ¶
LabelsForOperator returns the labels that should be placed on a juju operator Takes the operator name, type and a legacy flag to indicate these labels are being used on a model that is operating in "legacy" label mode
func LabelsForStorage ¶
LabelsForStorage return the labels that should be placed on a k8s storage object. Takes the storage name and a legacy flat.
func LabelsMerge ¶
LabelsMerge merges one or more sets of labels together into a new set. For duplicate keys the last key found is used.
func LabelsToSelector ¶
LabelsToSelector transforms the supplied label set to a valid Kubernetes label selector
func MakeK8sDomain ¶
MakeK8sDomain builds and returns a Kubernetes resource domain for the provided components. Func is idempotent
func NewPreconditionDeleteOptions ¶
func NewPreconditionDeleteOptions(uid k8stypes.UID) metav1.DeleteOptions
func NewUIDPreconditions ¶
func NewUIDPreconditions(uid k8stypes.UID) *metav1.Preconditions
func PurifyResource ¶
func PurifyResource(resource interface{ SetResourceVersion(string) })
PurifyResource purifies read only fields before creating/updating the resource.
func RandomPrefix ¶
RandomPrefix returns a random string for storage related annotations.
func ResourceTagsToAnnotations ¶
func ResourceTagsToAnnotations(in map[string]string, legacy bool) annotations.Annotation
ResourceTagsToAnnotations creates annotations from the resource tags.
func RunCleanUps ¶
func RunCleanUps(cleanUps []func())
RunCleanUps runs the functions provided in the cleanUps slice in reverse order. This is a utility function for Kubernetes to help remove resources created when there is an error
func SelectorLabelsForApp ¶
SelectorLabelsForApp returns the pod selector labels that should be on a k8s object for a given application name
func StorageNameFromLabels ¶
StorageNameFromLabels returns the juju storage name used in the provided label set. First checks for the key LabelJujuStorageName and then defaults over to the key LegacyLabelStorageName. If neither key exists an empty string is returned.
Types ¶
type AnnotationKeySupplier ¶
type AnnotationKeySupplier func() string
type DockerConfig ¶
type DockerConfig map[string]DockerConfigEntry
DockerConfig represents the config file used by the docker CLI.
type DockerConfigEntry ¶
DockerConfigEntry represents an Auth entry in the dockerconfigjson.
type DockerConfigJSON ¶
type DockerConfigJSON struct {
Auths DockerConfig `json:"auths"`
}
DockerConfigJSON represents ~/.docker/config.json file info.
type RandomPrefixFunc ¶
RandomPrefixFunc defines a function used to generate a random hex string.