assets

package
v0.47.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2021 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicAuthCredentials

type BasicAuthCredentials struct {
	Username string
	Password string
}

BasicAuthCredentials represents a username password pair to be used with basic http authentication, see https://tools.ietf.org/html/rfc7617.

type BearerToken

type BearerToken string

BearerToken represents a bearer token, see https://tools.ietf.org/html/rfc6750.

type Store

type Store struct {
	TLSAssets         map[TLSAssetKey]TLSAsset
	BearerTokenAssets map[string]BearerToken
	BasicAuthAssets   map[string]BasicAuthCredentials
	// contains filtered or unexported fields
}

Store is a store that fetches and caches TLS materials, bearer tokens and auth credentials from configmaps and secrets. Data can be referenced directly from a Prometheus object or indirectly (for instance via ServiceMonitor). In practice a new store is created and used by each reconciliation loop.

Store doesn't support concurrent access.

func NewStore

func NewStore(cmClient corev1client.ConfigMapsGetter, sClient corev1client.SecretsGetter) *Store

NewStore returns an empty assetStore.

func (*Store) AddBasicAuth

func (s *Store) AddBasicAuth(ctx context.Context, ns string, ba *monitoringv1.BasicAuth, key string) error

AddBasicAuth processes the given *BasicAuth and adds the referenced credentials to the store.

func (*Store) AddBearerToken

func (s *Store) AddBearerToken(ctx context.Context, ns string, sel v1.SecretKeySelector, key string) error

AddBearerToken processes the given SecretKeySelector and adds the referenced data to the store.

func (*Store) AddSafeTLSConfig

func (s *Store) AddSafeTLSConfig(ctx context.Context, ns string, tlsConfig *monitoringv1.SafeTLSConfig) error

AddSafeTLSConfig validates the given SafeTLSConfig and adds it to the store.

func (*Store) AddTLSConfig

func (s *Store) AddTLSConfig(ctx context.Context, ns string, tlsConfig *monitoringv1.TLSConfig) error

AddTLSConfig validates the given TLSConfig and adds it to the store.

func (*Store) GetConfigMapKey

func (s *Store) GetConfigMapKey(ctx context.Context, namespace string, sel v1.ConfigMapKeySelector) (string, error)

GetConfigMapKey processes the given ConfigMapKeySelector and returns the referenced data.

func (*Store) GetKey

func (s *Store) GetKey(ctx context.Context, namespace string, sel monitoringv1.SecretOrConfigMap) (string, error)

GetKey processes the given SecretOrConfigMap selector and returns the referenced data.

func (*Store) GetSecretKey

func (s *Store) GetSecretKey(ctx context.Context, namespace string, sel v1.SecretKeySelector) (string, error)

GetSecretKey processes the given SecretKeySelector and returns the referenced data.

type TLSAsset

type TLSAsset string

TLSAsset represents any TLS related opaque string, e.g. CA files, client certificates.

type TLSAssetKey

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

TLSAssetKey is a key for a TLS asset.

func TLSAssetKeyFromSecretSelector

func TLSAssetKeyFromSecretSelector(ns string, sel *v1.SecretKeySelector) TLSAssetKey

TLSAssetKeyFromSecretSelector returns a TLSAssetKey struct from a secret key selector.

func TLSAssetKeyFromSelector

func TLSAssetKeyFromSelector(ns string, sel monitoringv1.SecretOrConfigMap) TLSAssetKey

TLSAssetKeyFromSelector returns a TLSAssetKey struct from a secret or configmap key selector.

func (TLSAssetKey) String

func (k TLSAssetKey) String() string

String implements the fmt.Stringer interface.

Jump to

Keyboard shortcuts

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