github.com/Racer159/jackal@v0.32.7-0.20240401174413-0bd2339e4f2e/src/pkg/k8s/types.go (about) 1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: 2021-Present The Jackal Authors 3 4 // Package k8s provides a client for interacting with a Kubernetes cluster. 5 package k8s 6 7 import ( 8 corev1 "k8s.io/api/core/v1" 9 "k8s.io/client-go/kubernetes" 10 "k8s.io/client-go/rest" 11 ) 12 13 // Log is a function that logs a message. 14 type Log func(string, ...any) 15 16 // Labels is a map of K8s labels. 17 type Labels map[string]string 18 19 // K8s is a client for interacting with a Kubernetes cluster. 20 type K8s struct { 21 Clientset kubernetes.Interface 22 RestConfig *rest.Config 23 Log Log 24 Labels Labels 25 } 26 27 // PodLookup is a struct for specifying a pod to target for data injection or lookups. 28 type PodLookup struct { 29 Namespace string `json:"namespace" jsonschema:"description=The namespace to target for data injection"` 30 Selector string `json:"selector" jsonschema:"description=The K8s selector to target for data injection"` 31 Container string `json:"container" jsonschema:"description=The container to target for data injection"` 32 } 33 34 // PodFilter is a function that returns true if the pod should be targeted for data injection or lookups. 35 type PodFilter func(pod corev1.Pod) bool 36 37 // GeneratedPKI is a struct for storing generated PKI data. 38 type GeneratedPKI struct { 39 CA []byte `json:"ca"` 40 Cert []byte `json:"cert"` 41 Key []byte `json:"key"` 42 }