Installer: Make Private network optional
Change-Id: Ic7a2e5250a42dc03de2416b1e2a0d1bbca3f010c
diff --git a/core/installer/app.go b/core/installer/app.go
index d86c9f3..0c9cf6b 100644
--- a/core/installer/app.go
+++ b/core/installer/app.go
@@ -115,9 +115,18 @@
InfraAdminPublicKey []byte `json:"infraAdminPublicKey,omitempty"`
}
+type InfraNetwork struct {
+ Name string `json:"name,omitempty"`
+ IngressClass string `json:"ingressClass,omitempty"`
+ CertificateIssuer string `json:"certificateIssuer,omitempty"`
+ AllocatePortAddr string `json:"allocatePortAddr,omitempty"`
+ ReservePortAddr string `json:"reservePortAddr,omitempty"`
+ DeallocatePortAddr string `json:"deallocatePortAddr,omitempty"`
+}
+
type InfraApp interface {
App
- Render(release Release, infra InfraConfig, values map[string]any, charts map[string]helmv2.HelmChartTemplateSpec) (InfraAppRendered, error)
+ Render(release Release, infra InfraConfig, networks []InfraNetwork, values map[string]any, charts map[string]helmv2.HelmChartTemplateSpec) (InfraAppRendered, error)
}
type EnvNetwork struct {
@@ -492,7 +501,7 @@
return AppTypeInfra
}
-func (a cueInfraApp) Render(release Release, infra InfraConfig, values map[string]any, charts map[string]helmv2.HelmChartTemplateSpec) (InfraAppRendered, error) {
+func (a cueInfraApp) Render(release Release, infra InfraConfig, networks []InfraNetwork, values map[string]any, charts map[string]helmv2.HelmChartTemplateSpec) (InfraAppRendered, error) {
if charts == nil {
charts = make(map[string]helmv2.HelmChartTemplateSpec)
}
@@ -501,6 +510,7 @@
"release": release,
"input": values,
"localCharts": charts,
+ "networks": InfraNetworkMap(networks),
})
if err != nil {
return InfraAppRendered{}, err
@@ -538,3 +548,11 @@
}
return ret
}
+
+func InfraNetworkMap(networks []InfraNetwork) map[string]InfraNetwork {
+ ret := make(map[string]InfraNetwork)
+ for _, n := range networks {
+ ret[strings.ToLower(n.Name)] = n
+ }
+ return ret
+}