utils

package
v0.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CRoleKind              = "ClusterRole"
	CRoleRef               = "cluster-admin"
	DefaultRequeueInterval = 10 * time.Minute
	ServiceAccountName     = "greenhouse"
)

Variables

This section is empty.

Functions

func GenerateNewClientKubeConfig

func GenerateNewClientKubeConfig(restConfigGetter *clientutil.RestClientGetter, bearerToken string, cluster *greenhousev1alpha1.Cluster) ([]byte, error)

GenerateNewClientKubeConfig generates a kubeconfig for the client to access the cluster from REST config coming from the secret

func NewServiceAccount

func NewServiceAccount(name, namespace string) *corev1.ServiceAccount

Types

type KubeConfigHelper

type KubeConfigHelper struct {
	Host           string
	CAData         []byte
	BearerToken    string
	Username       string
	Namespace      string
	TLSServerName  string
	ProxyURL       string
	ClientCertData []byte
	ClientKeyData  []byte
}

func (*KubeConfigHelper) RestConfigToAPIConfig

func (kubeconfig *KubeConfigHelper) RestConfigToAPIConfig(clusterName string) clientcmdapi.Config

RestConfigToAPIConfig converts a rest config to a clientcmdapi.Config

type TokenHelper

type TokenHelper struct {
	InClusterClient                    client.Client
	RemoteClusterClient                client.Client
	Proxy                              string
	RemoteClusterBearerTokenValidity   time.Duration
	RenewRemoteClusterBearerTokenAfter time.Duration
	SecretType                         corev1.SecretType
	OIDCServiceAccount                 string
}

func (*TokenHelper) GenerateTokenRequest

func (t *TokenHelper) GenerateTokenRequest(ctx context.Context, restClientGetter *clientutil.RestClientGetter, cluster *greenhousev1alpha1.Cluster) (*authenticationv1.TokenRequest, error)

GenerateTokenRequest reconciles the service account token for the remote cluster and updates the secret containing the kubeconfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳