func (ac *AutoCert) Delete(cli clientset.Interface) error {
	var err error
	err = cli.Core().Secrets(util.NamaspacedObjToMeta(ac).Namespace).Delete(util.NamaspacedObjToMeta(ac).Name, &metav1.DeleteOptions{})
	if err != nil && !apierrors.IsNotFound(err) {
		return err
	}
	return nil
}
Delete removes the certificate. The certificate doesn't need to have been get/requested.
package crypto
import (
	"crypto/rand"
	"crypto/rsa"
	"crypto/x509"
	"crypto/x509/pkix"
	"encoding/pem"
	"fmt"
	"net"
	"time"
	"github.com/golang/glog"
	"github.com/kubernetes/kubernetes/cmd/kubeadm/app/util/apiclient"
	certsv1beta1 "k8s.io/api/certificates/v1beta1"
	corev1 "k8s.io/api/core/v1"
	apierrors "k8s.io/apimachinery/pkg/api/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	clientset "k8s.io/client-go/kubernetes"
	certutil "k8s.io/client-go/util/cert"
	"github.com/kubic-project/dex-operator/pkg/util"
)
var defaultCertificateUsages = []certsv1beta1.KeyUsage{
	"digital signature",
	"key encipherment",
	"server auth",
	"client auth",
}
type AutoCert struct {
	IPs []net.IP
	Names []string
	SecretName string
	SecretNamespace string
	current *corev1.Secret
}
func NewAutoCert(ips []net.IP, names []string, name, namespace string) (*AutoCert, error) {
	if len(namespace) == 0 {
		namespace = metav1.NamespaceSystem
	}
	return &AutoCert{
		IPs:             ips,
		Names:           names,
		SecretName:      name,
		SecretNamespace: namespace,
		current:         nil,
	}, nil
}
func NewServiceCertFromReference(ref corev1.SecretReference) (*AutoCert, error) {
	return &AutoCert{
		SecretName:      ref.Name,
		SecretNamespace: ref.Namespace,
		current:         nil,
	}, nil
}
func (ac AutoCert) GetName() string {
	return ac.SecretName
}
func (ac AutoCert) GetNamespace() string {
	return ac.SecretNamespace
}