Skip to content

Commit

Permalink
Configurable registerIP for AMF (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
s3wong committed Jun 29, 2023
1 parent 383e69d commit db7c258
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion controllers/amf/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ func createConfigMap(log logr.Logger, amfDeployment *nephiov1alpha1.AMFDeploymen
}

templateValues := configurationTemplateValues{
N2_IP: n2ip,
SVC_NAME: instanceName,
N2_IP: n2ip,
}

configuration, err := renderConfigurationTemplate(templateValues)
Expand Down
3 changes: 2 additions & 1 deletion controllers/amf/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ func TestCreateConfigMap(t *testing.T) {
n2ip, _ := controllers.GetFirstInterfaceConfigIPv4(amfDeployment.Spec.Interfaces, "n2")

templateValues := configurationTemplateValues{
N2_IP: n2ip,
SVC_NAME: "test-amf-deployment",
N2_IP: n2ip,
}

configuration, err := renderConfigurationTemplate(templateValues)
Expand Down
5 changes: 3 additions & 2 deletions controllers/amf/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ configuration:
sbi:
scheme: http
registerIPv4: release-name-free5gc-amf-service # IP used to register to NRF
registerIPv4: {{ .SVC_NAME }}
bindingIPv4: 0.0.0.0 # IP used to bind the service
port: 80
tls:
Expand Down Expand Up @@ -160,7 +160,8 @@ logger:
var configurationTemplate = template.Must(template.New("AMFConfiguration").Parse(configurationTemplateSource))

type configurationTemplateValues struct {
N2_IP string
SVC_NAME string
N2_IP string
}

func renderConfigurationTemplate(values configurationTemplateValues) (string, error) {
Expand Down

0 comments on commit db7c258

Please sign in to comment.