kubernetes

package
v0.0.0-...-f224bfa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 6 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListNamespaces

func ListNamespaces(ctx context.Context, reader client.Reader, opts ...client.ListOption) (corev1.NamespaceList, error)

func ListPods

func ListPods(ctx context.Context, reader client.Reader, opts ...client.ListOption) (corev1.PodList, error)

func ListPodsForApplication

func ListPodsForApplication(ctx context.Context, reader client.Reader, name, namespace string) (corev1.PodList, error)

func ListReplicaSetsForApplication

func ListReplicaSetsForApplication(ctx context.Context, reader client.Reader, name, namespace string) (appsv1.ReplicaSetList, error)

func ListSharedNamespaces

func ListSharedNamespaces(ctx context.Context, reader client.Reader) (corev1.NamespaceList, error)

func ObjectMeta

func ObjectMeta(name, namespace string, labels map[string]string) metav1.ObjectMeta

func OpaqueSecret

func OpaqueSecret(objectMeta metav1.ObjectMeta, stringData map[string]string) corev1.Secret

func UniformResourceName

func UniformResourceName(resource metav1.Object, clusterName string) string

Types

type SecretLists

type SecretLists struct {
	Used   corev1.SecretList
	Unused corev1.SecretList
}

func ListSecretsForApplication

func ListSecretsForApplication(ctx context.Context, reader client.Reader, application client.ObjectKey, secretLabels client.MatchingLabels) (SecretLists, error)

ListSecretsForApplication finds all secrets matching the given labels and partitions them into SecretLists. A secret is considered "used" if it is mounted or referred to by a pod or any replica set that matches the given application.

func ListUsedAndUnusedSecretsForPods

func ListUsedAndUnusedSecretsForPods(secrets corev1.SecretList, pods corev1.PodList) SecretLists

ListUsedAndUnusedSecretsForPods finds intersect between list of secrets and list of pods that uses (i.e. mounts or refers to the secret) these secrets, and separates the secret list into two lists; used and unused.

This is a low-level method that requires you to perform the list operations for the secrets and pod objects yourself. In most cases, you should prefer using ListSecretsForApplication instead.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL