Skip to content

Commit

Permalink
usage of configmaps to load configurations from files
Browse files Browse the repository at this point in the history
  • Loading branch information
Luscha committed Feb 24, 2025
1 parent ce0710f commit bec45dd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/dc-multi-rest-poller-mybestparking.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
env:
WORKING_DIRECTORY: collectors/multi-rest-poller
HTTP_CONFIG_PATH: infrastructure/calls_config/parking-mybestparking.yaml
CONFIGMAP_NAME: multi-rest-poller-parking-mybestparking-config
DOCKER_IMAGE: ghcr.io/noi-techpark/opendatahub-collectors/dc-multi-rest-poller
DOCKER_TAG: ${{ github.sha }}
KUBERNETES_NAMESPACE: collector
Expand Down Expand Up @@ -42,6 +43,24 @@ jobs:
- name: Checkout source code
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets[vars.AWS_KEY_ID] }}
aws-secret-access-key: ${{ secrets[vars.AWS_KEY_SECRET] }}
aws-region: eu-west-1

- name: Authenticate to AWS EKS
shell: bash
run: aws eks --region eu-west-1 update-kubeconfig --name aws-main-eu-01

- name: Create Kubernetes ConfigMap
run: |
kubectl create configmap ${{ env.CONFIGMAP_NAME }} \
--from-file=${{ env.HTTP_CONFIG_PATH }} \
--namespace=${{ env.KUBERNETES_NAMESPACE }} \
--dry-run=client -o yaml | kubectl apply -f -
- name: Customize values.yaml
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
Expand Down
6 changes: 3 additions & 3 deletions collectors/multi-rest-poller/infrastructure/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ EXPOSE 8080
FROM base AS build-env
WORKDIR /app
COPY src/ .
COPY infrastructure/ ./infrastructure
# COPY infrastructure/ ./infrastructure
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux go build -o main

Expand All @@ -20,10 +20,10 @@ ARG HTTP_CONFIG_PATH
WORKDIR /app

# Dynamically create the directory before copying the file
RUN mkdir -p "$(dirname /app/${HTTP_CONFIG_PATH})"
# RUN mkdir -p "$(dirname /app/${HTTP_CONFIG_PATH})"

COPY --from=build-env /app/main .
COPY --from=build-env /app/${HTTP_CONFIG_PATH} ${HTTP_CONFIG_PATH}
# COPY --from=build-env /app/${HTTP_CONFIG_PATH} ${HTTP_CONFIG_PATH}
ENTRYPOINT [ "./main"]

# LOCAL DEVELOPMENT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ envSecretRef:
- name: MQ_URI
secret: rabbitmq-svcbind
key: uri

configMaps:
- name: multi-rest-poller-parking-mybestparking-config
mountPath: infrastructure/calls_config/parking-mybestparking.yaml
subPath: parking-mybestparking.yaml

0 comments on commit bec45dd

Please sign in to comment.