Add a tiny app to get the list of recently changed users in FAS

There is unfortunately no other way to get that info, apparently.

Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
This commit is contained in:
Aurélien Bompard 2021-02-05 17:24:04 +01:00
parent 6606399bbc
commit 6a674f5814
No known key found for this signature in database
GPG key ID: 31584CFEB9BF64AD
6 changed files with 178 additions and 0 deletions

View file

@ -0,0 +1,53 @@
- name: make the app be real
hosts: os_masters[0]
user: root
gather_facts: False
vars_files:
- /srv/web/infra/ansible/vars/global.yml
- "/srv/private/ansible/vars.yml"
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
vars:
roles:
- role: openshift/project
app: fas-changes
description: "Get last changed users in FAS"
appowners:
- abompard
tags:
- apply-appowners
- role: openshift/imagestream
app: fas-changes
imagename: fas-changes
- role: openshift/object
app: fas-changes
template: buildconfig.yml
objectname: buildconfig.yml
- role: openshift/object
app: fas-changes
template: configmap.yml
objectname: configmap.yml
- role: openshift/object
app: fas-changes
file: service.yml
objectname: service.yml
- role: openshift/route
app: fas-changes
routename: fas-changes
host: "fas-changes.app.os{{ env_suffix }}.fedoraproject.org"
serviceport: web
servicename: fas-changes
annotations:
haproxy.router.openshift.io/timeout: 5m
- role: openshift/object
app: fas-changes
template: deploymentconfig.yml
objectname: deploymentconfig.yml

View file

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: fas-changes
labels:
app: fas-changes
spec:
ports:
- name: web
port: 8080
targetPort: 8080
selector:
app: fas-changes
deploymentconfig: fas-changes

View file

@ -0,0 +1,29 @@
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: fas-changes
labels:
app: fas-changes
build: fas-changes
spec:
runPolicy: Serial
source:
type: Git
git:
uri: https://github.com/abompard/fas-changes.git
ref: main
contextDir: /
strategy:
type: Source
sourceStrategy:
from:
kind: ImageStreamTag
name: python:3.6
namespace: openshift
output:
to:
kind: ImageStreamTag
name: fas-changes:latest
triggers:
- type: ConfigChange
- type: ImageChange

View file

@ -0,0 +1,8 @@
#
# This is the config file for FAS Changes as intended to be used in OpenShift
#
DB_NAME = "fas2"
DB_HOST = "db-fas{{ env_suffix }}"
DB_USER = "fasreadonly"
DB_PASSWORD = "{{ fas_db_readonly_password }}"

View file

@ -0,0 +1,15 @@
{% macro load_file(filename) %}{% include filename %}{%- endmacro -%}
---
apiVersion: v1
kind: List
metadata: {}
items:
- apiVersion: v1
kind: ConfigMap
metadata:
name: fas-changes-config
labels:
app: fas-changes
data:
fas-changes.cfg: |-
{{ load_file('config.py') | indent(6) }}

View file

@ -0,0 +1,59 @@
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: fas-changes
labels:
app: fas-changes
spec:
replicas: 1
selector:
app: fas-changes
deploymentconfig: fas-changes
strategy:
type: Rolling
activeDeadlineSeconds: 21600
rollingParams:
intervalSeconds: 1
maxSurge: 25%
maxUnavailable: 25%
timeoutSeconds: 600
updatePeriodSeconds: 1
template:
metadata:
creationTimestamp: null
labels:
app: fas-changes
deploymentconfig: fas-changes
spec:
containers:
- name: fas-changes
imagePullPolicy: Always
ports:
- containerPort: 8080
#protocol: TCP
#resources: {}
#terminationMessagePath: /dev/termination-log
#terminationMessagePolicy: File
volumeMounts:
- name: fas-changes-config-volume
mountPath: "/etc/fas-changes"
readOnly: true
env:
- name: FLASK_SETTINGS
value: "/etc/fas-changes/fas-changes.cfg"
# - name: SCRIPT_NAME
# value: "/fas-changes"
volumes:
- name: fas-changes-config-volume
configMap:
name: fas-changes-config
triggers:
- imageChangeParams:
automatic: true
containerNames:
- fas-changes
from:
kind: ImageStreamTag
name: fas-changes:latest
type: ImageChange
- type: ConfigChange