-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #223 from tonytheleg/RHCLOUD-35930-add-db-cleaner
adds db-cleaner deploy files for db operation needs
- Loading branch information
Showing
2 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
apiVersion: template.openshift.io/v1 | ||
kind: Template | ||
metadata: | ||
name: inventory | ||
objects: | ||
- apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdApp | ||
metadata: | ||
name: kessel-inventory | ||
spec: | ||
envName: ${ENV_NAME} | ||
database: | ||
name: kessel-inventory | ||
optionalDependencies: | ||
- kessel-relations | ||
deployments: | ||
- name: api | ||
replicas: ${{REPLICAS}} | ||
podSpec: | ||
initContainers: | ||
- name: db-operations | ||
image: registry.redhat.io/rhel9/postgresql-15:1-54 | ||
command: ["/bin/sh", "-c"] | ||
args: | ||
- cd /tmp && curl -OL https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-amd64 && mv jq-linux-amd64 jq && chmod +x jq; | ||
export PGHOST=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.hostname'); | ||
export PGPORT=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.port'); | ||
export PGUSER=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.username'); | ||
export PGDATABASE=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.name'); | ||
export PGPASSWORD=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.password'); | ||
for i in local_inventory_to_resources relationship_history relationships resource_history resources; | ||
do psql -c "DROP TABLE $i"; | ||
done; | ||
inheritEnv: true | ||
- name: migration | ||
image: ${INVENTORY_IMAGE}:${IMAGE_TAG} | ||
command: ["inventory-api"] | ||
args: ["migrate"] | ||
inheritEnv: true | ||
image: ${INVENTORY_IMAGE}:${IMAGE_TAG} | ||
command: ["inventory-api"] | ||
args: ["serve"] | ||
livenessProbe: | ||
httpGet: | ||
path: /api/inventory/v1/livez | ||
port: 8000 | ||
readinessProbe: | ||
httpGet: | ||
path: /api/inventory/v1/readyz | ||
port: 8000 | ||
env: | ||
- name: CLOWDER_ENABLED | ||
value: "true" | ||
- name: INVENTORY_API_CONFIG | ||
value: "/inventory/inventory-api-config.yaml" | ||
- name: PGDATA | ||
value: /temp/data | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: "/inventory" | ||
volumes: | ||
- name: config-volume | ||
secret: | ||
secretName: inventory-api-config | ||
webServices: | ||
public: | ||
enabled: true | ||
apiPath: inventory | ||
- kind: PodDisruptionBudget | ||
apiVersion: policy/v1 | ||
metadata: | ||
name: kessel-inventory-api-pdb | ||
spec: | ||
minAvailable: 1 | ||
selector: | ||
matchLabels: | ||
app: kessel-inventory | ||
parameters: | ||
- description: ClowdEnvironment name (ephemeral, stage, prod) | ||
name: ENV_NAME | ||
required: true | ||
- description: App Image | ||
name: INVENTORY_IMAGE | ||
value: quay.io/redhat-services-prod/project-kessel-tenant/kessel-inventory/inventory-api | ||
- description: Image Tag | ||
name: IMAGE_TAG | ||
required: true | ||
value: latest | ||
- description: Number of replicas | ||
name: REPLICAS | ||
value: "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
apiVersion: template.openshift.io/v1 | ||
kind: Template | ||
metadata: | ||
name: inventory | ||
objects: | ||
- apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: inventory-api-config | ||
data: | ||
inventory-api-config.yaml: | | ||
authn: | ||
psk: | ||
pre-shared-key-file: /psks/psks.yaml | ||
authz: | ||
kessel: | ||
insecure-client: true | ||
enable-oidc-auth: false | ||
log: | ||
level: "info" | ||
- apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: psks | ||
data: | ||
psks.yaml: | | ||
"1234": | ||
tenant: "Example" | ||
principal: "[email protected]" | ||
is_reporter: true | ||
type: "REPORTER_TYPE_ACM" | ||
- apiVersion: cloud.redhat.com/v1alpha1 | ||
kind: ClowdApp | ||
metadata: | ||
name: kessel-inventory | ||
spec: | ||
envName: ${ENV_NAME} | ||
database: | ||
name: kessel-inventory | ||
optionalDependencies: | ||
- kessel-relations | ||
deployments: | ||
- name: api | ||
replicas: ${{REPLICAS}} | ||
podSpec: | ||
initContainers: | ||
- name: db-operations | ||
image: registry.redhat.io/rhel9/postgresql-15:1-54 | ||
command: ["/bin/sh", "-c"] | ||
args: | ||
- cd /tmp && curl -OL https://github.com/jqlang/jq/releases/download/jq-1.7/jq-linux-amd64 && mv jq-linux-amd64 jq && chmod +x jq; | ||
export PGHOST=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.hostname'); | ||
export PGPORT=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.port'); | ||
export PGUSER=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.username'); | ||
export PGDATABASE=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.name'); | ||
export PGPASSWORD=$(cat /cdapp/cdappconfig.json | ./jq -r '.database.password'); | ||
for i in local_inventory_to_resources relationship_history relationships resource_history resources; | ||
do psql -c "DROP TABLE $i"; | ||
done; | ||
inheritEnv: true | ||
- name: migration | ||
image: ${INVENTORY_IMAGE}:${IMAGE_TAG} | ||
command: ["inventory-api"] | ||
args: ["migrate"] | ||
inheritEnv: true | ||
image: ${INVENTORY_IMAGE}:${IMAGE_TAG} | ||
command: ["inventory-api"] | ||
args: ["serve"] | ||
livenessProbe: | ||
httpGet: | ||
path: /api/inventory/v1/livez | ||
port: 8000 | ||
readinessProbe: | ||
httpGet: | ||
path: /api/inventory/v1/readyz | ||
port: 8000 | ||
env: | ||
- name: CLOWDER_ENABLED | ||
value: "true" | ||
- name: INVENTORY_API_CONFIG | ||
value: "/inventory/inventory-api-config.yaml" | ||
- name: PGDATA | ||
value: /temp/data | ||
volumeMounts: | ||
- name: config-volume | ||
mountPath: "/inventory" | ||
- name: psks-volume | ||
mountPath: /psks | ||
volumes: | ||
- name: config-volume | ||
configMap: | ||
name: inventory-api-config | ||
- name: psks-volume | ||
configMap: | ||
name: psks | ||
webServices: | ||
public: | ||
enabled: true | ||
apiPath: inventory | ||
parameters: | ||
- description: ClowdEnvironment name (ephemeral, stage, prod) | ||
name: ENV_NAME | ||
required: true | ||
- description: App Image | ||
name: INVENTORY_IMAGE | ||
value: quay.io/redhat-services-prod/project-kessel-tenant/kessel-inventory/inventory-api | ||
- description: Image Tag | ||
name: IMAGE_TAG | ||
required: true | ||
value: latest | ||
- description: Number of replicas | ||
name: REPLICAS | ||
value: "1" |