webhook

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UpdateCmd = &cobra.Command{
	Use:   "update",
	Short: "Prepare all the pki stuff",
	Long:  `Prepare all the pki stuff`,
	Run: func(cmd *cobra.Command, args []string) {
		myca := new(pki.CA)
		myca.SetupCA()
		if caname == "" {
			caname = utils.GetEnv("CA_SECRET_NAME", "micropki-ca")
		}
		if certname == "" {
			certname = utils.GetEnv("CERT_SECRET_NAME", "micropki-cert")
		}
		caNamespace, err := vars.ValidateNamespace(caNamespace)
		if err != nil {
			panic(err.Error())
		}
		namespace, err := vars.ValidateNamespace(namespace)
		if err != nil {
			panic(err.Error())
		}
		err = myca.NeedInitialization(caname, caNamespace)
		if err != nil {
			if err.Error() != "need update" {
				panic(err.Error())
			} else {
				err = myca.NewCA()
				if err != nil {
					panic(err.Error())
				}
				err = myca.UpdateSecret(caname, caNamespace)
				if err != nil {
					panic(err.Error())
				}
			}
		}
		mycert := new(pki.CERT)
		mycert.SetupCERT(client, strings.Split(fqdns, ","), commonname)
		err = mycert.NeedInitialization(certname, namespace)
		if err != nil {
			if err.Error() != "need update" {
				panic(err.Error())
			} else {
				err = mycert.NewCERT(caname, caNamespace)
				if err != nil {
					panic(err.Error())
				}
				err = mycert.UpdateSecret(certname, namespace)
				if err != nil {
					panic(err.Error())
				}
				err = mycert.UpdateValidatingWebhookConfiguration(webhook)
				if err != nil {
					panic(err.Error())
				}
			}
		}
	}}

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