hosted

package
v0.10.0-rc Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnnotationTenantNameFmt with a CR `singular` name applied provides the
	// annotation key used to identify tenant resources by name on the host side
	// Example: tenant.crossplane.io/stackinstall-name
	AnnotationTenantNameFmt = "tenant.crossplane.io/%s-name"

	// AnnotationTenantNamespaceFmt with a CR `singular` name applied provides
	// the annotation key used to identify tenant resources by namespace on the
	// host side
	// Example: tenant.crossplane.io/stack-namespace
	AnnotationTenantNamespaceFmt = "tenant.crossplane.io/%s-namespace"
)

Variables

This section is empty.

Functions

func GetClients

func GetClients() (client.Client, *kubernetes.Clientset, error)

GetClients is the function to get Host Kubernetes (where install and controller pods scheduled) clients with in cluster config. This function is called regardless of hosted mode being enabled: Hosted Mode Off (Standard Installation): - resource (tenant) kube client => in cluster config - host kube clients => in cluster config Hosted Mode On: - resource (tenant) kube client => via EnvTenantKubeconfig - host kube clients => in cluster config

func ObjectReferenceAnnotationsOnHost

func ObjectReferenceAnnotationsOnHost(singular, name, namespace string) map[string]string

ObjectReferenceAnnotationsOnHost returns a map for use as annotations on the host to identify the named tenant resource. This annotation is used for reference purposes to define a relationship to a single resource of a specific kind. For example, this could be used to declare the tenant stackinstall resource that is related to a host install job.

On a host the original tenant resource name may be truncated away. Annotations provide a way to store the original name without truncation.

Types

type Config

type Config struct {
	// HostControllerNamespace is the namespace on Host Cluster where install and controller jobs/deployments will be
	// deployed.
	HostControllerNamespace string
	// TenantAPIServiceHost is Kubernetes Apiserver Host for custom resources (a.k.a Tenant Kubernetes)
	TenantAPIServiceHost string
	// TenantAPIServicePort is Kubernetes Apiserver Port for custom resources (a.k.a Tenant Kubernetes)
	TenantAPIServicePort string
}

Config is the configuration for Host Aware Mode where different Kubernetes API's are used for pod scheduling and custom resources.

func NewConfig

func NewConfig(hostControllerNamespace, tenantAPIServiceHost, tenantAPIServicePort string) (*Config, error)

NewConfig returns a new host aware config based on the input parameters.

func NewConfigForHost

func NewConfigForHost(hostControllerNamespace, host string) (*Config, error)

NewConfigForHost returns a host aware config given a controller namespace and a Host string, assumed to be in the format accepted by rest.Config. It returns a nil Config if either the supplied namespace or host are empty. https://pkg.go.dev/k8s.io/client-go/rest?tab=doc#Config

func (*Config) ObjectReferenceOnHost

func (c *Config) ObjectReferenceOnHost(name, namespace string) corev1.ObjectReference

ObjectReferenceOnHost maps objects with a given name and namespace into a single controller namespace on the Host Cluster.

The resource name on the host cluster may be truncated from the original tenant name to fit label value length. The resource name may be used as a label, as is the case for jobs and deployments where the admission controller generates labels based on the resource name.

Jump to

Keyboard shortcuts

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