From db7c258b2a9d65376291a7a45335de7031553194 Mon Sep 17 00:00:00 2001 From: s3wong Date: Wed, 28 Jun 2023 23:54:03 -0700 Subject: [PATCH] Configurable registerIP for AMF (#41) --- controllers/amf/resources.go | 3 ++- controllers/amf/resources_test.go | 3 ++- controllers/amf/templates.go | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/controllers/amf/resources.go b/controllers/amf/resources.go index 79f75e8..96e7346 100644 --- a/controllers/amf/resources.go +++ b/controllers/amf/resources.go @@ -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) diff --git a/controllers/amf/resources_test.go b/controllers/amf/resources_test.go index 5f9705d..ecedb56 100644 --- a/controllers/amf/resources_test.go +++ b/controllers/amf/resources_test.go @@ -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) diff --git a/controllers/amf/templates.go b/controllers/amf/templates.go index 0a33773..73e4673 100644 --- a/controllers/amf/templates.go +++ b/controllers/amf/templates.go @@ -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: @@ -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) {