impersonation

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2020 The Flux authors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2021 Pelotech - Apache License, Version 2.0.

  • Adaption for Konfigurations from fluxcd/kustomize-controller
  • Caches kubeconfigs and serviceaccount tokens for subsequent calls
  • Standalone package operating on interfaces

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	client.Client

	// StatusPoller returns a polling.StatusPoller using the config from
	// this client instance.
	StatusPoller() *polling.StatusPoller
}

Client is an extension of the controller-runtime Client with the ability to retrieve a status poller using the same credentials.

type Impersonation

type Impersonation interface {
	// GetClient creates a controller-runtime client for talking to a Kubernetes API server.
	// If KubeConfig is set, will use the kubeconfig bytes from the Kubernetes secret.
	// If ServiceAccountName is set, will use the cluster provided kubeconfig impersonating the SA.
	// Otherwise will assume running in cluster and use the cluster provided kubeconfig.
	GetClient(ctx context.Context) (Client, error)
}

Impersonation provides methods for retrieving kubernetes clients and status pollers during a CR's reconciliation.

func NewImpersonation

func NewImpersonation(imp Impersonator, kubeClient client.Client) Impersonation

NewImpersonation creates a new Impersonation using the given CR and client.

type Impersonator

type Impersonator interface {
	client.Object

	// GetKubeConfigSecretName should return the name of the secret in the object's namespace
	// containing a Kubeconfig. If no kubeconfig is configured, it should return an
	// empty string.
	GetKubeConfigSecretName() string
	// GetServiceAccountName should return the name of the service account to impersonate
	// in the object's namespace. If none is configured, it should return an empty string.
	GetServiceAccountName() string
}

Impersonator is an interface to be implemented by CRs that need to assume the credentials of other Kubernetes entities during reconciliation.

Jump to

Keyboard shortcuts

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