Skip to content

Commit

Permalink
Add TETRAPOD_CNI_POD_TEMPLATES, TETRAPOD_CNI_ENABLE_EXTRA_CLAIMS
Browse files Browse the repository at this point in the history
  • Loading branch information
tsuzu committed Mar 13, 2023
1 parent 1788724 commit b216927
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tetrad/api/v1alpha1/cniconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ func loadFromEnv(v *string, key string) {
*v = value
}

func loadFromEnvBool(v *bool, key string) {
value := os.Getenv(key)

if value == "" {
return
}

*v, _ = strconv.ParseBool(key)
}

func loadFromEnvArray(v *[]string, key string) {
value := os.Getenv(key)

Expand Down Expand Up @@ -170,6 +180,9 @@ type CNIDConfig struct {
}

func (c *CNIDConfig) Load(configPath string) {
loadFromEnvArray(&c.AddressClaimTemplates, "TETRAPOD_CNI_POD_TEMPLATES")
loadFromEnvBool(&c.Extra, "TETRAPOD_CNI_ENABLE_EXTRA_CLAIMS")

if c.SocketPath == "" {
c.SocketPath = cniserver.DefaultSocketPath
}
Expand Down

0 comments on commit b216927

Please sign in to comment.