Commit a0ead352 authored by Sergio Gimenez's avatar Sergio Gimenez Committed by George Papathanail
Browse files

feat(fm): reach FM's internal API through a ClusterIP-only Service

FM serves /internal/* only on FM_INTERNAL_PORT (8083) and answers 404 for it on the
E/WBI port (federation-manager fix/fm-internal-port). Add the federation-manager-internal
ClusterIP Service on 8083, pass FM_PORT and FM_INTERNAL_PORT, and point OEG and SRM at
it: OEG for partner registry and federation lifecycle, SRM for /internal/federated-zones.
Publishing the E/WBI Service as a NodePort no longer publishes the internal API.
parent 8befb5ae
Loading
Loading
Loading
Loading
+2 −1
Changes for README.md: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -301,7 +301,8 @@ On kind, as printed by `scripts/helm-deploy.sh`:
| Portal | http://localhost:30082 |
| Data Lab (when enabled) | http://localhost:30083 |

Inside the cluster: `http://oeg`, `http://srm:8080`, `http://federation-manager:8082`,
Inside the cluster: `http://oeg`, `http://srm:8080`, `http://federation-manager:8082` (E/WBI),
`http://federation-manager-internal:8083` (FM internal API),
`http://keycloak:8080`, `nats://oop-nats:4222`, `postgres:5432`.

---
+14 −7
Changes for oop-platform-chart/charts/federation-manager/README.md: 14 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -2,13 +2,15 @@

Deploys Federation Manager (FM) 2.0, the part of OOP that talks to other operators' platforms
(partner OPs) over the GSMA OPG.04 East/Westbound Interface (E/WBI). Partners call it under
`/operatorplatform/federation/v1`; OEG and SRM call its internal API under `/internal/...`.
`/operatorplatform/federation/v1` on port 8082; OEG and SRM call its internal API under
`/internal/...` on port 8083, which FM serves on no other port.

The chart creates:

- a Deployment `federation-manager` (one container on port 8082, running as uid 10001, plus an
- a Deployment `federation-manager` (one container on ports 8082 and 8083, running as uid 10001, plus an
  init container that waits for the database);
- a Service `federation-manager` (port 8082);
- a Service `federation-manager` (port 8082, the E/WBI partners call);
- a Service `federation-manager-internal` (port 8083, always `ClusterIP`) for the internal API;
- a Secret `federation-manager-keys` holding the generated partner secret key (see
  [Partner secret key](#partner-secret-key)).

@@ -66,8 +68,9 @@ from `global.federation.clients`) and send them to FM. FM checks:
The issuer and the key URL differ because partners see Keycloak on its public address while FM, in
a pod, may only reach `http://keycloak:8080`.

The internal API (`/internal/...`) has no login in this release. Keep the FM Service reachable only
from the cluster and from partners.
The internal API (`/internal/...`) has no login in this release. FM answers it only on port 8083,
behind the `ClusterIP` Service `federation-manager-internal`, so publishing the E/WBI Service as a
NodePort or through an ingress never publishes it; on 8082 `/internal/...` returns `404`.

## Callback links

@@ -96,11 +99,14 @@ All keys sit under `federation-manager:` in the umbrella chart's values.
| `federationManager.image.tag` | string | `2.0.0` | Image tag |
| `federationManager.image.pullPolicy` | string | `IfNotPresent` | Image pull policy |
| `federationManager.imagePullSecrets` | list | `[]` | Pull secrets for a private registry |
| `federationManager.service.name` | string | `federation-manager` | Service name, the in-cluster host name OEG and SRM use |
| `federationManager.service.name` | string | `federation-manager` | Name of the E/WBI Service |
| `federationManager.service.type` | string | `ClusterIP` | `ClusterIP` or `NodePort` (kind: `NodePort`) |
| `federationManager.service.port` | int | `8082` | Service port |
| `federationManager.service.targetPort` | int | `8082` | Container port |
| `federationManager.service.nodePort` | string/int | `""` | NodePort when `service.type=NodePort` (kind: `30989`) |
| `federationManager.internalService.name` | string | `federation-manager-internal` | Service for the internal API, the host name OEG and SRM use |
| `federationManager.internalService.port` | int | `8083` | Internal Service port |
| `federationManager.internalService.targetPort` | int | `8083` | Container port of the internal API (`FM_INTERNAL_PORT`) |
| `federationManager.resources` | object | `{}` | Container resource requests/limits |
| `federationManager.database.name` | string | `fm` | Database name |
| `federationManager.database.user` | string | `fm` | Database role |
@@ -198,7 +204,8 @@ federation-manager:

## Reaching FM

- In the cluster: `http://federation-manager:8082`.
- In the cluster: `http://federation-manager:8082` (E/WBI) and `http://federation-manager-internal:8083`
  (internal API).
- On kind: `http://localhost:30989/docs` for the API docs.

## Troubleshooting
+7 −0
Changes for oop-platform-chart/charts/federation-manager/templates/federation-manager-deployment.yaml: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -58,7 +58,14 @@ spec:
            - name: http
              containerPort: {{ $c.service.targetPort }}
              protocol: TCP
            - name: internal
              containerPort: {{ .Values.federationManager.internalService.targetPort }}
              protocol: TCP
          env:
            - name: FM_PORT
              value: {{ .Values.federationManager.service.targetPort | quote }}
            - name: FM_INTERNAL_PORT
              value: {{ .Values.federationManager.internalService.targetPort | quote }}
            - name: DB_PASSWORD
              valueFrom:
                secretKeyRef:
+24 −0
Changes for oop-platform-chart/charts/federation-manager/templates/federation-manager-internal-service.yaml: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
{{- if and .Values.federationManager.enabled (include "federation-manager.authEnabled" .) }}
# Cluster-internal only, whatever type the EWBI Service has: /internal/* has no auth of
# its own beyond being unreachable from outside.
apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.federationManager.internalService.name }}
  namespace: {{ include "federation-manager.namespace" . }}
  labels:
    {{- include "federation-manager.fm.labels" . | nindent 4 }}
  {{- with .Values.commonAnnotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  type: ClusterIP
  ports:
    - name: internal
      protocol: TCP
      port: {{ .Values.federationManager.internalService.port }}
      targetPort: internal
  selector:
    {{- include "federation-manager.fm.selectorLabels" . | nindent 4 }}
{{- end }}
+8 −0
Changes for oop-platform-chart/charts/federation-manager/values.yaml: 8 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -17,6 +17,14 @@ federationManager:
    targetPort: 8082
    nodePort: ""

  # FM's /internal/* API (partner registry, federation lifecycle) answers only on this
  # port, through a ClusterIP Service: OEG and operator tooling reach it inside the
  # cluster, and publishing the EWBI Service above never publishes it.
  internalService:
    name: federation-manager-internal
    port: 8083
    targetPort: 8083

  resources: {}

  database:
Loading