Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // NewDetector creates a new singleton detector for EKS NewDetector = func() (Detector, error) { var errors error if clientset, err := getClient(); err != nil { errors = err } else { detector = &EksDetector{Clientset: clientset} } return detector, errors } // IsEKS checks if the agent is running on EKS. This is done by using the kubernetes API to determine if the aws-auth // configmap exists in the kube-system namespace IsEKS = func() IsEKSCache { once.Do(func() { var errors error var value bool eksDetector, err := NewDetector() if err != nil { errors = err } if eksDetector != nil { awsAuth, err := eksDetector.getConfigMap(authConfigNamespace, authConfigConfigMap) if err == nil { value = awsAuth != nil } } isEKSCacheSingleton = IsEKSCache{Value: value, Err: errors} }) return isEKSCacheSingleton } )
View Source
var ( // TestEKSDetector is used for unit testing EKS route TestEKSDetector = func() (Detector, error) { cm := &v1.ConfigMap{ TypeMeta: metav1.TypeMeta{Kind: "ConfigMap", APIVersion: "v1"}, ObjectMeta: metav1.ObjectMeta{Namespace: "kube-system", Name: "aws-auth"}, Data: make(map[string]string), } return &EksDetector{Clientset: fake.NewSimpleClientset(cm)}, nil } // TestK8sDetector is used for unit testing k8s route TestK8sDetector = func() (Detector, error) { return &EksDetector{Clientset: fake.NewSimpleClientset()}, nil } // TestIsEKSCacheEKS os used for unit testing EKS route TestIsEKSCacheEKS = func() IsEKSCache { return IsEKSCache{Value: true, Err: nil} } // TestIsEKSCacheK8s is used for unit testing K8s route TestIsEKSCacheK8s = func() IsEKSCache { return IsEKSCache{Value: false, Err: nil} } )
Functions ¶
This section is empty.
Types ¶
type EksDetector ¶
type EksDetector struct {
Clientset kubernetes.Interface
}
type IsEKSCache ¶
type MockDetector ¶
Click to show internal directories.
Click to hide internal directories.