Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FetchAndLogPods ¶
func FetchAndLogPods(ctx context.Context, clientset kubernetes.Interface, namespace, labelSelector string) error
FetchAndLogPods fetches and logs pods based on the specified label selector.
**Parameters:**
ctx: Context to control the request lifetime. clientset: Kubernetes clientset to interact with Kubernetes API. namespace: Namespace from which to list the pods. labelSelector: String defining the label selector for filtering pods.
**Returns:**
error: An error if any occurs during fetching and logging of pods.
func StreamLogs ¶
func StreamLogs(clientset kubernetes.Interface, namespace, resourceType, resourceName string) error
StreamLogs streams logs for a specific resource within a namespace.
**Parameters:**
clientset: Kubernetes clientset to interact with Kubernetes API. namespace: Namespace where the resource is located. resourceType: Type of resource ('pod', 'job', or 'deployment'). resourceName: Name of the resource to stream logs from.
**Returns:**
error: An error if any occurs during the log streaming process.
Types ¶
type DeploymentLogger ¶
type DeploymentLogger struct {
// contains filtered or unexported fields
}
DeploymentLogger represents a logger specifically designed for logging Kubernetes deployments.
**Attributes:**
kc: Pointer to KubernetesClient used for API requests. namespace: Namespace where the deployment is located. deploymentName: Name of the deployment to log.
func NewDeploymentLogger ¶
func NewDeploymentLogger(kc *k8s.KubernetesClient, namespace, deploymentName string) *DeploymentLogger
NewDeploymentLogger creates a new instance of DeploymentLogger.
**Parameters:**
kc: Pointer to KubernetesClient. namespace: Namespace where the deployment is located. deploymentName: Name of the deployment.
**Returns:**
*DeploymentLogger: A new instance of DeploymentLogger.
func (*DeploymentLogger) FetchAndLog ¶
func (d *DeploymentLogger) FetchAndLog(ctx context.Context) error
FetchAndLog fetches the deployment details and logs related pod events.
**Parameters:**
ctx: Context to control the request lifetime.
**Returns:**
error: An error if any occurs during fetching and logging.
type ServiceLogger ¶
type ServiceLogger struct {
// contains filtered or unexported fields
}
ServiceLogger represents a logger specifically designed for logging Kubernetes services.
**Attributes:**
kc: Pointer to KubernetesClient used for API requests. namespace: Namespace where the service is located. serviceName: Name of the service to log.
func NewServiceLogger ¶
func NewServiceLogger(kc *k8s.KubernetesClient, namespace, serviceName string) *ServiceLogger
NewServiceLogger creates a new instance of ServiceLogger.
**Parameters:**
kc: Pointer to KubernetesClient. namespace: Namespace where the service is located. serviceName: Name of the service.
**Returns:**
*ServiceLogger: A new instance of ServiceLogger.
func (*ServiceLogger) FetchAndLog ¶
func (s *ServiceLogger) FetchAndLog(ctx context.Context) error
FetchAndLog fetches the service details and logs related pod events.
**Parameters:**
ctx: Context to control the request lifetime.
**Returns:**
error: An error if any occurs during fetching and logging.