teleport

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewClient = func(ctx context.Context, proxyAddr, identityFile string) (Client, error) {
	teleportClient, err := tc.New(ctx, tc.Config{
		Addrs: []string{
			proxyAddr,
		},
		Credentials: []tc.Credentials{
			tc.LoadIdentityFileFromString(identityFile),
		},
	})
	if err != nil {
		return nil, microerror.Mask(err)
	}

	_, err = teleportClient.Ping(ctx)
	if err != nil {
		return nil, microerror.Mask(err)
	}

	return teleportClient, nil
}

Functions

func AddFinalizer

func AddFinalizer(ctx context.Context, log logr.Logger, cluster *capi.Cluster, ctrlClient client.Client) error

func RemoveFinalizer

func RemoveFinalizer(ctx context.Context, log logr.Logger, cluster *capi.Cluster, ctrlClient client.Client) error

Types

type Client

type Client interface {
	Ping(ctx context.Context) (proto.PingResponse, error)
	GetToken(ctx context.Context, name string) (types.ProvisionToken, error)
	GetTokens(ctx context.Context) ([]types.ProvisionToken, error)
	CreateToken(ctx context.Context, token types.ProvisionToken) error
	UpsertToken(ctx context.Context, token types.ProvisionToken) error
	DeleteToken(ctx context.Context, name string) error
}

type Teleport

type Teleport struct {
	Config         *config.Config
	Identity       *config.IdentityConfig
	TeleportClient Client
	Namespace      string
	TokenGenerator token.Generator
}

func New

func New(namespace string, cfg *config.Config, tokenGenerator token.Generator) *Teleport

func (*Teleport) CreateConfigMap

func (t *Teleport) CreateConfigMap(ctx context.Context, log logr.Logger, ctrlClient client.Client, clusterName string, clusterNamespace string, registerName string, token string) error

func (*Teleport) CreateSecret

func (t *Teleport) CreateSecret(ctx context.Context, log logr.Logger, ctrlClient client.Client, clusterName string, clusterNamespace string, token string) error

func (*Teleport) DeleteConfigMap

func (t *Teleport) DeleteConfigMap(ctx context.Context, log logr.Logger, ctrlClient client.Client, clusterName string, clusterNamespace string) error

func (*Teleport) DeleteSecret

func (t *Teleport) DeleteSecret(ctx context.Context, log logr.Logger, ctrlClient client.Client, clusterName string, clusterNamespace string) error

func (*Teleport) DeleteToken

func (t *Teleport) DeleteToken(ctx context.Context, log logr.Logger, registerName string) error

func (*Teleport) GenerateToken

func (t *Teleport) GenerateToken(ctx context.Context, registerName string, tokenType string) (string, error)

func (*Teleport) GetConfigMap

func (t *Teleport) GetConfigMap(ctx context.Context, log logr.Logger, ctrlClient client.Client, clusterName string, clusterNamespace string) (*corev1.ConfigMap, error)

func (*Teleport) GetSecret

func (t *Teleport) GetSecret(ctx context.Context, log logr.Logger, ctrlClient client.Client, clusterName string, clusterNamespace string) (*corev1.Secret, error)

func (*Teleport) GetTokenFromConfigMap

func (t *Teleport) GetTokenFromConfigMap(ctx context.Context, configMap *corev1.ConfigMap) (string, error)

func (*Teleport) GetTokenFromSecret

func (t *Teleport) GetTokenFromSecret(ctx context.Context, secret *corev1.Secret) (string, error)

func (*Teleport) IsTokenValid

func (t *Teleport) IsTokenValid(ctx context.Context, registerName string, oldToken string, tokenType string) (bool, error)

func (*Teleport) UpdateConfigMap

func (t *Teleport) UpdateConfigMap(ctx context.Context, log logr.Logger, ctrlClient client.Client, configMap *corev1.ConfigMap, token string) error

func (*Teleport) UpdateSecret

func (t *Teleport) UpdateSecret(ctx context.Context, log logr.Logger, ctrlClient client.Client, clusterName string, clusterNamespace string, token string) error

Jump to

Keyboard shortcuts

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