From 10624f49d530ee7921e8cf35e4b4486a328c7424 Mon Sep 17 00:00:00 2001 From: "naman.gupta" Date: Fri, 1 Dec 2023 19:30:22 +0530 Subject: [PATCH] Adding service for App manager. Adding service for App manager. Change-Id: I90a22aa7addae0bba71a5a50c0ee147d2e27197f Signed-off-by: naman.gupta --- .../internal/controller/getIngress.go | 31 +++++++- .../internal/controller/getServiceAccount.go | 13 +++- .../internal/controller/getServices.go | 85 +++++++++++++++++++++- 3 files changed, 126 insertions(+), 3 deletions(-) diff --git a/depRicKubernetesOperator/internal/controller/getIngress.go b/depRicKubernetesOperator/internal/controller/getIngress.go index d44c553..101a430 100644 --- a/depRicKubernetesOperator/internal/controller/getIngress.go +++ b/depRicKubernetesOperator/internal/controller/getIngress.go @@ -35,4 +35,33 @@ func GetIngress() []*unstructured.Unstructured { }, }, }, - } \ No newline at end of file + } + ingress2 := &unstructured.Unstructured{ + Object: map[string]interface{}{ + "apiVersion": "networking.k8s.io/v1beta1", + "kind": "Ingress", + "metadata": map[string]interface{}{ + "name": "ingress-ricplt-appmgr", + }, + "spec": map[string]interface{}{ + "rules": []interface{}{ + map[string]interface{}{ + "http": map[string]interface{}{ + "paths": []interface{}{ + map[string]interface{}{ + "backend": map[string]interface{}{ + "serviceName": "service-ricplt-appmgr-http", + "servicePort": 8080, + }, + "path": "/appmgr", + }, + }, + }, + }, + }, + }, + }, + } + + return []*unstructured.Unstructured{ingress1, ingress2} +} \ No newline at end of file diff --git a/depRicKubernetesOperator/internal/controller/getServiceAccount.go b/depRicKubernetesOperator/internal/controller/getServiceAccount.go index 366405b..eab86dd 100644 --- a/depRicKubernetesOperator/internal/controller/getServiceAccount.go +++ b/depRicKubernetesOperator/internal/controller/getServiceAccount.go @@ -18,5 +18,16 @@ func GetServiceAccount() []*corev1.ServiceAccount { Kind: "ServiceAccount", }, } - return []*corev1.ServiceAccount{serviceAccount1} + serviceAccount2 := &corev1.ServiceAccount{ + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ricplt", + Name: "svcacct-ricplt-appmgr", + }, + TypeMeta: metav1.TypeMeta{ + APIVersion: "v1", + Kind: "ServiceAccount", + }, + } + + return []*corev1.ServiceAccount{serviceAccount1,serviceAccount2} } \ No newline at end of file diff --git a/depRicKubernetesOperator/internal/controller/getServices.go b/depRicKubernetesOperator/internal/controller/getServices.go index 8f65388..8fc4004 100644 --- a/depRicKubernetesOperator/internal/controller/getServices.go +++ b/depRicKubernetesOperator/internal/controller/getServices.go @@ -172,5 +172,88 @@ func GetService() []*corev1.Service { }, } - return []*corev1.Service{service1, service2, service3, service4} + service5 := &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "app": "ricplt-appmgr", + "chart": "appmgr-3.0.0", + "heritage": "Helm", + "release": "release-name", + }, + Name: "service-ricplt-appmgr-http", + Namespace: "ricplt", + }, + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{ + + corev1.ServicePort{ + Name: "http", + Port: 8080, + Protocol: corev1.Protocol("TCP"), + TargetPort: intstr.IntOrString{ + Type: intstr.Type(1), + StrVal: "http", + }, + }, + }, + PublishNotReadyAddresses: false, + Selector: map[string]string{ + "release": "release-name", + "app": "ricplt-appmgr", + }, + Type: corev1.ServiceType("ClusterIP"), + }, + TypeMeta: metav1.TypeMeta{ + APIVersion: "v1", + Kind: "Service", + }, + } + + service6 := &corev1.Service{ + ObjectMeta: metav1.ObjectMeta{ + Name: "service-ricplt-appmgr-rmr", + Namespace: "ricplt", + Labels: map[string]string{ + "chart": "appmgr-3.0.0", + "heritage": "Helm", + "release": "release-name", + "app": "ricplt-appmgr", + }, + }, + Spec: corev1.ServiceSpec{ + Ports: []corev1.ServicePort{ + + corev1.ServicePort{ + Name: "rmrroute", + Port: 4561, + Protocol: corev1.Protocol("TCP"), + TargetPort: intstr.IntOrString{ + Type: intstr.Type(1), + StrVal: "rmrroute", + }, + }, + corev1.ServicePort{ + Name: "rmrdata", + Port: 4560, + Protocol: corev1.Protocol("TCP"), + TargetPort: intstr.IntOrString{ + StrVal: "rmrdata", + Type: intstr.Type(1), + }, + }, + }, + PublishNotReadyAddresses: false, + Selector: map[string]string{ + "app": "ricplt-appmgr", + "release": "release-name", + }, + Type: corev1.ServiceType("ClusterIP"), + }, + TypeMeta: metav1.TypeMeta{ + APIVersion: "v1", + Kind: "Service", + }, + } + + return []*corev1.Service{service1, service2, service3, service4,service5,service6 } } -- 2.16.6