@@ -12,7 +12,6 @@ import (
1212 "fmt"
1313 "io"
1414 "path"
15- "path/filepath"
1615
1716 "github.com/spf13/cobra"
1817 admissionregistrationv1 "k8s.io/api/admissionregistration/v1"
@@ -42,22 +41,22 @@ const (
4241// GetCertGenCommand returns the certGen cobra command to be executed.
4342func GetCertGenCommand () * cobra.Command {
4443 var (
45- local bool
46- dataHome string
44+ local bool
45+ configHome string
4746 )
4847
4948 cmd := & cobra.Command {
5049 Use : "certgen" ,
5150 Short : "Generate Control Plane Certificates" ,
5251 RunE : func (cmd * cobra.Command , args []string ) error {
53- return certGen (cmd .Context (), cmd .OutOrStdout (), local , dataHome )
52+ return certGen (cmd .Context (), cmd .OutOrStdout (), local , configHome )
5453 },
5554 }
5655
5756 cmd .PersistentFlags ().BoolVarP (& local , "local" , "l" , false ,
5857 "Generate all the certificates locally." )
59- cmd .PersistentFlags ().StringVar (& dataHome , "data -home" , "" ,
60- "Directory for certificates (defaults to ~/.local/share/ envoy-gateway) " )
58+ cmd .PersistentFlags ().StringVar (& configHome , "config -home" , "" ,
59+ "Directory for certificates (defaults to ~/.config/ envoy-gateway" )
6160 cmd .PersistentFlags ().BoolVarP (& overwriteControlPlaneCerts , "overwrite" , "o" , false ,
6261 "Updates the secrets containing the control plane certs." )
6362 cmd .PersistentFlags ().BoolVar (& disableTopologyInjector , "disable-topology-injector" , false ,
@@ -66,7 +65,7 @@ func GetCertGenCommand() *cobra.Command {
6665}
6766
6867// certGen generates control plane certificates.
69- func certGen (ctx context.Context , logOut io.Writer , local bool , dataHome string ) error {
68+ func certGen (ctx context.Context , logOut io.Writer , local bool , configHome string ) error {
7069 cfg , err := config .New (logOut , io .Discard )
7170 if err != nil {
7271 return err
@@ -92,18 +91,18 @@ func certGen(ctx context.Context, logOut io.Writer, local bool, dataHome string)
9291 return fmt .Errorf ("failed to patch webhook: %w" , err )
9392 }
9493 } else {
95- // Use provided dataHome or default
94+ // Use provided configHome or default
9695 hostCfg := & egv1a1.EnvoyGatewayHostInfrastructureProvider {}
97- if dataHome != "" {
98- hostCfg .DataHome = & dataHome
96+ if configHome != "" {
97+ hostCfg .ConfigHome = & configHome
9998 }
10099
101100 paths , err := host .GetPaths (hostCfg )
102101 if err != nil {
103102 return fmt .Errorf ("failed to determine paths: %w" , err )
104103 }
105104
106- certPath := filepath . Join ( paths .DataHome , "certs " )
105+ certPath := paths .CertDir ( " " )
107106 log .Info ("generated certificates" , "path" , certPath )
108107
109108 if err = outputCertsForLocal (certPath , certs ); err != nil {
0 commit comments