utils

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

This file contains functions common to the controllers to help them interact with elasticsearch.

Index

Constants

This section is empty.

Variables

View Source
var DefaultInstanceKey = client.ObjectKey{Name: "default"}
View Source
var DefaultTSEEInstanceKey = client.ObjectKey{Name: "tigera-secure"}

Functions

func AddAPIServerWatch

func AddAPIServerWatch(c controller.Controller) error

func AddComplianceWatch added in v0.2.1

func AddComplianceWatch(c controller.Controller) error

func AddConfigMapWatch added in v1.0.0

func AddConfigMapWatch(c controller.Controller, name, namespace string) error

func AddNamespaceWatch added in v1.6.0

func AddNamespaceWatch(c controller.Controller, name string) error

func AddNetworkWatch

func AddNetworkWatch(c controller.Controller) error

func AddSecretsWatch added in v1.0.0

func AddSecretsWatch(c controller.Controller, name, namespace string, metaMatches ...MetaMatch) error

func AddServiceWatch added in v1.2.0

func AddServiceWatch(c controller.Controller, name, namespace string) error

func AutoDiscoverProvider added in v1.0.0

func AutoDiscoverProvider(ctx context.Context, clientset kubernetes.Interface) (operatorv1.Provider, error)

func CheckLicenseKey added in v1.0.0

func CheckLicenseKey(ctx context.Context, cli client.Client) error

CheckLicenseKey checks if a license has been installed. It's useful to prevent rollout of TSEE components that might require it. It will return an error if the license is not installed, and nil otherwise.

func ContextLoggerForResource

func ContextLoggerForResource(log logr.Logger, obj runtime.Object) logr.Logger

ContextLoggerForResource provides a logger instance with context set for the provided object.

func ElasticsearchSecrets added in v1.0.0

func ElasticsearchSecrets(ctx context.Context, userSecretNames []string, cli client.Client) ([]*corev1.Secret, error)

ElasticsearchSecrets gets the secrets needed for a component to be able to access Elasticsearch

func GetAmazonCloudIntegration added in v1.8.0

func GetAmazonCloudIntegration(ctx context.Context, client client.Client) (*operatorv1.AmazonCloudIntegration, error)

GetAmazonCloudIntegration returns the tigera AmazonCloudIntegration instance.

func GetAuthentication added in v1.9.0

func GetAuthentication(ctx context.Context, cli client.Client) (*operatorv1.Authentication, error)

GetAuthentication finds the authentication CR in your cluster.

func GetElasticsearchClusterConfig added in v1.2.0

func GetElasticsearchClusterConfig(ctx context.Context, cli client.Client) (*render.ElasticsearchClusterConfig, error)

GetElasticsearchClusterConfig retrieves the config map containing the elasticsearch configuration values, such as the the cluster name and replica count.

func GetManagementCluster added in v1.9.0

func GetManagementCluster(ctx context.Context, c client.Client) (*operatorv1.ManagementCluster, error)

Return the ManagementCluster CR if present. No error is returned if it was not found.

func GetManagementClusterConnection added in v1.9.0

func GetManagementClusterConnection(ctx context.Context, c client.Client) (*operatorv1.ManagementClusterConnection, error)

Return the ManagementClusterConnection CR if present. No error is returned if it was not found.

func GetNetworkingPullSecrets

func GetNetworkingPullSecrets(i *operatorv1.Installation, c client.Client) ([]*corev1.Secret, error)

func IgnoreObject

func IgnoreObject(obj runtime.Object) bool

IgnoreObject returns true if the object has been marked as ignored by the user, and returns false otherwise.

func IsAPIServerReady

func IsAPIServerReady(client client.Client, l logr.Logger) bool

func LogStorageExists added in v1.9.0

func LogStorageExists(ctx context.Context, cli client.Client) (bool, error)

func RandomPassword added in v1.0.0

func RandomPassword(length int) (string, error)

func RequiresAmazonController added in v1.8.0

func RequiresAmazonController(cfg *rest.Config) (bool, error)

RequiresAmazonController determines if the configuration requires we start the aws controllers.

func RequiresTigeraSecure added in v1.0.0

func RequiresTigeraSecure(cfg *rest.Config) (bool, error)

RequiresTigeraSecure determines if the configuration requires we start the tigera secure controllers.

func ValidateCertPair

func ValidateCertPair(client client.Client, certPairSecretName, keyName, certName string) (*corev1.Secret, error)

ValidateCertPair checks if the given secret exists and if so that it contains key and cert fields. If a secret exists then it is returned. If there is an error accessing the secret (except NotFound) or the cert does not have both a key and cert field then an appropriate error is returned. If no secret exists then nil, nil is returned to represent that no cert is valid.

Types

type ComponentHandler

type ComponentHandler interface {
	CreateOrUpdate(context.Context, render.Component, status.StatusManager) error
}

func NewComponentHandler

func NewComponentHandler(log logr.Logger, client client.Client, scheme *runtime.Scheme, cr metav1.Object) ComponentHandler

type MetaMatch added in v1.2.0

type MetaMatch func(metav1.ObjectMeta) bool

Jump to

Keyboard shortcuts

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