kube

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultClusterName is the string used to identify the internal cluster.
	DefaultClusterName = "default"
)

Variables

View Source
var ErrGlobalRepositoryWithSecrets = fmt.Errorf("docker registry secrets cannot be set for app repositories available in all namespaces")

ErrGlobalRepositoryWithSecrets defines the error returned when an attempt is made to create registry secrets for a global repo.

Functions

func KubeappsSecretNameForRepo

func KubeappsSecretNameForRepo(repoName, namespace string) string

KubeappsSecretNameForRepo returns a name suitable for recording a copy of a per-namespace repository secret in the kubeapps namespace.

func NewClusterConfig added in v1.10.2

func NewClusterConfig(inClusterConfig *rest.Config, token string, cluster string, additionalClusters AdditionalClustersConfig) (*rest.Config, error)

NewClusterConfig returns a copy of an in-cluster config with a custom token and/or custom cluster host

Types

type AdditionalClusterConfig added in v1.10.2

type AdditionalClusterConfig struct {
	Name                     string `json:"name"`
	APIServiceURL            string `json:"apiServiceURL"`
	CertificateAuthorityData string `json:"certificateAuthorityData,omitempty"`
	// The genericclioptions.ConfigFlags struct includes only a CAFile field, not
	// a CAData field.
	// https://github.com/kubernetes/cli-runtime/issues/8
	// Embedding genericclioptions.ConfigFlags in a struct which includes the actual rest.Config
	// and returning that for ToRESTConfig() isn't enough, so we each configured cert out and
	// include a CAFile field in the config.
	CAFile string
	// ServiceToken can be configured so that the Kubeapps application itself
	// has access to get all namespaces on additional clusters, for example. It
	// should *not* be for reading secrets or similar, but limited to the
	// required functionality.
	ServiceToken string

	Insecure bool `json:"insecure"`
}

AdditionalClusterConfig contains required info to talk to additional clusters.

type AdditionalClustersConfig added in v1.10.2

type AdditionalClustersConfig map[string]AdditionalClusterConfig

AdditionalClustersConfig is an alias for a map of additional cluster configs.

type AuthHandler

type AuthHandler interface {
	AsUser(token, cluster string) (handler, error)
	AsSVC() handler
}

AuthHandler exposes Handler functionality as a user or the current serviceaccount

func NewHandler

func NewHandler(kubeappsNamespace string, additionalClusters AdditionalClustersConfig) (AuthHandler, error)

NewHandler returns a handler configured with a service account client set and a config with a blank token to be copied when creating user client sets with specific tokens.

type FakeHandler

type FakeHandler struct {
	AppRepos    []*v1alpha1.AppRepository
	CreatedRepo *v1alpha1.AppRepository
	UpdatedRepo *v1alpha1.AppRepository
	Namespaces  []corev1.Namespace
	Secrets     []*corev1.Secret
	ValRes      *ValidationResponse
	Err         error
}

FakeHandler represents a fake Handler for testing purposes

func (*FakeHandler) AsSVC

func (c *FakeHandler) AsSVC() handler

AsSVC fakes using current svcaccount

func (*FakeHandler) AsUser

func (c *FakeHandler) AsUser(token, cluster string) (handler, error)

AsUser fakes user auth

func (*FakeHandler) CreateAppRepository

func (c *FakeHandler) CreateAppRepository(appRepoBody io.ReadCloser, requestNamespace string) (*v1alpha1.AppRepository, error)

CreateAppRepository fake

func (*FakeHandler) DeleteAppRepository

func (c *FakeHandler) DeleteAppRepository(name, namespace string) error

DeleteAppRepository fake

func (*FakeHandler) GetAppRepository

func (c *FakeHandler) GetAppRepository(name, namespace string) (*v1alpha1.AppRepository, error)

GetAppRepository fake

func (*FakeHandler) GetNamespaces

func (c *FakeHandler) GetNamespaces() ([]corev1.Namespace, error)

GetNamespaces fake

func (c *FakeHandler) GetOperatorLogo(namespace, name string) ([]byte, error)

GetOperatorLogo fake

func (*FakeHandler) GetSecret

func (c *FakeHandler) GetSecret(name, namespace string) (*corev1.Secret, error)

GetSecret fake

func (*FakeHandler) ListAppRepositories added in v1.11.2

func (c *FakeHandler) ListAppRepositories(requestNamespace string) (*v1alpha1.AppRepositoryList, error)

ListAppRepositories fake

func (*FakeHandler) UpdateAppRepository added in v1.10.1

func (c *FakeHandler) UpdateAppRepository(appRepoBody io.ReadCloser, requestNamespace string) (*v1alpha1.AppRepository, error)

UpdateAppRepository fake

func (*FakeHandler) ValidateAppRepository added in v1.9.0

func (c *FakeHandler) ValidateAppRepository(appRepoBody io.ReadCloser, requestNamespace string) (*ValidationResponse, error)

ValidateAppRepository fake

type HTTPClient added in v1.9.0

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient Interface to perform HTTP requests

func InitNetClient added in v1.9.0

func InitNetClient(appRepo *v1alpha1.AppRepository, caCertSecret, authSecret *corev1.Secret, defaultHeaders http.Header) (HTTPClient, error)

InitNetClient returns an HTTP client based on the chart details loading a custom CA if provided (as a secret)

type ValidationResponse added in v1.10.1

type ValidationResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ValidationResponse represents the response after validating a repo

Jump to

Keyboard shortcuts

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