Skip to content

Commit

Permalink
Update the static custom entries
Browse files Browse the repository at this point in the history
This commit updates the static custom entries
to be in struct format and not string.

also add ports 111 and 53 for UDP.

Signed-off-by: Lior Noy <[email protected]>
  • Loading branch information
liornoy committed May 2, 2024
1 parent 4709dfb commit c1a2171
Show file tree
Hide file tree
Showing 2 changed files with 525 additions and 562 deletions.
37 changes: 6 additions & 31 deletions commatrix/commatrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,54 +94,29 @@ func addFromFile(fp string) ([]types.ComDetails, error) {

func getStaticEntries(e Env, d Deployment) ([]types.ComDetails, error) {
comDetails := []types.ComDetails{}
add := []types.ComDetails{}

switch e {
case Baremetal:
err := json.Unmarshal([]byte(baremetalStaticEntriesMaster), &add)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal static entries: %v", err)
}
comDetails = append(comDetails, add...)
comDetails = append(comDetails, baremetalStaticEntriesMaster...)
if d == SNO {
break
}
err = json.Unmarshal([]byte(baremetalStaticEntriesWorker), &add)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal static entries: %v", err)
}
comDetails = append(comDetails, add...)
comDetails = append(comDetails, baremetalStaticEntriesWorker...)
case AWS:
err := json.Unmarshal([]byte(awsCloudStaticEntriesMaster), &add)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal static entries: %v", err)
}
comDetails = append(comDetails, add...)
comDetails = append(comDetails, awsCloudStaticEntriesMaster...)
if d == SNO {
break
}
err = json.Unmarshal([]byte(awsCloudStaticEntriesWorker), &add)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal static entries: %v", err)
}
comDetails = append(comDetails, add...)
comDetails = append(comDetails, awsCloudStaticEntriesWorker...)
default:
return nil, fmt.Errorf("invalid value for cluster environment")
}

err := json.Unmarshal([]byte(generalStaticEntriesMaster), &add)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal static entries: %v", err)
}
comDetails = append(comDetails, add...)
comDetails = append(comDetails, generalStaticEntriesMaster...)
if d == SNO {
return comDetails, nil
}

err = json.Unmarshal([]byte(generalStaticEntriesWorker), &add)
if err != nil {
return nil, fmt.Errorf("failed to unmarshal static entries: %v", err)
}
comDetails = append(comDetails, add...)
comDetails = append(comDetails, generalStaticEntriesWorker...)
return comDetails, nil
}
Loading

0 comments on commit c1a2171

Please sign in to comment.