Documentation
¶
Index ¶
- func NewPod(kubePod *v1.Pod) *common.Pod
- func ParseImageIDString(imageID string) (string, string, error)
- type AddPod
- type BlackDuckAnnotations
- type Client
- type DeletePod
- type KubeClient
- func (client *KubeClient) ClearBlackDuckPodAnnotations(namespace string, name string) error
- func (client *KubeClient) GetAllPods() ([]common.Pod, error)
- func (client *KubeClient) GetBlackDuckPodAnnotations(namespace string, name string) (*BlackDuckAnnotations, error)
- func (client *KubeClient) GetPod(namespace string, name string) (*v1.Pod, error)
- func (client *KubeClient) GetPods() ([]v1.Pod, error)
- func (client *KubeClient) GetPodsForNamespace(namespace string) ([]v1.Pod, error)
- func (client *KubeClient) PodAdd() <-chan AddPod
- func (client *KubeClient) PodDelete() <-chan DeletePod
- func (client *KubeClient) PodUpdate() <-chan UpdatePod
- func (client *KubeClient) SetBlackDuckPodAnnotations(namespace string, name string, bdAnnotations BlackDuckAnnotations) error
- func (client *KubeClient) UpdatePod(pod *v1.Pod) error
- type KubeController
- type MockClient
- func (client *MockClient) ClearBlackDuckPodAnnotations(namespace string, name string) error
- func (client *MockClient) ClearBlackDuckPodAnnotationsWithPod(pod common.Pod) error
- func (client *MockClient) GetBlackDuckPodAnnotations(namespace string, name string) (*BlackDuckAnnotations, error)
- func (client *MockClient) GetBlackDuckPodAnnotationsWithPod(pod common.Pod) (*BlackDuckAnnotations, error)
- func (client *MockClient) PodAdd() <-chan AddPod
- func (client *MockClient) PodDelete() <-chan DeletePod
- func (client *MockClient) PodUpdate() <-chan UpdatePod
- func (client *MockClient) SetBlackDuckPodAnnotations(namespace string, name string, bdAnnotations BlackDuckAnnotations) error
- func (client *MockClient) SetBlackDuckPodAnnotationsWithPod(pod common.Pod, bdAnnotations BlackDuckAnnotations) error
- type UpdatePod
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseImageIDString ¶
ParseImageIDString parses an ImageID pulled from kubernetes. Example image id:
docker-pullable://registry.kipp.blackducksoftware.com/blackducksoftware/hub-registration@sha256:cb4983d8399a59bb5ee6e68b6177d878966a8fe41abe18a45c3b1d8809f1d043
Types ¶
type BlackDuckAnnotations ¶
type BlackDuckAnnotations struct {
// TODO remove KeyVals, this is just for testing, to be able
// to jam random stuff somewhere
KeyVals map[string]string
PolicyViolationCount int
VulnerabilityCount int
OverallStatus string
}
BlackDuckAnnotations describes the data model for pod annotation.
func NewBlackDuckAnnotations ¶
func NewBlackDuckAnnotations(policyViolationCount int, vulnerabilityCount int, overallStatus string) *BlackDuckAnnotations
type Client ¶
type Client interface {
ClearBlackDuckPodAnnotations(namespace string, name string) error
GetBlackDuckPodAnnotations(namespace string, name string) (*BlackDuckAnnotations, error)
SetBlackDuckPodAnnotations(namespace string, name string, bdAnnotations BlackDuckAnnotations) error
// TODO change these types to use the ones in the common package
PodAdd() <-chan AddPod
PodUpdate() <-chan UpdatePod
PodDelete() <-chan DeletePod
}
Client provides the BlackDuck-specific interface to a cluster
type DeletePod ¶
type DeletePod struct {
QualifiedName string
}
DeletePod holds the name of the deleted pod as a string of namespace/name
type KubeClient ¶
type KubeClient struct {
// contains filtered or unexported fields
}
KubeClient is an implementation of the Client interface for kubernetes
func NewKubeClient ¶
func NewKubeClient(masterURL string, kubeconfigPath string) (*KubeClient, error)
NewKubeClient instantiates a KubeClient using a master URL and a path to a kubeconfig file.
func NewKubeClientFromCluster ¶
func NewKubeClientFromCluster() (*KubeClient, error)
NewKubeClientFromCluster instantiates a KubeClient using configuration pulled from the cluster.
func (*KubeClient) ClearBlackDuckPodAnnotations ¶
func (client *KubeClient) ClearBlackDuckPodAnnotations(namespace string, name string) error
func (*KubeClient) GetAllPods ¶
func (client *KubeClient) GetAllPods() ([]common.Pod, error)
GetAllPods asks for the kubernetes APIServer for all of its pods across all namespaces.
func (*KubeClient) GetBlackDuckPodAnnotations ¶
func (client *KubeClient) GetBlackDuckPodAnnotations(namespace string, name string) (*BlackDuckAnnotations, error)
GetBlackDuckPodAnnotations cooperates with SetBlackDuckPodAnnotations, which serialize and deserialize a JSON dictionary, in the annotations map, under the "BlackDuck" key. Rationale:
- to support a rich model
- to avoid stomping on other annotations that have nothing to do with Black Duck
func (*KubeClient) GetPod ¶
func (client *KubeClient) GetPod(namespace string, name string) (*v1.Pod, error)
func (*KubeClient) GetPods ¶
func (client *KubeClient) GetPods() ([]v1.Pod, error)
func (*KubeClient) GetPodsForNamespace ¶
func (client *KubeClient) GetPodsForNamespace(namespace string) ([]v1.Pod, error)
GetPodsForNamespace returns an empty slice if the namespace doesn't exist.
func (*KubeClient) PodAdd ¶
func (client *KubeClient) PodAdd() <-chan AddPod
func (*KubeClient) PodDelete ¶
func (client *KubeClient) PodDelete() <-chan DeletePod
func (*KubeClient) PodUpdate ¶
func (client *KubeClient) PodUpdate() <-chan UpdatePod
func (*KubeClient) SetBlackDuckPodAnnotations ¶
func (client *KubeClient) SetBlackDuckPodAnnotations(namespace string, name string, bdAnnotations BlackDuckAnnotations) error
func (*KubeClient) UpdatePod ¶
func (client *KubeClient) UpdatePod(pod *v1.Pod) error
type KubeController ¶
type KubeController struct {
// contains filtered or unexported fields
}
func NewKubeController ¶
func NewKubeController(queue workqueue.RateLimitingInterface, indexer cache.Indexer, informer cache.Controller) *KubeController
func (*KubeController) Run ¶
func (c *KubeController) Run(threadiness int, stopCh chan struct{})
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient implements the client interface without actually requiring a running cluster, in order to facilitate testing
func NewMockClient ¶
func NewMockClient() *MockClient
func (*MockClient) ClearBlackDuckPodAnnotations ¶
func (client *MockClient) ClearBlackDuckPodAnnotations(namespace string, name string) error
func (*MockClient) ClearBlackDuckPodAnnotationsWithPod ¶
func (client *MockClient) ClearBlackDuckPodAnnotationsWithPod(pod common.Pod) error
func (*MockClient) GetBlackDuckPodAnnotations ¶
func (client *MockClient) GetBlackDuckPodAnnotations(namespace string, name string) (*BlackDuckAnnotations, error)
func (*MockClient) GetBlackDuckPodAnnotationsWithPod ¶
func (client *MockClient) GetBlackDuckPodAnnotationsWithPod(pod common.Pod) (*BlackDuckAnnotations, error)
func (*MockClient) PodAdd ¶
func (client *MockClient) PodAdd() <-chan AddPod
func (*MockClient) PodDelete ¶
func (client *MockClient) PodDelete() <-chan DeletePod
func (*MockClient) PodUpdate ¶
func (client *MockClient) PodUpdate() <-chan UpdatePod
func (*MockClient) SetBlackDuckPodAnnotations ¶
func (client *MockClient) SetBlackDuckPodAnnotations(namespace string, name string, bdAnnotations BlackDuckAnnotations) error
func (*MockClient) SetBlackDuckPodAnnotationsWithPod ¶
func (client *MockClient) SetBlackDuckPodAnnotationsWithPod(pod common.Pod, bdAnnotations BlackDuckAnnotations) error