github.com/pachyderm/pachyderm@v1.13.4/src/client/pkg/tls/tls.go (about)

     1  package tls
     2  
     3  import (
     4  	"os"
     5  	"path"
     6  	"time"
     7  
     8  	"github.com/pachyderm/pachyderm/src/client/pkg/errors"
     9  )
    10  
    11  const (
    12  	// VolumePath is the path at which the tls cert and private key (if any)
    13  	// will be mounted in the pachd pod
    14  	VolumePath = "/pachd-tls-cert"
    15  
    16  	// CertFile is the name of the mounted file containing a TLS certificate
    17  	// that identifies pachd
    18  	CertFile = "tls.crt"
    19  
    20  	// KeyFile is the name of the mounted file containing a private key
    21  	// corresponding to the public certificate in TLSCertFile
    22  	KeyFile = "tls.key"
    23  
    24  	// CertCheckFrequency is how often we check for a renewed TLS certificate
    25  	CertCheckFrequency = time.Hour
    26  )
    27  
    28  // GetCertPaths gets the paths to the cert and key files within a cluster
    29  func GetCertPaths() (certPath string, keyPath string, err error) {
    30  	certPath = path.Join(VolumePath, CertFile)
    31  	if _, err = os.Stat(certPath); err != nil {
    32  		err = errors.Wrapf(err, "could not stat public cert at %s", certPath)
    33  		return
    34  	}
    35  
    36  	keyPath = path.Join(VolumePath, KeyFile)
    37  	if _, err = os.Stat(keyPath); err != nil {
    38  		err = errors.Wrapf(err, "could not stat private key at %s", keyPath)
    39  		return
    40  	}
    41  	return
    42  }