func certificatesFromFile(file string) ([]*x509.Certificate, error) {
	if len(file) == 0 {
		return nil, errors.New("error reading certificates from an empty filename")
	}
	pemBlock, err := ioutil.ReadFile(file)
	if err != nil {
		return nil, err
	}
	certs, err := CertsFromPEM(pemBlock)
	if err != nil {
		return nil, fmt.Errorf("error reading %s: %s", file, err)
	}
	return certs, nil
}
certificatesFromFile returns the x509.Certificates contained in the given PEM-encoded file.
Returns an error if the file could not be read, a certificate could not be parsed, or if the file does not contain any certificates
package client
import (
	"crypto/x509"
	"encoding/pem"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"strings"
	"text/template"
)
func renderTemplate(resource string, w io.Writer, data interface{}) error {
	t := template.Must(template.New("kubernetes").Parse(templates[resource]))
	if err := t.Execute(w, data); err != nil {
		return err
	}
	return nil
}
func CertPoolFromFile(filename string) (*x509.CertPool, error) {
	certs, err := certificatesFromFile(filename)
	if err != nil {
		return nil, err
	}
	pool := x509.NewCertPool()
	for _, cert := range certs {
		pool.AddCert(cert)
	}
	return pool, nil
}