Documentation ¶
Index ¶
- type K8sUtils
- func (utils *K8sUtils) GetCertFileFromSecret(secret *corev1.Secret) (string, error)
- func (utils *K8sUtils) GetCertFileFromSecretName(secretName string) (string, error)
- func (utils *K8sUtils) GetCredentialsFromSecret(secret *corev1.Secret) (*common.Credentials, error)
- func (utils *K8sUtils) GetCredentialsFromSecretName(secretName string) (*common.Credentials, error)
- func (utils *K8sUtils) StartInformer(callback func(UtilsInterface, *corev1.Secret)) error
- func (utils *K8sUtils) StopInformer()
- type KubernetesClient
- type UtilsInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type K8sUtils ¶
type K8sUtils struct { KubernetesClient *KubernetesClient InformerFactory informers.SharedInformerFactory SecretInformer informerv1.SecretInformer Namespace string CertDirectory string // contains filtered or unexported fields }
K8sUtils stores the configuration of the k8s client, k8s client and the informer
func Init ¶
func Init(namespace, certDirectory string, inCluster bool, resyncPeriod time.Duration) (*K8sUtils, error)
Init - Initializes the k8s client and creates the secret informer
func (*K8sUtils) GetCertFileFromSecret ¶
GetCertFileFromSecret - Given a k8s secret, creates a certificate file and returns the file name
func (*K8sUtils) GetCertFileFromSecretName ¶
GetCertFileFromSecretName - Given a secret name, reads the secret and creates a corresponding cert file and returns the file name
func (*K8sUtils) GetCredentialsFromSecret ¶
GetCredentialsFromSecret - Given a secret object, returns credentials
func (*K8sUtils) GetCredentialsFromSecretName ¶
func (utils *K8sUtils) GetCredentialsFromSecretName(secretName string) (*common.Credentials, error)
GetCredentialsFromSecretName - Given a secret name, reads the secret and returns credentials
func (*K8sUtils) StartInformer ¶
func (utils *K8sUtils) StartInformer(callback func(UtilsInterface, *corev1.Secret)) error
StartInformer - starts the informer to listen for any events related to secrets in the namespace being watched
func (*K8sUtils) StopInformer ¶
func (utils *K8sUtils) StopInformer()
StopInformer - stops the informer
type KubernetesClient ¶
type KubernetesClient struct {
Clientset *kubernetes.Clientset
}
KubernetesClient - client connection
func (*KubernetesClient) CreateInClusterKubeClient ¶
func (c *KubernetesClient) CreateInClusterKubeClient() error
CreateInClusterKubeClient - creates the in-cluster config
func (*KubernetesClient) CreateKubeClient ¶
func (c *KubernetesClient) CreateKubeClient(inCluster bool) error
CreateKubeClient - Creates a k8s client - either InCluster or OutOfCluster
func (*KubernetesClient) CreateOutOfClusterKubeClient ¶
func (c *KubernetesClient) CreateOutOfClusterKubeClient() error
CreateOutOfClusterKubeClient - Creates a Kubernetes Clientset
type UtilsInterface ¶
type UtilsInterface interface { GetCertFileFromSecret(*corev1.Secret) (string, error) GetCertFileFromSecretName(string) (string, error) GetCredentialsFromSecret(*corev1.Secret) (*common.Credentials, error) GetCredentialsFromSecretName(string) (*common.Credentials, error) StartInformer(func(UtilsInterface, *corev1.Secret)) error StopInformer() }
UtilsInterface - interface which provides helper methods related to k8s