cluster

package
v0.0.0-...-9516177 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReconcileStarted represents a condition type signaling whether a
	// reconcile has been started
	ReconcileStarted conditions.ConditionType = "ReconcileStarted"
	// ReconcileSucceeded represents a condition type signaling that a
	// reconcile has succeeded
	ReconcileSucceeded conditions.ConditionType = "ReconcileSucceeded"
)

Variables

This section is empty.

Functions

func KubeConfigWithToken

func KubeConfigWithToken(clusterName, apiServerEndpoint, caCertificate, token string) (string, error)

KubeConfigWithToken returns a kubeconfig with token auth

func KubernetesClientFromKubeConfig

func KubernetesClientFromKubeConfig(kubeConfig string) (clientset.Interface, error)

KubernetesClientFromKubeConfig returns a kubernetes clientset from a kubeconfig file

func OneInfraManagedClientFromKubeConfig

func OneInfraManagedClientFromKubeConfig(kubeConfig string) (oneinframanagedclientset.Interface, error)

OneInfraManagedClientFromKubeConfig returns a oneinfra managed clientset from a kubeconfig file

func RESTClientFromKubeConfig

func RESTClientFromKubeConfig(kubeConfig string, groupVersion *schema.GroupVersion, scheme *runtime.Scheme) (*restclient.RESTClient, error)

RESTClientFromKubeConfig creates a rest client from a kubeconfig file

Types

type CertificateAuthorities

type CertificateAuthorities struct {
	APIServerClient   *certificates.Certificate
	CertificateSigner *certificates.Certificate
	Kubelet           *certificates.Certificate
	KubeletClient     *certificates.Certificate
	EtcdClient        *certificates.Certificate
	EtcdPeer          *certificates.Certificate
}

CertificateAuthorities represent global certificate authorities

func (*CertificateAuthorities) Export

func (certificateAuthorities *CertificateAuthorities) Export() *clusterv1alpha1.CertificateAuthorities

Export exports these set of certificate authorities to a versioned certificate authority set

type Cluster

type Cluster struct {
	Name                   string
	Namespace              string
	ResourceVersion        string
	Labels                 map[string]string
	Annotations            map[string]string
	Finalizers             []string
	DeletionTimestamp      *metav1.Time
	KubernetesVersion      string
	ControlPlaneReplicas   int
	CertificateAuthorities *CertificateAuthorities
	EtcdServer             *EtcdServer
	APIServer              *KubeAPIServer
	ClientCertificates     map[string]*certificates.Certificate
	StorageClientEndpoints map[string]string
	StoragePeerEndpoints   map[string]string
	VPN                    *VPN
	VPNPeers               VPNPeerMap
	APIServerEndpoint      string
	VPNServerEndpoint      string
	JoinKey                *crypto.KeyPair
	DesiredJoinTokens      []string
	CurrentJoinTokens      []string
	Conditions             conditions.ConditionList
	ClusterCIDR            string
	ServiceCIDR            string
	NodeCIDRMaskSize       int
	NodeCIDRMaskSizeIPv4   int
	NodeCIDRMaskSizeIPv6   int
	// contains filtered or unexported fields
}

Cluster represents a cluster

func NewCluster

func NewCluster(clusterName, kubernetesVersion string, controlPlaneReplicas int, vpnEnabled bool, vpnCIDR string, apiServerExtraSANs []string) (*Cluster, error)

NewCluster returns an internal cluster

func NewClusterFromv1alpha1

func NewClusterFromv1alpha1(cluster *clusterv1alpha1.Cluster) (*Cluster, error)

NewClusterFromv1alpha1 returns a cluster based on a versioned cluster

func (*Cluster) AdminKubeConfig

func (cluster *Cluster) AdminKubeConfig() (string, error)

AdminKubeConfig returns a kubeconfig file for the current cluster

func (*Cluster) ClientCertificate

func (cluster *Cluster) ClientCertificate(ca *certificates.Certificate, name, commonName string, organization []string, extraSANs []string) (*certificates.Certificate, error)

ClientCertificate returns a client certificate with the given name

func (*Cluster) CoreDNSServiceIP

func (cluster *Cluster) CoreDNSServiceIP() (string, error)

CoreDNSServiceIP returns the CoreDNS IP inside the services CIDR

func (*Cluster) Export

func (cluster *Cluster) Export() *clusterv1alpha1.Cluster

Export exports the cluster to a versioned cluster

func (*Cluster) GenerateVPNPeer

func (cluster *Cluster) GenerateVPNPeer(peerName string) (*VPNPeer, error)

GenerateVPNPeer generates a new VPN peer with name peerName

func (*Cluster) HasUninitializedCertificates

func (cluster *Cluster) HasUninitializedCertificates() bool

HasUninitializedCertificates returns whether this cluster has uninitialized certificates

func (*Cluster) InitializeCertificatesAndKeys

func (cluster *Cluster) InitializeCertificatesAndKeys() error

InitializeCertificatesAndKeys initializes those certificates and keys that are not set in this cluster

func (*Cluster) IsDirty

func (cluster *Cluster) IsDirty() (bool, error)

IsDirty returns whether this cluster is dirty compared to when it was loaded

func (*Cluster) JSONSpecs

func (cluster *Cluster) JSONSpecs() (string, error)

JSONSpecs returns the versioned specs of this cluster in JSON format

func (*Cluster) KubeConfig

func (cluster *Cluster) KubeConfig(commonName string, organization []string) (string, error)

KubeConfig returns a kube config with a client certificate with the given common name and organization

func (*Cluster) KubeConfigWithClientCertificate

func (cluster *Cluster) KubeConfigWithClientCertificate(apiServerEndpoint string, clientCertificate *certificates.Certificate) (string, error)

KubeConfigWithClientCertificate returns a kubeconfig for the current cluster using the provided client certificate

func (*Cluster) KubeConfigWithEndpoint

func (cluster *Cluster) KubeConfigWithEndpoint(apiServerEndpoint, commonName string, organization []string) (string, error)

KubeConfigWithEndpoint returns a kube config with a client certificate with the given common name and organization, pointing to the provided API endpoint

func (*Cluster) KubeletConfig

func (cluster *Cluster) KubeletConfig() (string, error)

KubeletConfig returns a default kubelet config

func (*Cluster) KubernetesClient

func (cluster *Cluster) KubernetesClient() (clientset.Interface, error)

KubernetesClient returns a kubernetes clientset for the current cluster

func (*Cluster) KubernetesExtensionsClient

func (cluster *Cluster) KubernetesExtensionsClient() (apiextensionsclientset.Interface, error)

KubernetesExtensionsClient returns an extensions clientset for the current cluster

func (*Cluster) KubernetesServiceIP

func (cluster *Cluster) KubernetesServiceIP() (string, error)

KubernetesServiceIP returns the Kubernetes IP inside the services CIDR

func (*Cluster) RESTClient

func (cluster *Cluster) RESTClient(groupVersion *schema.GroupVersion, scheme *runtime.Scheme) (*restclient.RESTClient, error)

RESTClient returns a REST client for the current cluster

func (*Cluster) ReconcileCoreDNS

func (cluster *Cluster) ReconcileCoreDNS() error

ReconcileCoreDNS reconciles the CoreDNS deployment in this cluster

func (*Cluster) ReconcileCustomResourceDefinitions

func (cluster *Cluster) ReconcileCustomResourceDefinitions() error

ReconcileCustomResourceDefinitions reconciles this cluster custom resource definitions

func (*Cluster) ReconcileJoinPublicKeyConfigMap

func (cluster *Cluster) ReconcileJoinPublicKeyConfigMap() error

ReconcileJoinPublicKeyConfigMap reconciles the join public key ConfigMap

func (*Cluster) ReconcileJoinTokens

func (cluster *Cluster) ReconcileJoinTokens() error

ReconcileJoinTokens reconciles this cluster join tokens

func (*Cluster) ReconcileKubeProxy

func (cluster *Cluster) ReconcileKubeProxy() error

ReconcileKubeProxy reconciles the kube-proxy daemonset in this cluster

func (*Cluster) ReconcileNamespaces

func (cluster *Cluster) ReconcileNamespaces() error

ReconcileNamespaces reconciles this cluster namespaces

func (*Cluster) ReconcileNodeJoinRequests

func (cluster *Cluster) ReconcileNodeJoinRequests() error

ReconcileNodeJoinRequests reconciles this cluster node join requests

func (*Cluster) ReconcilePermissions

func (cluster *Cluster) ReconcilePermissions() error

ReconcilePermissions reconciles this cluster namespaces

func (*Cluster) RefreshCachedSpecs

func (cluster *Cluster) RefreshCachedSpecs() error

RefreshCachedSpecs refreshes the cached spec

func (*Cluster) Specs

func (cluster *Cluster) Specs() (string, error)

Specs returns the versioned specs of this cluster

func (*Cluster) VPNPeer

func (cluster *Cluster) VPNPeer(name string) (*VPNPeer, error)

VPNPeer returns the VPN peer with the provided name

type EtcdServer

type EtcdServer struct {
	CA *certificates.Certificate
}

EtcdServer represents the etcd component

func (*EtcdServer) Export

func (etcdServer *EtcdServer) Export() *clusterv1alpha1.EtcdServer

Export exports this etcd server into a versioned etcd server

type KubeAPIServer

type KubeAPIServer struct {
	CA             *certificates.Certificate
	ServiceAccount *crypto.KeyPair
	ExtraSANs      []string
}

KubeAPIServer represents the kube-apiserver component

func (*KubeAPIServer) Export

func (kubeAPIServer *KubeAPIServer) Export() *clusterv1alpha1.KubeAPIServer

Export exports this kube-apiserver to a versioned kube-apiserver

type Map

type Map map[string]*Cluster

Map represents a map of clusters

func (Map) Specs

func (clusterMap Map) Specs() (string, error)

Specs returns the versioned specs of all clusters in this map

type VPN

type VPN struct {
	Enabled    bool
	PrivateKey string
	PublicKey  string
	CIDR       *net.IPNet
}

VPN represents the VPN configuration

func (*VPN) Export

func (vpn *VPN) Export() *clusterv1alpha1.VPN

Export exports this VPN to a versioned VPN

type VPNPeer

type VPNPeer struct {
	Name       string
	Address    string
	PrivateKey string
	PublicKey  string
}

VPNPeer represents a VPN peer

type VPNPeerMap

type VPNPeerMap map[string]*VPNPeer

VPNPeerMap represents a map of VPN peers

func (VPNPeerMap) Export

func (vpnPeerMap VPNPeerMap) Export() []clusterv1alpha1.VPNPeer

Export exports the map of VPN peers to a versioned list of VPN peers

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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