configurations

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package configurations encapsulates all the functionality around Epinio configurations A Configuration is essentially a Secret with some Epinio specific labels. This allows us to use any Secret as a Configuration as long as someone labels it as such. In the future, we will use this to expose secrets created by Service helm charts as Configurations (https://github.com/epinio/epinio/issues/1281). Since we don't control the name of the produced secret in that case, we will need some method to tie a Configuration to a Service. This can be solved with some labels on the Configuration or the Service instance resource.

Index

Constants

View Source
const (
	ConfigurationLabelKey       = "epinio.io/configuration"
	ConfigurationTypeLabelKey   = "epinio.io/configuration-type"
	ConfigurationOriginLabelKey = "epinio.io/configuration-origin"
)

Variables

This section is empty.

Functions

func ForService added in v0.8.0

func ForService(ctx context.Context, kubeClient *kubernetes.Cluster, service *models.Service) ([]v1.Secret, error)

ForService returns a slice of configuration secrets matching the given Service.

func ForServiceUnlabeled added in v1.4.0

func ForServiceUnlabeled(ctx context.Context, kubeClient *kubernetes.Cluster, service *models.Service) ([]v1.Secret, error)

ForServiceUnlabeled returns a slice of unlabeled secrets matching the given Service

func LabelServiceSecrets added in v0.6.3

func LabelServiceSecrets(ctx context.Context, kubeClient *kubernetes.Cluster, service *models.Service) ([]v1.Secret, error)

LabelServiceSecrets will look for the Opaque secrets released with a service, looking for the app.kubernetes.io/instance label, then it will add the Configuration labels to "create" the configurations

func ReplaceConfiguration

func ReplaceConfiguration(ctx context.Context, cluster *kubernetes.Cluster, configuration *Configuration, data map[string]string) (bool, error)

ReplaceConfiguration replaces an existing configuration

func UpdateConfiguration

func UpdateConfiguration(ctx context.Context, cluster *kubernetes.Cluster, configuration *Configuration, changes models.ConfigurationUpdateRequest) error

UpdateConfiguration modifies an existing configuration as per the instructions and writes the result back to the resource.

Types

type Configuration

type Configuration struct {
	Name string

	Username  string
	Type      string
	Origin    string
	CreatedAt metav1.Time
	// contains filtered or unexported fields
}

Configuration contains the information needed for Epinio to address a specific configuration.

func CreateConfiguration

func CreateConfiguration(ctx context.Context, cluster *kubernetes.Cluster, name, namespace, username string,
	data map[string]string) (*Configuration, error)

CreateConfiguration creates a new configuration instance from namespace, name, and a map of parameters.

func Lookup

func Lookup(ctx context.Context, kubeClient *kubernetes.Cluster, namespace, configuration string) (*Configuration, error)

Lookup locates a Configuration by namespace and name. It finds the Configuration instance by looking for the relevant Secret.

func (*Configuration) Delete

func (c *Configuration) Delete(ctx context.Context) error

Delete destroys the configuration instance, i.e. its underlying secret holding the instance's parameters

func (*Configuration) Details

func (c *Configuration) Details(ctx context.Context) (map[string]string, error)

Details returns the configuration instance's configuration. I.e. the parameter data.

func (*Configuration) GetSecret added in v0.6.2

func (c *Configuration) GetSecret(ctx context.Context) (*v1.Secret, error)

func (*Configuration) Namespace

func (c *Configuration) Namespace() string

Namespace returns the configuration's namespace

func (*Configuration) User

func (c *Configuration) User() string

User returns the configuration's username

type ConfigurationList

type ConfigurationList []*Configuration

func List

func List(ctx context.Context, cluster *kubernetes.Cluster, namespace string) (ConfigurationList, error)

List returns a ConfigurationList of all available Configurations in the specified namespace. If no namespace is specified (empty string) then configurations across all namespaces are returned.

Jump to

Keyboard shortcuts

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