assets

package
v0.74.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureOAuthCredentials added in v0.70.0

type AzureOAuthCredentials struct {
	ClientSecret string
}

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 OAuth2Credentials added in v0.50.0

type OAuth2Credentials struct {
	ClientID     string
	ClientSecret string
}

OAuth2Credentials represents a client id and secret pair to be used with basic OAuth 2 authentication.

type SigV4Credentials added in v0.52.0

type SigV4Credentials struct {
	AccessKeyID string
	SecretKeyID string
}

SigV4Credentials represents a pair of AWS credentials to be used in the Sigv4 protocol for remote write to AWS Managed Prometheus.

type StoreBuilder added in v0.74.0

type StoreBuilder struct {
	TLSAssets        map[TLSAssetKey]TLSAsset
	TokenAssets      map[string]Token
	SigV4Assets      map[string]SigV4Credentials
	AzureOAuthAssets map[string]AzureOAuthCredentials
	// contains filtered or unexported fields
}

StoreBuilder 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.

StoreBuilder doesn't support concurrent access.

func NewStoreBuilder added in v0.74.0

func NewStoreBuilder(cmClient corev1client.ConfigMapsGetter, sClient corev1client.SecretsGetter) *StoreBuilder

NewStoreBuilder returns an object that can fetch data from ConfigMaps and Secrets.

func NewTestStoreBuilder added in v0.74.0

func NewTestStoreBuilder(objects ...interface{}) *StoreBuilder

NewTestStoreBuilder returns a *StoreBuilder already initialized with the provided objects. It is only used in tests.

func (*StoreBuilder) AddAuthorizationCredentials added in v0.74.0

func (s *StoreBuilder) AddAuthorizationCredentials(ctx context.Context, namespace string, auth *monitoringv1.Authorization, key string) error

func (*StoreBuilder) AddAzureOAuth added in v0.74.0

func (s *StoreBuilder) AddAzureOAuth(ctx context.Context, ns string, azureAD *monitoringv1.AzureAD, key string) error

AddAzureOAuth processes the AzureOAuth SecretKeySelectors and adds the AzureOAuth data to the store.

func (*StoreBuilder) AddBasicAuth added in v0.74.0

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

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

func (*StoreBuilder) AddBearerToken added in v0.74.0

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

func (*StoreBuilder) AddOAuth2 added in v0.74.0

func (s *StoreBuilder) AddOAuth2(ctx context.Context, ns string, oauth2 *monitoringv1.OAuth2) error

AddOAuth2 processes the given *OAuth2 and adds the referenced credentials to the store.

func (*StoreBuilder) AddSafeAuthorizationCredentials added in v0.74.0

func (s *StoreBuilder) AddSafeAuthorizationCredentials(ctx context.Context, namespace string, auth *monitoringv1.SafeAuthorization, key string) error

func (*StoreBuilder) AddSafeTLSConfig added in v0.74.0

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

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

func (*StoreBuilder) AddSigV4 added in v0.74.0

func (s *StoreBuilder) AddSigV4(ctx context.Context, ns string, sigv4 *monitoringv1.Sigv4, key string) error

AddSigV4 processes the SigV4 SecretKeySelectors and adds the SigV4 data to the store.

func (*StoreBuilder) AddTLSConfig added in v0.74.0

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

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

func (*StoreBuilder) ForNamespace added in v0.74.0

func (s *StoreBuilder) ForNamespace(namespace string) StoreGetter

ForNamespace returns a StoreGetter scoped to the given namespace. It reads data only from the cache which needs to be populated beforehand. The namespace argument can't be empty.

func (*StoreBuilder) GetConfigMapKey added in v0.74.0

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

GetConfigMapKey processes the given ConfigMapKeySelector and returns the referenced data.

func (*StoreBuilder) GetKey added in v0.74.0

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

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

func (*StoreBuilder) GetSecretKey added in v0.74.0

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

GetSecretKey processes the given SecretKeySelector and returns the referenced data.

type StoreGetter added in v0.74.0

type StoreGetter interface {
	GetSecretOrConfigMapKey(key monitoringv1.SecretOrConfigMap) (string, error)
	GetConfigMapKey(key v1.ConfigMapKeySelector) (string, error)
	GetSecretKey(key v1.SecretKeySelector) ([]byte, error)
}

StoreGetter can get data from ConfigMap/Secret objects via key selectors. It will return an error if the key selector didn't match.

type TLSAsset

type TLSAsset string

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

func (TLSAsset) Bytes added in v0.71.0

func (ta TLSAsset) Bytes() []byte

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.

type Token added in v0.50.0

type Token string

Token represents text tokens such as bearer token, see https://tools.ietf.org/html/rfc6750.

Jump to

Keyboard shortcuts

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