k8s

package
v0.0.0-...-daa3d23 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertJsonToYaml

func ConvertJsonToYaml(data []byte) ([]byte, error)

func ConvertYamlToJson

func ConvertYamlToJson(data []byte) ([]byte, error)

func CreateOrUpdateClusterCAIssuerSecret

func CreateOrUpdateClusterCAIssuerSecret(k8sClient *K8SClient, caCertData, caKeyData, caCertChainData []byte) error

func CreateOrUpdateClusterIssuer

func CreateOrUpdateClusterIssuer(clusterCAIssuer string, k8sclient *K8SClient, forceUpdate bool) (*cert.CertificatesData, error)

func GetK8SConfig

func GetK8SConfig(log logging.Logger) (*rest.Config, error)

func RegisterDynamicInformers

func RegisterDynamicInformers(resEvtHandler cache.ResourceEventHandler,
	client dynamic.Interface, gvr schema.GroupVersionResource,
) error

func SetupCACertIssuser

func SetupCACertIssuser(clusterIssuerName string, log logging.Logger) error

Types

type Configuration

type Configuration struct {
	KubeconfigPath string `envconfig:"KUBECONFIG_PATH" required:"false"`
}

func FetchConfiguration

func FetchConfiguration() (*Configuration, error)

type DynamicClientSet

type DynamicClientSet struct {
	// contains filtered or unexported fields
}

func NewDynamicClientSet

func NewDynamicClientSet(dynamicClient dynamic.Interface) *DynamicClientSet

func (*DynamicClientSet) CreateResource

func (dc *DynamicClientSet) CreateResource(ctx context.Context, data []byte, clusterResource bool) (string, string, error)

func (*DynamicClientSet) CreateResourceFromFile

func (dc *DynamicClientSet) CreateResourceFromFile(ctx context.Context, filename string) (string, string, error)

func (*DynamicClientSet) GetNameNamespace

func (dc *DynamicClientSet) GetNameNamespace(jsonByte []byte) (string, string, error)

func (*DynamicClientSet) GetResource

func (dc *DynamicClientSet) GetResource(ctx context.Context, filename string) (*unstructured.Unstructured, error)

func (*DynamicClientSet) ListAllNamespaceResource

func (*DynamicClientSet) ListNamespaceResource

type ExternalSecret

type ExternalSecret struct {
	Kind       string     `yaml:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
	APIVersion string     `yaml:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=apiVersion"`
	Metadata   ObjectMeta `yaml:"metadata,omitempty"`

	Spec ExternalSecretSpec `yaml:"spec,omitempty"`
}

type ExternalSecretData

type ExternalSecretData struct {
	SecretKey string                      `yaml:"secretKey"`
	RemoteRef ExternalSecretDataRemoteRef `yaml:"remoteRef"`
}

type ExternalSecretDataRemoteRef

type ExternalSecretDataRemoteRef struct {
	Key      string `yaml:"key"`
	Property string `yaml:"property,omitempty"`
}

type ExternalSecretSpec

type ExternalSecretSpec struct {
	SecretStoreRef  SecretStoreRef       `yaml:"secretStoreRef,omitempty"`
	Target          ExternalSecretTarget `yaml:"target,omitempty"`
	RefreshInterval string               `yaml:"refreshInterval,omitempty"`
	Data            []ExternalSecretData `yaml:"data,omitempty"`
}

type ExternalSecretTarget

type ExternalSecretTarget struct {
	Name     string                       `yaml:"name,omitempty"`
	Template ExternalSecretTargetTemplate `yaml:"template,omitempty"`
}

type ExternalSecretTargetTemplate

type ExternalSecretTargetTemplate struct {
	Type string `yaml:"type,omitempty"`
}

type K8SClient

type K8SClient struct {
	Clientset              kubernetes.Interface
	DynamicClientInterface dynamic.Interface
	DynamicClient          *DynamicClientSet
	Config                 *rest.Config
	// contains filtered or unexported fields
}

func NewK8SClient

func NewK8SClient(log logging.Logger) (*K8SClient, error)

func NewK8SClientForCluster

func NewK8SClientForCluster(log logging.Logger, kubeconfig, clusterCA, endpoint string) (*K8SClient, error)

func (*K8SClient) CreateConfigmap

func (k *K8SClient) CreateConfigmap(ctx context.Context, namespace, cmName string, data map[string]string, annotation map[string]string) error

func (*K8SClient) CreateNamespace

func (k *K8SClient) CreateNamespace(ctx context.Context, namespace string) error

func (*K8SClient) CreateOrUpdateClusterRoleBinding

func (k *K8SClient) CreateOrUpdateClusterRoleBinding(ctx context.Context, serviceAccounts map[string]string, clusterRole string) error

func (*K8SClient) CreateOrUpdateExternalSecret

func (k *K8SClient) CreateOrUpdateExternalSecret(ctx context.Context, externalSecretName, namespace,
	secretStoreRefName, secretName, secretType string, vaultKeyPathdata map[string]string) (err error)

func (*K8SClient) CreateOrUpdateSecret

func (k *K8SClient) CreateOrUpdateSecret(
	ctx context.Context,
	namespace, secretName string,
	secretType v1.SecretType,
	data map[string][]byte,
	annotation map[string]string,
) error

func (*K8SClient) CreateOrUpdateSecretObject

func (k *K8SClient) CreateOrUpdateSecretObject(ctx context.Context, secret *v1.Secret) error

func (*K8SClient) CreateOrUpdateSecretStore

func (k *K8SClient) CreateOrUpdateSecretStore(ctx context.Context, secretStoreName, namespace, vaultAddr,
	tokenSecretName, tokenSecretKey string) (err error)

func (*K8SClient) CreateOrUpdateServiceAccount

func (k *K8SClient) CreateOrUpdateServiceAccount(ctx context.Context, namespace, serviceAccountName string) error

func (*K8SClient) DeleteConfigmap

func (k *K8SClient) DeleteConfigmap(ctx context.Context, namespace, cmName string) error

func (*K8SClient) DeleteNamespace

func (k *K8SClient) DeleteNamespace(ctx context.Context, namespace string) error

func (*K8SClient) DeleteSecret

func (k *K8SClient) DeleteSecret(ctx context.Context, namespace, secretName string) error

func (*K8SClient) GetConfigmap

func (k *K8SClient) GetConfigmap(ctx context.Context, namespace, cmName string) (map[string]string, error)

func (*K8SClient) GetSecretData

func (k *K8SClient) GetSecretData(namespace, secretName string) (*SecretData, error)

func (*K8SClient) GetSecretObject

func (k *K8SClient) GetSecretObject(namespace, secretName string) (*v1.Secret, error)

func (*K8SClient) GetServiceData

func (k *K8SClient) GetServiceData(namespace, serviceName string) (*ServiceData, error)

func (*K8SClient) ListPods

func (k *K8SClient) ListPods(namespace string) ([]v1.Pod, error)

func (*K8SClient) UpdateConfigmap

func (k *K8SClient) UpdateConfigmap(ctx context.Context, namespace, cmName string, data map[string]string) error

type ObjectMeta

type ObjectMeta struct {
	Name      string `yaml:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
	Namespace string `yaml:"namespace,omitempty" protobuf:"bytes,3,opt,name=namespace"`
}

type SecretData

type SecretData struct {
	Namespace string
	Data      map[string]string
}

type SecretKeySelector

type SecretKeySelector struct {
	Namespace string `yaml:"namespace,omitempty"`
	Name      string `yaml:"name,omitempty"`
	Key       string `yaml:"key,omitempty"`
}

type SecretStore

type SecretStore struct {
	Kind       string     `yaml:"kind,omitempty" protobuf:"bytes,1,opt,name=kind"`
	APIVersion string     `yaml:"apiVersion,omitempty" protobuf:"bytes,2,opt,name=apiVersion"`
	Metadata   ObjectMeta `yaml:"metadata,omitempty"`

	Spec SecretStoreSpec `yaml:"spec,omitempty"`
}

type SecretStoreProvider

type SecretStoreProvider struct {
	Vault *VaultProvider `yaml:"vault,omitempty"`
}

type SecretStoreRef

type SecretStoreRef struct {
	Name string `yaml:"name"`
	Kind string `yaml:"kind,omitempty"`
}

type SecretStoreSpec

type SecretStoreSpec struct {
	Provider        *SecretStoreProvider `yaml:"provider"`
	RefreshInterval int                  `yaml:"refreshInterval,omitempty"`
}

type ServiceData

type ServiceData struct {
	Name  string
	Ports []int32
}

type VaultAuth

type VaultAuth struct {
	TokenSecretRef *SecretKeySelector `yaml:"tokenSecretRef,omitempty"`
}

type VaultProvider

type VaultProvider struct {
	Auth    VaultAuth `yaml:"auth"`
	Server  string    `yaml:"server"`
	Path    string    `yaml:"path,omitempty"`
	Version string    `yaml:"version"`
}

Jump to

Keyboard shortcuts

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