deterministic ordering of output.
This commit is contained in:
parent
eba04ec132
commit
d85baf3beb
@ -173,6 +173,7 @@ func LoadConfig(file string) (*Config, error) {
|
||||
dec := yaml.NewDecoder(bytes.NewReader(yamlFile),
|
||||
yaml.UseJSONUnmarshaler(),
|
||||
yaml.DisallowUnknownField(),
|
||||
yaml.UseOrderedMap(),
|
||||
)
|
||||
var config Config
|
||||
err = dec.Decode(&config)
|
||||
|
@ -72,12 +72,10 @@ func Generate(writer io.Writer, generator Generator, config *Config) error {
|
||||
}
|
||||
|
||||
// Loop over all applications and gather the ingress and egress for each application
|
||||
var applications = make(map[string]*Application)
|
||||
var ingresses = make(map[string]*Ingress)
|
||||
var egresses = make(map[string]*Egress)
|
||||
for _, ns := range config.Namespaces {
|
||||
for _, app := range ns.Applications {
|
||||
applications[app.Name] = app
|
||||
if ingresses[app.Name] == nil {
|
||||
ingresses[app.Name] = &Ingress{}
|
||||
}
|
||||
@ -149,12 +147,15 @@ func Generate(writer io.Writer, generator Generator, config *Config) error {
|
||||
}
|
||||
|
||||
// loop over all apps and configure them
|
||||
for app, ingress := range ingresses {
|
||||
egress := egresses[app]
|
||||
if !ingress.Empty() || !egress.Empty() {
|
||||
err := generator.GenerateCommunicationRule(writer, applications[app], ingress, egress)
|
||||
if err != nil {
|
||||
return err
|
||||
for _, ns := range config.Namespaces {
|
||||
for _, app := range ns.Applications {
|
||||
ingress := ingresses[app.Name]
|
||||
egress := egresses[app.Name]
|
||||
if !ingress.Empty() || !egress.Empty() {
|
||||
err := generator.GenerateCommunicationRule(writer, app, ingress, egress)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user