controllers

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const CapiClusterSecretType corev1.SecretType = "cluster.x-k8s.io/secret"

CapiClusterSecretType represents the CAPI managed secret type.

Variables

View Source
var (
	// ArgoNamespace represents the Namespace that hold ArgoCluster secrets.
	ArgoNamespace string
)

Functions

func BuildNamespacedName

func BuildNamespacedName(s string) types.NamespacedName

BuildNamespacedName returns k8s native object identifier.

func GetArgoLabels

func GetArgoLabels() map[string]string

GetArgoLabels holds a map of labels that reconciled objects must have.

func ValidateCapiNaming

func ValidateCapiNaming(n types.NamespacedName) bool

ValidateCapiNaming validates CAPI kubeconfig naming convention.

func ValidateCapiSecret

func ValidateCapiSecret(s *corev1.Secret) error

ValidateCapiSecret validates that we got proper defined types for a given secret.

func ValidateClusterTLSConfig

func ValidateClusterTLSConfig(a *ArgoTLS) error

ValidateClusterTLSConfig validates that we got proper based64 k/v fields.

Types

type ArgoCluster

type ArgoCluster struct {
	NamespacedName types.NamespacedName
	ClusterName    string
	ClusterServer  string
	ClusterConfig  ArgoConfig
}

ArgoCluster holds all information needed for CAPI --> Argo Cluster conversion

func NewArgoCluster

func NewArgoCluster(c *CapiCluster, s *corev1.Secret) *ArgoCluster

NewArgoCluster return a new ArgoCluster

func (*ArgoCluster) ConvertToSecret

func (a *ArgoCluster) ConvertToSecret() (*corev1.Secret, error)

ConvertToSecret converts an ArgoCluster into k8s native secret object.

type ArgoConfig

type ArgoConfig struct {
	TLSClientConfig ArgoTLS `json:"tlsClientConfig"`
}

ArgoConfig represents Argo Cluster.JSON.config

type ArgoTLS

type ArgoTLS struct {
	CaData   string `json:"caData"`
	CertData string `json:"certData"`
	KeyData  string `json:"keyData"`
}

ArgoTLS represents Argo Cluster.JSON.config.tlsClientConfig

type Capi2Argo

type Capi2Argo struct {
	client.Client
	Log    logr.Logger
	Scheme *runtime.Scheme
}

Capi2Argo reconciles a Secret object

func (*Capi2Argo) Reconcile

func (r *Capi2Argo) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile holds all the logic for syncing CAPI to Argo Clusters.

func (*Capi2Argo) SetupWithManager

func (r *Capi2Argo) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager ..

type CapiCluster

type CapiCluster struct {
	APIVersion string    `yaml:"apiVersion"`
	Kind       string    `yaml:"kind"`
	Clusters   []Cluster `yaml:"clusters"`
	Users      []User    `yaml:"users"`
}

CapiCluster is an one-on-one representation of KubeConfig fields.

func NewCapiCluster

func NewCapiCluster() *CapiCluster

NewCapiCluster returns an empty CapiCluster type.

func (*CapiCluster) Unmarshal

func (c *CapiCluster) Unmarshal(s *corev1.Secret) error

Unmarshal k8s secret into CapiCluster type.

type Cluster

type Cluster struct {
	Name    string      `yaml:"name"`
	Cluster ClusterInfo `yaml:"cluster"`
}

Cluster represents kubeconfig.[]Clusters.Cluster fields.

type ClusterInfo

type ClusterInfo struct {
	CaData string `yaml:"certificate-authority-data"`
	Server string `yaml:"server"`
}

ClusterInfo represents kubeconfig.[]Clusters.Cluster.Clusterinfo fields.

type User

type User struct {
	Name string   `yaml:"name"`
	User UserInfo `yaml:"user"`
}

User represents kubeconfig.[]Users fields.

type UserInfo

type UserInfo struct {
	CertData string `yaml:"client-certificate-data"`
	KeyData  string `yaml:"client-key-data"`
}

UserInfo represents kubeconfig.[]Users.User fields.

Jump to

Keyboard shortcuts

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