kor

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 42 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppLabels = map[string]string{}
View Source
var UnusedLabels = map[string]string{"kor/used": "false"}
View Source
var UsedLabels = map[string]string{"kor/used": "true"}

Functions

func CalculateResourceDifference added in v0.1.9

func CalculateResourceDifference(usedResourceNames []string, allResourceNames []string) []string

TODO create formatter by resource "#", "Resource Name", "Namespace" TODO Functions that use this object are accompanied by repeated data acquisition operations and can be optimized.

func CheckFinalizers added in v0.3.3

func CheckFinalizers(finalizers []string, deletionTimestamp *metav1.Time) bool

func CreatePersistentVolumeClaimVolumeSource added in v0.2.3

func CreatePersistentVolumeClaimVolumeSource(name string) *corev1.PersistentVolumeClaimVolumeSource

func CreateTestClusterRole added in v0.3.5

func CreateTestClusterRole(name string, labels map[string]string, matchLabels ...v1.LabelSelector) *rbacv1.ClusterRole

func CreateTestClusterRoleBinding added in v0.2.3

func CreateTestClusterRoleBinding(namespace, name, serviceAccountName string) *rbacv1.ClusterRoleBinding

func CreateTestClusterRoleBindingRoleRef added in v0.3.5

func CreateTestClusterRoleBindingRoleRef(namespace, name, serviceAccountName string, roleRefName *rbacv1.RoleRef) *rbacv1.ClusterRoleBinding

func CreateTestConfigmap added in v0.2.3

func CreateTestConfigmap(namespace, name string, labels map[string]string) *corev1.ConfigMap

func CreateTestDaemonSet added in v0.3.5

func CreateTestDaemonSet(namespace, name string, labels map[string]string, status *appsv1.DaemonSetStatus) *appsv1.DaemonSet

func CreateTestDeployment added in v0.2.3

func CreateTestDeployment(namespace, name string, replicas int32, labels map[string]string) *appsv1.Deployment

func CreateTestEndpoint added in v0.2.3

func CreateTestEndpoint(namespace, name string, endpointSubsetCount int, labels map[string]string) *corev1.Endpoints

func CreateTestHpa added in v0.2.3

func CreateTestHpa(namespace, name, deploymentName string, minReplicas, maxReplicas int32, labels map[string]string) *autoscalingv2.HorizontalPodAutoscaler

func CreateTestIngress added in v0.2.3

func CreateTestIngress(namespace, name, ServiceName, secretName string, labels map[string]string) *networkingv1.Ingress

func CreateTestJob added in v0.3.2

func CreateTestJob(namespace, name string, status *batchv1.JobStatus, labels map[string]string) *batchv1.Job

func CreateTestPdb added in v0.2.3

func CreateTestPdb(namespace, name string, matchLabels, pdbLabels map[string]string) *policyv1.PodDisruptionBudget

func CreateTestPod added in v0.2.3

func CreateTestPod(namespace, name, serviceAccountName string, volumes []corev1.Volume, labels map[string]string) *corev1.Pod

func CreateTestPv added in v0.3.1

func CreateTestPv(name, phase string, labels map[string]string, storageClass string) *corev1.PersistentVolume

func CreateTestPvc added in v0.2.3

func CreateTestPvc(namespace, name string, labels map[string]string, storageClass string) *corev1.PersistentVolumeClaim

func CreateTestRbacSubject added in v0.2.3

func CreateTestRbacSubject(namespace, serviceAccountName string) *rbacv1.Subject

func CreateTestReplicaSet added in v0.3.3

func CreateTestReplicaSet(namespace, name string, specReplicas *int32, status *appsv1.ReplicaSetStatus) *appsv1.ReplicaSet

func CreateTestRole added in v0.2.3

func CreateTestRole(namespace, name string, labels map[string]string) *rbacv1.Role

func CreateTestRoleBinding added in v0.2.3

func CreateTestRoleBinding(namespace, name, serviceAccountName string, roleRefName *rbacv1.RoleRef) *rbacv1.RoleBinding

func CreateTestRoleRef added in v0.2.3

func CreateTestRoleRef(roleName string) *rbacv1.RoleRef

func CreateTestRoleRefForClusterRole added in v0.3.5

func CreateTestRoleRefForClusterRole(roleName string) *rbacv1.RoleRef

func CreateTestSecret added in v0.2.3

func CreateTestSecret(namespace, name string, labels map[string]string) *corev1.Secret

func CreateTestService added in v0.2.3

func CreateTestService(namespace, name string) *corev1.Service

func CreateTestServiceAccount added in v0.2.3

func CreateTestServiceAccount(namespace, name string, labels map[string]string) *corev1.ServiceAccount

func CreateTestStatefulSet added in v0.2.3

func CreateTestStatefulSet(namespace, name string, replicas int32, labels map[string]string) *appsv1.StatefulSet

func CreateTestStorageClass added in v0.3.7

func CreateTestStorageClass(name, provisioner string) *storagev1.StorageClass

func CreateTestUnstructered added in v0.3.6

func CreateTestUnstructered(kind, apiVersion, namespace, name string) *unstructured.Unstructured

func CreateTestVolume added in v0.2.3

func CreateTestVolume(name, pvcName string) *corev1.Volume

func DeleteResource added in v0.2.7

func DeleteResource(diff []string, clientset kubernetes.Interface, namespace, resourceType string, noInteractive bool) ([]string, error)

func DeleteResourceCmd added in v0.2.7

func DeleteResourceCmd() map[string]func(clientset kubernetes.Interface, namespace, name string) error

func DeleteResourceWithFinalizer added in v0.3.3

func DeleteResourceWithFinalizer(diff []string, dynamicClient dynamic.Interface, namespace string, gvr schema.GroupVersionResource, noInteractive bool) ([]string, error)

func Exporter added in v0.2.4

func Exporter(filterOptions *filters.Options, clientset kubernetes.Interface, apiExtClient apiextensionsclientset.Interface, dynamicClient dynamic.Interface, outputFormat string, opts Opts)

TODO: add option to change port / url !?

func FlagDynamicResource added in v0.3.3

func FlagDynamicResource(dynamicClient dynamic.Interface, namespace string, gvr schema.GroupVersionResource, resourceName string) error

func FlagResource added in v0.3.0

func FlagResource(clientset kubernetes.Interface, namespace, resourceType, resourceName string) error

func FormatOutput

func FormatOutput(namespace string, resources []string, resourceType string, opts Opts) string

func FormatOutputAll

func FormatOutputAll(namespace string, allDiffs []ResourceDiff, opts Opts) string

func FormatOutputFromMap added in v0.3.3

func FormatOutputFromMap(namespace string, allDiffs map[string][]string, opts Opts) string

func GetAPIExtensionsClient added in v0.2.8

func GetAPIExtensionsClient(kubeconfig string) *apiextensionsclientset.Clientset

func GetConfig added in v0.2.8

func GetConfig(kubeconfig string) (*rest.Config, error)

func GetDynamicClient added in v0.2.8

func GetDynamicClient(kubeconfig string) *dynamic.DynamicClient

func GetKubeClient

func GetKubeClient(kubeconfig string) *kubernetes.Clientset

func GetKubeConfigPath

func GetKubeConfigPath() string

func GetUnusedAll

func GetUnusedAll(filterOpts *filters.Options, clientset kubernetes.Interface, apiExtClient apiextensionsclientset.Interface, dynamicClient dynamic.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedAllNamespaced added in v0.3.7

func GetUnusedAllNamespaced(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedAllNonNamespaced added in v0.3.7

func GetUnusedAllNonNamespaced(filterOpts *filters.Options, clientset kubernetes.Interface, apiExtClient apiextensionsclientset.Interface, dynamicClient dynamic.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedClusterRoles added in v0.3.5

func GetUnusedClusterRoles(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedConfigmaps

func GetUnusedConfigmaps(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedCrds added in v0.2.8

func GetUnusedCrds(filterOpts *filters.Options, apiExtClient apiextensionsclientset.Interface, dynamicClient dynamic.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedDaemonSets added in v0.3.5

func GetUnusedDaemonSets(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedDeployments added in v0.1.8

func GetUnusedDeployments(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedHpas added in v0.1.8

func GetUnusedHpas(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedIngresses added in v0.1.9

func GetUnusedIngresses(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedJobs added in v0.3.2

func GetUnusedJobs(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedMulti added in v0.2.1

func GetUnusedMulti(resourceNames string, filterOpts *filters.Options, clientset kubernetes.Interface, apiExtClient apiextensionsclientset.Interface, dynamicClient dynamic.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedPdbs added in v0.2.0

func GetUnusedPdbs(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedPods added in v0.3.2

func GetUnusedPods(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedPvcs added in v0.1.9

func GetUnusedPvcs(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedPvs added in v0.3.1

func GetUnusedPvs(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedReplicaSets added in v0.3.3

func GetUnusedReplicaSets(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedRoles added in v0.1.8

func GetUnusedRoles(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedSecrets

func GetUnusedSecrets(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedServiceAccounts

func GetUnusedServiceAccounts(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedServices

func GetUnusedServices(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedStatefulSets added in v0.2.3

func GetUnusedStatefulSets(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedStorageClasses added in v0.3.7

func GetUnusedStorageClasses(filterOpts *filters.Options, clientset kubernetes.Interface, outputFormat string, opts Opts) (string, error)

func GetUnusedfinalizers added in v0.3.3

func GetUnusedfinalizers(filterOpts *filters.Options, clientset kubernetes.Interface, dynamicClient *dynamic.DynamicClient, outputFormat string, opts Opts) (string, error)

func ProcessNamespaceDaemonSets added in v0.3.5

func ProcessNamespaceDaemonSets(clientset kubernetes.Interface, namespace string, filterOpts *filters.Options) ([]string, error)

func ProcessNamespaceDeployments added in v0.1.8

func ProcessNamespaceDeployments(clientset kubernetes.Interface, namespace string, filterOpts *filters.Options) ([]string, error)

func ProcessNamespaceJobs added in v0.3.2

func ProcessNamespaceJobs(clientset kubernetes.Interface, namespace string, filterOpts *filters.Options) ([]string, error)

func ProcessNamespacePods added in v0.3.2

func ProcessNamespacePods(clientset kubernetes.Interface, namespace string, filterOpts *filters.Options) ([]string, error)

func ProcessNamespaceReplicaSets added in v0.3.3

func ProcessNamespaceReplicaSets(clientset kubernetes.Interface, namespace string, filterOpts *filters.Options) ([]string, error)

func ProcessNamespaceServices

func ProcessNamespaceServices(clientset kubernetes.Interface, namespace string, filterOpts *filters.Options) ([]string, error)

func ProcessNamespaceStatefulSets added in v0.2.3

func ProcessNamespaceStatefulSets(clientset kubernetes.Interface, namespace string, filterOpts *filters.Options) ([]string, error)

func RemoveDuplicatesAndSort

func RemoveDuplicatesAndSort(slice []string) []string

func SendToSlack added in v0.2.3

func SendToSlack(sm SendMessageToSlack, opts Opts, outputBuffer string) error

Types

type ExceptionResource

type ExceptionResource struct {
	ResourceName string
	Namespace    string
}

type GetUnusedResourceJSONResponse added in v0.1.8

type GetUnusedResourceJSONResponse struct {
	ResourceType string              `json:"resourceType"`
	Namespaces   map[string][]string `json:"namespaces"`
}

type IncludeExcludeLists added in v0.2.0

type IncludeExcludeLists struct {
	IncludeListStr string
	ExcludeListStr string
}

type Opts added in v0.2.7

type Opts struct {
	DeleteFlag    bool
	NoInteractive bool
	Verbose       bool
	WebhookURL    string
	Channel       string
	Token         string
}

type ResourceDiff

type ResourceDiff struct {
	// contains filtered or unexported fields
}

type SendMessageToSlack added in v0.2.3

type SendMessageToSlack interface {
	SendToSlack(opts Opts, outputBuffer string) error
}

type SlackMessage added in v0.2.3

type SlackMessage struct {
}

func (SlackMessage) SendToSlack added in v0.2.3

func (sm SlackMessage) SendToSlack(opts Opts, outputBuffer string) error

Jump to

Keyboard shortcuts

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