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

Add feature to ignore missing environment variables. Useful when all … #85

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all 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 internal/pkg/params/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,5 @@ var (
CreateStatefulSetPersistentVolumeClaim bool = false
StatefulSetPersistentVolumeClaimStorageClass string
StatefulSetPersistentVolumeClaimSize string
IgnoreMissingEnv = false // Command line flag to ignore missing environment variables in metagraf.json
)
1 change: 1 addition & 0 deletions mg/cmd/create-deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func init() {
createDeploymentCmd.Flags().StringVar(&params.PodAntiAffinityTopologyKey, "anti-affinity-topology-key", "", "Define which node label to use as a topologyKey (describing a datacenter, zone or a rack as an example)")
createDeploymentCmd.Flags().Int32Var(&params.PodAntiAffinityWeight, "pod-anti-affinity-weight", params.PodAntiAffinityWeightDefault, "Weight for WeightedPodAffinityTerm.")
createDeploymentCmd.Flags().BoolVar(&params.DownwardAPIEnvVars,"downward-api-envvars",false,"Enables generation of environment variables from Downward API. An opinionated selection.")
createDeploymentCmd.Flags().BoolVar(&IgnoreMissingEnv, "ignore-missing-env", false, "Ignore missing environment variables")
}

var createDeploymentCmd = &cobra.Command{
Expand Down
1 change: 1 addition & 0 deletions mg/cmd/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,5 @@ func FlagPassingHack() {
modules.OName = OName
modules.Context = Context
modules.CreateGlobals = CreateGlobals
modules.IgnoreMissingEnv = IgnoreMissingEnv
}
1 change: 1 addition & 0 deletions mg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ var (

// Holds a slice of paths to ignore in mg dev watch cmd.
IgnoredPaths []string
IgnoreMissingEnv bool = false // Command line flag to ignore missing environment variables in metagraf.json
)

// Array of available config keys
Expand Down
1 change: 1 addition & 0 deletions pkg/modules/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ var (
CreateGlobals bool
// Sets the default pull policy for all metagraf modules
PullPolicy corev1.PullPolicy = corev1.PullIfNotPresent
IgnoreMissingEnv bool = false
)

var Variables metagraf.MGProperties
Expand Down
2 changes: 1 addition & 1 deletion pkg/modules/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func GenDeployment(mg *metagraf.MetaGraf, namespace string) {
}

EnvVars, err = GetEnvVars(mg, Variables)
if err != nil {
if err != nil && IgnoreMissingEnv == false {
glog.Error(err)
panic(err)
}
Expand Down