Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide ntp config flag #27

Merged
merged 6 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ docker run -it --rm -name pixiecore \
--metal-api-url https://api.metal-stack.io/metal \
--metal-api-view-hmac a-view-hmac \
--partition partition-1
--ntp-servers ['0.custom.ntp', '1.custom.ntp']
simcod marked this conversation as resolved.
Show resolved Hide resolved
```
17 changes: 9 additions & 8 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package api

// MetalConfig is consumed by metal-hammer to get all options to open a grpc connection to the metal-api
type MetalConfig struct {
Debug bool `json:"debug"`
GRPCAddress string `json:"address,omitempty"`
MetalAPIUrl string `json:"metal_api_url,omitempty"`
PixieAPIURL string `json:"pixie_api_url"`
CACert string `json:"ca_cert,omitempty"`
Cert string `json:"cert,omitempty"`
Key string `json:"key,omitempty"`
HMAC string `json:"hmac,omitempty"`
Debug bool `json:"debug"`
GRPCAddress string `json:"address,omitempty"`
MetalAPIUrl string `json:"metal_api_url,omitempty"`
PixieAPIURL string `json:"pixie_api_url"`
CACert string `json:"ca_cert,omitempty"`
Cert string `json:"cert,omitempty"`
Key string `json:"key,omitempty"`
HMAC string `json:"hmac,omitempty"`
NTPServers []string `json:"ntp_servers,omitempty"`
// Logging contains logging configurations passed to metal-hammer
Logging *Logging `json:"logging,omitempty"`
}
Expand Down
6 changes: 6 additions & 0 deletions pixiecore/cli/grpccmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func init() {
grpcCmd.Flags().String("grpc-address", "", "address of the grpc server")
grpcCmd.Flags().String("metal-api-view-hmac", "", "hmac with metal-api view access")
grpcCmd.Flags().String("metal-api-url", "", "url to access metal-api")
grpcCmd.Flags().StringSlice("ntp-servers", nil, "custom ntp servers")
grpcCmd.Flags().Bool("metal-hammer-debug", true, "set metal-hammer to debug")

// metal-hammer remote logging configuration
Expand Down Expand Up @@ -138,6 +139,10 @@ func getMetalAPIConfig(cmd *cobra.Command) (*api.MetalConfig, error) {
if err != nil {
return nil, fmt.Errorf("unable to parse pixie-api-url: %w", err)
}
ntpServers, err := cmd.Flags().GetStringSlice("ntp-servers")
if err != nil {
return nil, fmt.Errorf("unable reading flag: %w", err)
simcod marked this conversation as resolved.
Show resolved Hide resolved
}
metalHammerDebug, err := cmd.Flags().GetBool("metal-hammer-debug")
if err != nil {
return nil, fmt.Errorf("error reading flag: %w", err)
Expand Down Expand Up @@ -219,6 +224,7 @@ func getMetalAPIConfig(cmd *cobra.Command) (*api.MetalConfig, error) {
Cert: string(clientCert),
Key: string(clientKey),
HMAC: hmac,
NTPServers: ntpServers,
Logging: logging,
}, nil
}