From: naman.gupta Date: Wed, 8 Nov 2023 12:57:09 +0000 (+0530) Subject: Adding services changes for xapp. X-Git-Tag: 2.1.1~10 X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=ed2c71da61b5ed8cfda9d76189eb5d96e719cc51;p=ric-plt%2Fricdms.git Adding services changes for xapp. Adding service structures and functions changes for xapp Change-Id: If3a4f34b916b24634ba538796e440aaeb16650ad Signed-off-by: naman.gupta --- diff --git a/xappKubernetesOperator/internal/controller/getServices.go b/xappKubernetesOperator/internal/controller/getServices.go new file mode 100644 index 0000000..4b8c0c6 --- /dev/null +++ b/xappKubernetesOperator/internal/controller/getServices.go @@ -0,0 +1,95 @@ +package controller + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/util/intstr" +) + +func GetService() []*corev1.Service { + + service1 := &corev1.Service{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "v1", + Kind: "Service", + }, + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "app": "ricplt-hw-go", + "chart": "hw-go-1.0.0", + "heritage": "Helm", + "release": "release-name", + }, + Name: "service-ricplt-hw-go-http", + Namespace: "ricplt", + }, + Spec: corev1.ServiceSpec{ + Type: corev1.ServiceType("ClusterIP"), + Ports: []corev1.ServicePort{ + + corev1.ServicePort{ + Name: "http", + Port: 8080, + Protocol: corev1.Protocol("TCP"), + TargetPort: intstr.IntOrString{ + StrVal: "http", + Type: intstr.Type(1), + }, + }, + }, + PublishNotReadyAddresses: false, + Selector: map[string]string{ + "app": "ricplt-hw-go", + "release": "release-name", + }, + }, + } + + service2 := &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "heritage": "Helm", + "release": "release-name", + "app": "ricplt-hw-go", + "chart": "hw-go-1.0.0", + }, + Name: "service-ricplt-hw-go-rmr", + Namespace: "ricplt", + }, + Spec: corev1.ServiceSpec{ + Type: corev1.ServiceType("ClusterIP"), + Ports: []corev1.ServicePort{ + + corev1.ServicePort{ + Port: 4560, + Protocol: corev1.Protocol("TCP"), + TargetPort: intstr.IntOrString{ + StrVal: "rmrdata", + Type: intstr.Type(1), + }, + Name: "rmrdata", + }, + corev1.ServicePort{ + Name: "rmrroute", + Port: 4561, + Protocol: corev1.Protocol("TCP"), + TargetPort: intstr.IntOrString{ + Type: intstr.Type(1), + StrVal: "rmrroute", + }, + }, + }, + PublishNotReadyAddresses: false, + Selector: map[string]string{ + "app": "ricplt-hw-go", + "release": "release-name", + }, + }, + TypeMeta: metav1.TypeMeta{ + APIVersion: "v1", + Kind: "Service", + }, + } + + return []*corev1.Service{service1, service2} +}