Skip to content

Commit

Permalink
dc/echarging-ocpi: move driwe to new data collector from rest poller
Browse files Browse the repository at this point in the history
  • Loading branch information
clezag committed Nov 4, 2024
1 parent 16e17c2 commit e5129b3
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 19 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/dc-echarging-ocpi-driwe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI/CD dc-echarging-ocpi-driwe

on:
push:
paths:
- "collectors/echarging-ocpi/**"
- ".github/workflows/dc-echarging-ocpi-driwe.yml"

env:
WORKING_DIRECTORY: collectors/echarging-ocpi
DOCKER_IMAGE: ghcr.io/noi-techpark/opendatahub-collectors/dc-echarging-ocpi
DOCKER_TAG: ${{ github.sha }}
KUBERNETES_NAMESPACE: collector

jobs:
build:
runs-on: ubuntu-22.04
concurrency: dc-echarging-ocpi-driwe-build
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Build and push images
uses: noi-techpark/github-actions/docker-build-and-push@v2
with:
working-directory: ${{ env.WORKING_DIRECTORY }}/infrastructure
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}

deploy-test:
if: github.ref == 'refs/heads/main'
needs:
- build
runs-on: ubuntu-22.04
concurrency: dc-echarging-ocpi-driwe-deploy-test
environment: test
env:
VALUES_YAML: collectors/echarging-ocpi/infrastructure/helm/driwe.yaml
K8S_NAME: dc-echarging-ocpi-driwe
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Write environment-specific Helm values
run: |
cat <<EOF > override.yml
image:
repository: ${{ env.DOCKER_IMAGE }}
tag: ${{ env.DOCKER_TAG }}
pullPolicy: "IfNotPresent"
env:
LOGLEVEL: "INFO"
envSecret:
OCPI_TOKENS: ${{ secrets.ECHARGING_OCPI_NEOGY_TOKENS }}
PULL_LOCATIONS_ENDPOINT: "https://ocpi.driwe.club/2.2.1/locations?limit=200"
PULL_TOKEN: "${{ secrets.ECHARGING_NEOGY_OCPI_TOKEN_C }}"
EOF
# Merge yaml files https://mikefarah.gitbook.io/yq/operators/multiply-merge
yq -i '. *= load("override.yml")' ${{env.VALUES_YAML}}
- name: Deploy on cluster
uses: noi-techpark/github-actions/helm-deploy@v2
with:
k8s-name: ${{ env.K8S_NAME }}
k8s-namespace: collector
chart-path: helm/generic-collector
values-file: ${{ env.VALUES_YAML }}
aws-access-key-id: ${{ secrets.AWS_DEV_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEV_ACCESS_KEY_SECRET }}
aws-eks-cluster-name: aws-main-eu-01
aws-region: eu-west-1
49 changes: 49 additions & 0 deletions collectors/echarging-ocpi/infrastructure/helm/driwe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
image:
repository: ghcr.io/noi-techpark/opendatahub-collectors/dc-echarging-ocpi
pullPolicy: IfNotPresent
tag:

service:
enabled: true
type: ClusterIP
port: 8080
health:
delay: 10
path: /health

ingress:
enabled: true

annotations:
cert-manager.io/issuer: "letsencrypt-prod"

className: nginx
tls:
- hosts:
- ocpi-driwe.ex.dev.testingmachine.eu
secretName: tls-ocpi-driwe
hosts:
- host: ocpi-driwe.ex.dev.testingmachine.eu
paths:
- path: "/"
pathType: Prefix

env:
PORT: 8080
GIN_MODE: release
LOGLEVEL: DEBUG
RABBITMQ_EXCHANGE: ingress
# postfix is added to provides depending on the data source (push path, pull etc.)
PROVIDER: echarging-ocpi/driwe
PULL_LOCATIONS_CRON: "0 0,4,8,16 * * *"

envSecret:
# List of valid tokens, no spaces etc.
OCPI_TOKENS: ExampleToken1,ExampleToken2
PULL_LOCATIONS_ENDPOINT: https://testurl.com
PULL_TOKEN: "***"

envSecretRef:
- name: RABBITMQ_URI
secret: rabbitmq-svcbind
key: uri

This file was deleted.

0 comments on commit e5129b3

Please sign in to comment.