Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
fix: add --cert-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
raffis committed Feb 8, 2024
1 parent 890ecce commit a2a7888
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type Config struct {
EtcdVersion string `env:"ETCD_VERSION, default=3.5.11"`
ApiServerRegistry string `env:"API_SERVER_REGISTRY, default=registry.k8s.io/kube-apiserver"`
EtcdRegistry string `env:"ETCD_REGISTRY, default=quay.io/coreos/etcd"`
CertDir string `env:"CERT_DIR"`
}

var (
Expand All @@ -84,6 +85,7 @@ func init() {
flag.StringVarP(&config.ApiServerRegistry, "api-server-registry", "", "", "OCI registry for pulling the kube-apiserver image")
flag.StringVarP(&config.EtcdRegistry, "etcd-registry", "", "", "OCI registry for pulling the etcd image")
flag.StringVarP(&config.EtcdVersion, "etcd-version", "", "", "The version for etcd")
flag.StringVarP(&config.CertDir, "cert-dir", "", "", "Alternative host mount path for the temporary cert directoy. Use only in the case yakmv runs itself within a container and TMPDIR is not the same path as on the docker host.")

tbl = table.NewWriter()
tbl.SetOutputMirror(output)
Expand Down Expand Up @@ -500,6 +502,10 @@ func startAPIServer(ctx context.Context, dockerClient *dockerclient.Client, etcd
return types.ContainerJSON{}, err
}

if config.CertDir != "" {
certDir = filepath.Join(config.CertDir, filepath.Base(certDir))
}

tag, _ := strings.CutPrefix(config.KubeVersion, "v")
cont, err := dockerClient.ContainerCreate(
ctx,
Expand Down

0 comments on commit a2a7888

Please sign in to comment.