...

Source file src/github.com/GoogleCloudPlatform/k8s-config-connector/pkg/webhook/cert/writer/doc.go

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/pkg/webhook/cert/writer

     1  /*
     2  Copyright 2018 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  /*
    18  Package writer provides method to provision and persist the certificates.
    19  
    20  It will create the certificates if they don't exist.
    21  It will ensure the certificates are valid and not expiring. If not, it will recreate them.
    22  
    23  Create a CertWriter that can write the certificate to secret
    24  
    25  	writer, err := NewSecretCertWriter(SecretCertWriterOptions{
    26  		Secret: types.NamespacedName{Namespace: "foo", Name: "bar"},
    27  		Client: client,
    28  	})
    29  	if err != nil {
    30  		// handler error
    31  	}
    32  
    33  Create a CertWriter that can write the certificate to the filesystem.
    34  
    35  	writer, err := NewFSCertWriter(FSCertWriterOptions{
    36  		Path: "path/to/cert/",
    37  	})
    38  	if err != nil {
    39  		// handler error
    40  	}
    41  
    42  Provision the certificates using the CertWriter. The certificate will be available in the desired secret or
    43  the desired path.
    44  
    45  	// writer can be either one of the CertWriters created above
    46  	certs, changed, err := writer.EnsureCerts("admissionwebhook.k8s.io", false)
    47  	if err != nil {
    48  		// handler error
    49  	}
    50  
    51  Inject necessary information given the objects.
    52  
    53  	err = writer.Inject(objs...)
    54  	if err != nil {
    55  		// handler error
    56  	}
    57  */
    58  package writer
    59  
    60  import (
    61  	logf "sigs.k8s.io/controller-runtime/pkg/log"
    62  )
    63  
    64  var log = logf.Log.WithName("admission").WithName("cert").WithName("writer")
    65  

View as plain text