parse_k8s_secret

package
v0.81.0-dev-1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "parse-k8s-secret",
	Short:   "Parse TLS Certificate from Kubernetes Secret",
	Aliases: []string{"parse-k8s", "parse-secret", "parse-sec"},
	Args:    cobra.NoArgs,
	Run: func(c *cobra.Command, args []string) {
		clientset, defaultNamespace, _ := k8s.KubernetesClient()

		namespace := defaultNamespace
		if CmdFlagNamespace != "" {
			namespace = CmdFlagNamespace
		}

		secretClient := clientset.CoreV1().Secrets(namespace)

		secret, err := secretClient.Get(
			context.TODO(),
			CmdFlagSecretName,
			metav1.GetOptions{},
		)
		if err != nil {
			log.Fatal(err)
		}

		tls_utils.PrintCertificateFromBytes(
			secret.Data["tls.crt"],
			secret.Data["tls.key"],
		)
	},
}
View Source
var CmdFlagNamespace string
View Source
var CmdFlagSecretName string

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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