Skip to content

Commit

Permalink
orion-ld adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
wistefan committed Sep 25, 2023
1 parent 01a62c2 commit 49cf9b0
Show file tree
Hide file tree
Showing 10 changed files with 492 additions and 1 deletion.
20 changes: 20 additions & 0 deletions aws/apps/dome/consumer/orion-ld-adapter.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: dome-consumer-orion-ld-adapter
namespace: argocd
labels:
participant: consumer
spec:
destination:
namespace: dome
server: https://kubernetes.default.svc
project: default
source:
path: aws/dome/consumer/connector/orion-ld-adapter
repoURL: https://github.com/FIWARE-Ops/fiware-gitops
targetRevision: HEAD
syncPolicy:
automated:
prune: true
selfHeal: true
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ orion:
subscription:
type: Subscription
notificationEndpoint: http://dome-consumer-blockchain-connector-core:8080/notifications/orion-ld
entities: ProductOrder, ProductOffering
entities: product-order, product-offering
prefix: "urn:ngsi-ld:Subscription:"
adapter:
host: http://dome-consumer-dlt-adapter:8080
Expand Down
7 changes: 7 additions & 0 deletions aws/dome/consumer/connector/orionld-adapter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v2
name: orionld-adapter
description: A Helm chart for Orion-LD Adapter Kubernetes

type: application
version: 0.0.1
appVersion: v1alpha1
74 changes: 74 additions & 0 deletions aws/dome/consumer/connector/orionld-adapter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "orionldadapter.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
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 "orionldadapter.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "orionldadapter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create the name of the service account to use
*/}}
{{- define "orionldadapter.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{ default (include "orionldadapter.fullname" .) .Values.serviceAccount.name }}
{{- else -}}
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "orionldadapter.labels" -}}
app.kubernetes.io/name: {{ include "orionldadapter.name" . }}
helm.sh/chart: {{ include "orionldadapter.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end -}}

{{/*
Support for existing database secret
*/}}
{{- define "orionldadapter.secretName" -}}
{{- if .Values.database.existingSecret.enabled -}}
{{- printf "%s" (tpl .Values.database.existingSecret.name $) -}}
{{- else -}}
{{- printf "%s" (include "orionldadapter.fullname" .) -}}
{{- end -}}
{{- end -}}

{{- define "orionldadapter.passwordKey" -}}
{{- if .Values.database.existingSecret.enabled -}}
{{- printf "%s" (tpl .Values.database.existingSecret.key $) -}}
{{- else -}}
{{- printf "password" -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "orionldadapter.fullname" . }}
data:
custom-config.yml: |
orion-ld-if:
orion-ld:
domain: {{ .Values.orion.address }}
path:
entities: {{ .Values.orion.entitiesPath }}
subscriptions: {{ .Values.orion.subscriptionPath }}
api:
domain: {{ .Values.adapter.host }}
path:
subscription: {{ .Values.adapter.subscriptionPath }}
entities: {{ .Values.adapter.publishPath }}
subscription:
type: {{ .Values.orion.subscription.type }}
notification-endpoint-uri: {{ .Values.orion.subscription.notificationEndpoint }}
entities: >
{{ .Values.orion.subscription.entities }}
id-prefix: {{ .Values.orion.subscription.prefix | quote }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.autoscaling.enabled -}}
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "orionldadapter.fullname" . }}
labels:
{{ include "orionldadapter.labels" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "orionldadapter.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
{{- with .Values.autoscaling.metrics }}
metrics:
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "orionldadapter.fullname" . }}
labels:
{{ include "orionldadapter.labels" . | nindent 4 }}
namespace: default
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.deployment.replicaCount }}
{{- end }}
revisionHistoryLimit: {{ .Values.deployment.revisionHistoryLimit }}
strategy:
{{- with .Values.deployment.updateStrategy }}
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "orionldadapter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
{{ include "orionldadapter.labels" . | nindent 8 }}
{{- with .Values.deployment.additionalLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.deployment.additionalAnnotations -}}
annotations:
prometheus.io/scrape: {{ .Values.prometheus.enabled | quote }}
prometheus.io/path: {{ .Values.prometheus.path }}
prometheus.io/port: {{ .Values.prometheus.port }}
{{- with .Values.deployment.additionalAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
spec:
serviceAccountName: {{ include "orionldadapter.serviceAccountName" . }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.deployment.image.repository }}:{{ .Values.deployment.image.tag }}"
imagePullPolicy: {{ .Values.deployment.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.port}}
protocol: TCP
- name: http-health
containerPort: {{ .Values.deployment.healthPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /health
port: http-health
initialDelaySeconds: {{ .Values.deployment.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.deployment.livenessProbe.periodSeconds }}
successThreshold: {{ .Values.deployment.livenessProbe.successThreshold }}
timeoutSeconds: {{ .Values.deployment.livenessProbe.timeoutSeconds }}
readinessProbe:
httpGet:
path: /health
port: http-health
initialDelaySeconds: {{ .Values.deployment.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.deployment.readinessProbe.periodSeconds }}
successThreshold: {{ .Values.deployment.readinessProbe.successThreshold }}
timeoutSeconds: {{ .Values.deployment.readinessProbe.timeoutSeconds }}
env:
- name: SPRING_PROFILES_ACTIVE
value: dev
- name: SPRING_CONFIG_IMPORT
value: "/src/main/resources/custom-config.yml"
volumeMounts:
- name: config-volume
mountPath: "/src/main/resources/"
readOnly: true
resources:
{{- toYaml .Values.deployment.resources | nindent 12 }}
volumes:
- name: config-volume
configMap:
name: orionld-adapter-configmap
{{- with .Values.deployment.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.deployment.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.deployment.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
restartPolicy: Always
21 changes: 21 additions & 0 deletions aws/dome/consumer/connector/orionld-adapter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "orionldadapter.fullname" . }}
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | nindent 4 }}
{{- end }}
labels:
{{ include "orionldadapter.labels" . | nindent 4 }}
namespace: default
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.port }}
protocol: TCP
name: http
selector:
app.kubernetes.io/name: {{ include "orionldadapter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "orionldadapter.fullname" . }}
{{- if .Values.serviceAccount.annotations }}
annotations:
{{ toYaml .Values.serviceAccount.annotations | nindent 4 }}
{{- end }}
labels:
{{ include "orionldadapter.labels" . | nindent 4 }}
{{- end }}
Loading

0 comments on commit 49cf9b0

Please sign in to comment.