Skip to content

Commit

Permalink
Onboarding to app-interface
Browse files Browse the repository at this point in the history
Signed-off-by: Amador Pahim <apahim@redhat.com>
  • Loading branch information
apahim committed Jul 8, 2020
1 parent d71e774 commit 4adc5be
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Dockerfile.test
@@ -0,0 +1,9 @@
FROM golang:1.14.3

ENV GO111MODULE=on

ENTRYPOINT ["go"]
CMD ["test,
"-v",
"$(or ${TEST}, ${TEST}, $(shell go list ./... | grep -v subsystem))",
"-cover"]
32 changes: 32 additions & 0 deletions build_deploy.sh
@@ -0,0 +1,32 @@
#!/bin/bash

TAG=$(git rev-parse --short=7 HEAD)

BM_INVENTORY_IMAGE="quay.io/app-sre/bm-inventory"

docker build -t "${BM_INVENTORY_IMAGE}:latest" -f Dockerfile.bm-inventory .
docker tag "${BM_INVENTORY_IMAGE}:latest" "${BM_INVENTORY_IMAGE}:${TAG}"

BM_INVENTORY_BUILD_IMAGE="quay.io/app-sre/bm-inventory-build"

docker build -t "${BM_INVENTORY_BUILD_IMAGE}:latest" -f Dockerfile.bm-inventory-build .
docker tag "${BM_INVENTORY_BUILD_IMAGE}:latest" "${BM_INVENTORY_BUILD_IMAGE}:${TAG}"

OBJ_EXPIRER_IMAGE="quay.io/app-sre/s3-object-expirer"

docker build -t "${OBJ_EXPIRER_IMAGE}:latest" -f Dockerfile.s3-object-expirer .
docker tag "${OBJ_EXPIRER_IMAGE}:latest" "${OBJ_EXPIRER_IMAGE}:${TAG}"


DOCKER_CONF="${PWD}/.docker"
mkdir -p "${DOCKER_CONF}"
docker --config="${DOCKER_CONF}" login -u="${QUAY_USER}" -p="${QUAY_TOKEN}" quay.io

docker --config="${DOCKER_CONF}" push "${BM_INVENTORY_IMAGE}:latest"
docker --config="${DOCKER_CONF}" push "${BM_INVENTORY_IMAGE}:${TAG}"

docker --config="${DOCKER_CONF}" push "${BM_INVENTORY_BUILD_IMAGE}:latest"
docker --config="${DOCKER_CONF}" push "${BM_INVENTORY_BUILD_IMAGE}:${TAG}"

docker --config="${DOCKER_CONF}" push "${OBJ_EXPIRER_IMAGE}:latest"
docker --config="${DOCKER_CONF}" push "${OBJ_EXPIRER_IMAGE}:${TAG}"
110 changes: 110 additions & 0 deletions openshift/template.yaml
@@ -0,0 +1,110 @@
---
parameters:
- name: BM_INVENTORY_IMAGE
value: quay.io/app-sre/bm-inventory
- name: BM_INVENTORY_IMAGE_TAG
value: latest
- name: OBJ_EXPIRER_IMAGE
value: quay.io/ocpmetal/s3-object-expirer
- name: OBJ_EXPIRER_IMAGE_TAG
value: latest
apiVersion: v1
kind: Template
metadata:
name: assisted-installer
objects:
- apiVersion: apps/v1
kind: Deployment
metadata:
name: bm-inventory
namespace: assisted-installer
spec:
selector:
matchLabels:
app: bm-inventory
replicas: 1
template:
metadata:
labels:
app: bm-inventory
spec:
containers:
- name: bm-inventory
image: ${BM_INVENTORY_IMAGE}:${BM_INVENTORY_IMAGE_TAG}
imagePullPolicy: Always
resources:
limits:
cpu: 200m
memory: 500Mi
requests:
cpu: 100m
memory: 400Mi
ports:
- name: bm-inventory
containerPort: 8090
env:
- name: ROUTE53_CREDS
valueFrom:
secretKeyRef:
key: creds
name: route53-creds
- name: AWS_SECRET_ACCESS_KEY
valueFrom:
secretKeyRef:
key: aws_secret_access_key
name: assisted-installer-s3
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
key: aws_access_key_id
name: assisted-installer-s3
- name: AWS_REGION
valueFrom:
secretKeyRef:
key: aws_region
name: assisted-installer-s3
- name: BUCKET
valueFrom:
secretKeyRef:
key: bucket
name: assisted-installer-s3
- name: ENDPOINT
valueFrom:
secretKeyRef:
key: endpoint
name: assisted-installer-s3
- name: IMAGE_BUILDER_CMD
value: ""
- apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: s3-object-expirer-cron-job
namespace: assisted-installer
spec:
schedule: "@hourly"
successfulJobsHistoryLimit: 0
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
spec:
containers:
- name: s3-object-expirer-job-pod
image: ${OBJ_EXPIRER_IMAGE}:${OBJ_EXPIRER_IMAGE_TAG}
imagePullPolicy: Always
envFrom:
- configMapRef:
name: s3-config
args:
- /bin/bash
- -c
- python ./expirer.py
resources:
limits:
cpu: 200m
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
restartPolicy: OnFailure
backoffLimit: 3
6 changes: 6 additions & 0 deletions pr_check.sh
@@ -0,0 +1,6 @@
#!/bin/bash

IMAGE_TEST=bm-inventory-test

docker build -t ${IMAGE_TEST} -f Dockerfile.test .
docker run --rm ${IMAGE_TEST}

0 comments on commit 4adc5be

Please sign in to comment.