Skip to content

Commit

Permalink
♻️ Rename the FHIR access proxy to the fhir gateway (#25)
Browse files Browse the repository at this point in the history
* ♻️ Rename the FHIR Access proxy to the FHIR Gateway
* Fix Build 💚

---------

Co-authored-by: Martin Ndegwa <[email protected]>
  • Loading branch information
dubdabasoduba and ndegwamartin authored Apr 25, 2023
1 parent e0d6b65 commit d92aebe
Show file tree
Hide file tree
Showing 29 changed files with 98 additions and 274 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
id: docker_meta
uses: docker/metadata-action@v4
with:
images: opensrp/fhir-access-proxy
images: opensrp/fhir-gateway

- name: Login to DockerHub
uses: docker/login-action@v2
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

# Image for building and running tests against the source code of
# the FHIR Access Proxy.
# the FHIR Gateway.
FROM maven:3.8.5-openjdk-11 as build

RUN apt-get update && apt-get install -y nodejs npm
Expand All @@ -37,7 +37,7 @@ RUN mvn spotless:check
RUN mvn --batch-mode package -Pstandalone-app -Dlicense.skip=true


# Image for FHIR Access Proxy binary with configuration knobs as environment vars.
# Image for FHIR Gateway binary with configuration knobs as environment vars.
FROM eclipse-temurin:11-jdk-focal as main

COPY --from=build /app/exec/target/exec-0.1.1.jar /
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ The proxy is also available as a [docker image](Dockerfile):
```shell
$ docker run -p 8081:8080 -e TOKEN_ISSUER=[token_issuer_url] \
-e PROXY_TO=[fhir_server_url] -e ACCESS_CHECKER=list \
us-docker.pkg.dev/fhir-proxy-build/stable/fhir-access-proxy:latest
us-docker.pkg.dev/fhir-proxy-build/stable/fhir-gateway:latest
```

Note if the `TOKEN_ISSUER` is on the `localhost` you may need to bypass proxy's
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ set -e
export BUILD_ID=${KOKORO_BUILD_ID:-local}
gcloud auth configure-docker us-docker.pkg.dev
./e2e-test/e2e.sh
docker push us-docker.pkg.dev/fhir-proxy-build/stable/fhir-access-proxy:${BUILD_ID}
docker push us-docker.pkg.dev/fhir-proxy-build/stable/fhir-gateway:${BUILD_ID}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

apiVersion: v2
name: fhir-access-proxy
name: fhir-gateway
description: |
This is a simple access-control proxy that sits in front of a
[FHIR](https://www.hl7.org/fhir/) store (e.g., a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# FHIR Access Proxy
# FHIR Gateway

[FHIR Access Proxy](../../README.md) is a simple access-control proxy that sits
in front of FHIR store and server and controls access to FHIR resources.
[FHIR Gateway](../../README.md) is a simple access-control proxy that sits in
front of FHIR store and server and controls access to FHIR resources.

## TL;DR

```bash
helm repo add opensrp-fhir-access-proxy https://fhir-access-proxy.helm.smartregister.org &&
helm install fhir-access-proxy opensrp-fhir-access-proxy/fhir-access-proxy
helm repo add opensrp-fhir-gateway https://fhir-gateway.helm.smartregister.org &&
helm install fhir-gateway opensrp-fhir-gateway/fhir-gateway
```

## Introduction

This chart bootstraps [fhir access proxy](../../README.md) deployment on a
This chart bootstraps [FHIR Gateway](../../README.md) deployment on a
[Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh)
package manager.

Expand All @@ -23,35 +23,35 @@ package manager.

## Installing the Chart

To install the chart with the release name `fhir-access-proxy`:
To install the chart with the release name `fhir-gateway`:

```shell
helm repo add opensrp-fhir-access-proxy https://fhir-access-proxy.helm.smartregister.org &&
helm install fhir-access-proxy opensrp-fhir-access-proxy/fhir-access-proxy
helm repo add opensrp-fhir-gateway https://fhir-gateway.helm.smartregister.org &&
helm install fhir-gateway opensrp-fhir-gateway/fhir-gateway
```

## Uninstalling the Chart

To uninstall/delete the `fhir-access-proxy` deployment:
To uninstall/delete the `fhir-gateway` deployment:

```shell
helm delete fhir-access-proxy
helm delete fhir-gateway
```

The command removes all the Kubernetes components associated with the chart and
deletes the release.

## Parameters

The following table lists the configurable parameters of the fhir access proxy
chart and their default values.
The following table lists the configurable parameters of the FHIR Gateway chart
and their default values.

## Common Parameters

| Parameter | Description | Default |
| -------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `replicaCount` | | `1` |
| `image.repository` | | `"opensrp/fhir-access-proxy"` |
| `image.repository` | | `"opensrp/fhir-gateway"` |
| `image.pullPolicy` | | `"IfNotPresent"` |
| `image.tag` | | `"latest"` |
| `imagePullSecrets` | | `[]` |
Expand All @@ -68,7 +68,7 @@ chart and their default values.
| `ingress.enabled` | | `false` |
| `ingress.className` | | `""` |
| `ingress.annotations` | | `{}` |
| `ingress.hosts` | | `[{"host": "fhir-access-proxy.local", "paths": [{"path": "/", "pathType": "ImplementationSpecific"}]}]` |
| `ingress.hosts` | | `[{"host": "fhir-gateway.local", "paths": [{"path": "/", "pathType": "ImplementationSpecific"}]}]` |
| `ingress.tls` | | `[]` |
| `resources` | | `{}` |
| `autoscaling.enabled` | | `false` |
Expand Down Expand Up @@ -130,15 +130,14 @@ file).
2. Create a configmap volume type:
- The name of the configMap resemble the ConfigMap manifest metadata.name
i.e. `fhir-access-proxy` but we obtain the generated name from the
function `'{{ include "fhir-access-proxy.fullname" . }}'` using tpl
function.
i.e. `fhir-gateway` but we obtain the generated name from the function
`'{{ include "fhir-gateway.fullname" . }}'` using tpl function.

```yaml
volumes:
- name: hapi-page-url-allowed-queries
configMap:
name: '{{ include "fhir-access-proxy.fullname" . }}'
name: '{{ include "fhir-gateway.fullname" . }}'
```

3. Mount the Configmap volume:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "fhir-access-proxy.fullname" . }})
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "fhir-gateway.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "fhir-access-proxy.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "fhir-access-proxy.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "fhir-gateway.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "fhir-gateway.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "fhir-access-proxy.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "fhir-gateway.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "fhir-access-proxy.name" -}}
{{- define "fhir-gateway.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "fhir-access-proxy.fullname" -}}
{{- define "fhir-gateway.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "fhir-access-proxy.chart" -}}
{{- define "fhir-gateway.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "fhir-access-proxy.labels" -}}
helm.sh/chart: {{ include "fhir-access-proxy.chart" . }}
{{ include "fhir-access-proxy.selectorLabels" . }}
{{- define "fhir-gateway.labels" -}}
helm.sh/chart: {{ include "fhir-gateway.chart" . }}
{{ include "fhir-gateway.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
Expand All @@ -45,17 +45,17 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "fhir-access-proxy.selectorLabels" -}}
app.kubernetes.io/name: {{ include "fhir-access-proxy.name" . }}
{{- define "fhir-gateway.selectorLabels" -}}
app.kubernetes.io/name: {{ include "fhir-gateway.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "fhir-access-proxy.serviceAccountName" -}}
{{- define "fhir-gateway.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "fhir-access-proxy.fullname" .) .Values.serviceAccount.name }}
{{- default (include "fhir-gateway.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
Expand All @@ -64,7 +64,7 @@ Create the name of the service account to use
{{/*
Populate the pod annotations
*/}}
{{- define "fhir-access-proxy.podAnnotations" -}}
{{- define "fhir-gateway.podAnnotations" -}}
{{- range $index, $element:=.Values.podAnnotations }}
{{ $index }}: {{ $element | quote }}
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "fhir-access-proxy.fullname" . }}
name: {{ include "fhir-gateway.fullname" . }}
labels:
{{- include "fhir-access-proxy.labels" . | nindent 4 }}
{{- include "fhir-gateway.labels" . | nindent 4 }}
data:
{{ range $value := .Values.configMaps -}}
{{ $value.name }}: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fhir-access-proxy.fullname" . }}
name: {{ include "fhir-gateway.fullname" . }}
labels:
{{- include "fhir-access-proxy.labels" . | nindent 4 }}
{{- include "fhir-gateway.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "fhir-access-proxy.selectorLabels" . | nindent 6 }}
{{- include "fhir-gateway.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- include "fhir-access-proxy.podAnnotations" . | indent 8 }}
{{- include "fhir-gateway.podAnnotations" . | indent 8 }}
labels:
{{- include "fhir-access-proxy.selectorLabels" . | nindent 8 }}
{{- include "fhir-gateway.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "fhir-access-proxy.serviceAccountName" . }}
serviceAccountName: {{ include "fhir-gateway.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
volumes:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "fhir-access-proxy.fullname" . }}
name: {{ include "fhir-gateway.fullname" . }}
labels:
{{- include "fhir-access-proxy.labels" . | nindent 4 }}
{{- include "fhir-gateway.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "fhir-access-proxy.fullname" . }}
name: {{ include "fhir-gateway.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


{{ if .Values.ingress.enabled -}}
{{- $fullName := include "fhir-access-proxy.fullname" . -}}
{{- $fullName := include "fhir-gateway.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
Expand All @@ -34,7 +34,7 @@ kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "fhir-access-proxy.labels" . | nindent 4 }}
{{- include "fhir-gateway.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ apiVersion: "policy/v1"
{{- end }}
kind: PodDisruptionBudget
metadata:
name: {{ include "fhir-access-proxy.fullname" . }}
name: {{ include "fhir-gateway.fullname" . }}
labels:
{{- include "fhir-access-proxy.labels" . | nindent 4 }}
{{- include "fhir-gateway.labels" . | nindent 4 }}
spec:
{{- if .Values.pdb.minAvailable }}
minAvailable: {{ .Values.pdb.minAvailable }}
Expand All @@ -34,5 +34,5 @@ spec:
{{- end }}
selector:
matchLabels:
{{- include "fhir-access-proxy.selectorLabels" . | nindent 6 }}
{{- include "fhir-gateway.selectorLabels" . | nindent 6 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "fhir-access-proxy.fullname" . }}
name: {{ include "fhir-gateway.fullname" . }}
labels:
{{- include "fhir-access-proxy.labels" . | nindent 4 }}
{{- include "fhir-gateway.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
Expand All @@ -28,4 +28,4 @@ spec:
protocol: TCP
name: http
selector:
{{- include "fhir-access-proxy.selectorLabels" . | nindent 4 }}
{{- include "fhir-gateway.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "fhir-access-proxy.serviceAccountName" . }}
name: {{ include "fhir-gateway.serviceAccountName" . }}
labels:
{{- include "fhir-access-proxy.labels" . | nindent 4 }}
{{- include "fhir-gateway.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
apiVersion: v1
kind: Pod
metadata:
name: "{{ include "fhir-access-proxy.fullname" . }}-test-connection"
name: "{{ include "fhir-gateway.fullname" . }}-test-connection"
labels:
{{- include "fhir-access-proxy.labels" . | nindent 4 }}
{{- include "fhir-gateway.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['{{ include "fhir-access-proxy.fullname" . }}:{{ .Values.service.port }}']
args: ['{{ include "fhir-gateway.fullname" . }}:{{ .Values.service.port }}']
restartPolicy: Never
Loading

0 comments on commit d92aebe

Please sign in to comment.