Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(5330): Moves the todo app to addons directory #5399

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions install/addons/syndesis-db-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
app: syndesis
syndesis.io/app: syndesis
syndesis.io/type: infrastructure
syndesis.io/addon: db-dashboard
spec:
name: syndesis-db.json
json: |
Expand Down
1 change: 1 addition & 0 deletions install/addons/syndesis-db-prometheus-rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
app: syndesis
syndesis.io/app: syndesis
syndesis.io/type: infrastructure
syndesis.io/addon: db-prometheus-rule
prometheus: application-monitoring
role: alert-rules
monitoring-key: middleware
Expand Down
1 change: 1 addition & 0 deletions install/addons/syndesis-db-servicemonitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
syndesis.io/app: syndesis
syndesis.io/component: syndesis-db-metrics
syndesis.io/type: infrastructure
syndesis.io/addon: db-service-monitor
monitoring-key: middleware
application-monitoring: "true"
name: syndesis-db-metrics
Expand Down
1 change: 1 addition & 0 deletions install/addons/syndesis-jvm-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
app: syndesis
syndesis.io/app: syndesis
syndesis.io/type: infrastructure
syndesis.io/addon: jvm-dashboard
spec:
name: syndesis-jvm.json
json: |
Expand Down
1 change: 1 addition & 0 deletions install/addons/syndesis-meta-servicemonitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
syndesis.io/app: syndesis
syndesis.io/component: syndesis-meta
syndesis.io/type: infrastructure
syndesis.io/addon: meta-service-monitor
monitoring-key: middleware
application-monitoring: "true"
name: syndesis-meta
Expand Down
1 change: 1 addition & 0 deletions install/addons/syndesis-rest-api-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
app: syndesis
syndesis.io/app: syndesis
syndesis.io/type: infrastructure
syndesis.io/addon: rest-api-dashboard
spec:
name: syndesis-rest-api.json
json: |
Expand Down
1 change: 1 addition & 0 deletions install/addons/syndesis-rest-api-prometheus-rule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ metadata:
app: syndesis
syndesis.io/app: syndesis
syndesis.io/type: infrastructure
syndesis.io/addon: rest-api-prometheus-rule
prometheus: application-monitoring
role: alert-rules
monitoring-key: middleware
Expand Down
66 changes: 66 additions & 0 deletions install/addons/syndesis-sampledb-1-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: syndesis
syndesis.io/app: syndesis
syndesis.io/type: infrastructure
syndesis.io/component: syndesis-db
syndesis.io/addon: db-sampledb
name: syndesis-sampledb-config
data:
add-sample-db.sh: |
#!/bin/bash
until bash -c "psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c 'SELECT 1'"; do
echo "Waiting for Postgres server..."
sleep 1
done
echo "***** creating sampledb"
psql <<EOF
CREATE DATABASE sampledb;
CREATE USER sampledb WITH PASSWORD '$POSTGRESQL_SAMPLEDB_PASSWORD';
GRANT ALL PRIVILEGES ON DATABASE sampledb to sampledb;
EOF
psql -d sampledb -U sampledb <<'EOF'
CREATE TABLE IF NOT EXISTS contact (first_name VARCHAR, last_name VARCHAR, company VARCHAR, lead_source VARCHAR, create_date DATE);
INSERT INTO contact VALUES ('Joe','Jackson','Red Hat','db',current_timestamp);
CREATE TABLE IF NOT EXISTS todo (id SERIAL PRIMARY KEY, task VARCHAR, completed INTEGER);
CREATE OR REPLACE FUNCTION add_lead(
first_and_last_name varchar,
company varchar,
phone varchar,
email varchar,
lead_source varchar,
lead_status varchar,
rating varchar)

RETURNS void
LANGUAGE 'plpgsql'

AS $BODY$
DECLARE
task varchar;
BEGIN
task := concat(lead_status || ' ', 'Lead: Please contact ', first_and_last_name, ' from ' || company, ' via phone: ' || phone, ' via email: ' || email, '. ', 'Lead is from ' || lead_source, '. Rating: ' || rating, '.');
insert into todo(task,completed) VALUES (task,0);
END;
$BODY$;

CREATE OR REPLACE FUNCTION create_lead(
OUT first_name text,
OUT last_name text,
OUT company text,
OUT lead_source text)
RETURNS SETOF record
AS
$$
SELECT first_name, last_name, company, lead_source
FROM contact;
$$
LANGUAGE 'sql' VOLATILE;
EOF

echo "***** sampledb created"
postStart.sh: |
#!/bin/bash
/var/lib/pgsql/sampledb/add-sample-db.sh &> /proc/1/fd/1
146 changes: 146 additions & 0 deletions install/addons/syndesis-sampledb-2-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: syndesis-db
labels:
app: syndesis
syndesis.io/app: syndesis
syndesis.io/type: infrastructure
syndesis.io/component: syndesis-db
syndesis.io/addon: db-sampledb
spec:
replicas: 1
selector:
app: syndesis
syndesis.io/app: syndesis
syndesis.io/component: syndesis-db
strategy:
type: Recreate
resources:
limits:
memory: "256Mi"
requests:
memory: "20Mi"
template:
metadata:
labels:
app: syndesis
syndesis.io/app: syndesis
syndesis.io/component: syndesis-db
spec:
serviceAccountName: syndesis-default
containers:
- capabilities: {}
env:
- name: POSTGRESQL_USER
value: ${POSTGRESQL_USER}
- name: POSTGRESQL_PASSWORD
value: ${POSTGRESQL_PASSWORD}
- name: POSTGRESQL_DATABASE
value: ${POSTGRESQL_DATABASE}
- name: POSTGRESQL_SAMPLEDB_PASSWORD
value: ${POSTGRESQL_SAMPLEDB_PASSWORD}
image: ' '
imagePullPolicy: IfNotPresent
lifecycle:
postStart:
exec:
command:
- /bin/sh
- -c
- /var/lib/pgsql/sampledb/postStart.sh
livenessProbe:
initialDelaySeconds: 60
tcpSocket:
port: 5432
name: postgresql
ports:
- containerPort: 5432
protocol: TCP
readinessProbe:
exec:
command:
- /bin/sh
- -i
- -c
- psql -h 127.0.0.1 -U $POSTGRESQL_USER -q -d $POSTGRESQL_DATABASE -c 'SELECT 1'
initialDelaySeconds: 5
# DB QoS class is "Guaranteed" (requests == limits)
# Note: On OSO there is no Guaranteed class, its always burstable
resources:
limits:
memory: ${POSTGRESQL_MEMORY_LIMIT}
requests:
memory: ${POSTGRESQL_MEMORY_LIMIT}
volumeMounts:
- mountPath: /var/lib/pgsql/data
name: syndesis-db-data
- mountPath: /var/lib/pgsql/sampledb
name: syndesis-sampledb-config
- mountPath: /opt/app-root/src/postgresql-cfg/
name: syndesis-db-conf
- capabilities: {}
env:
- name: DATA_SOURCE_NAME
value: postgresql://${POSTGRESQL_USER}:${POSTGRESQL_PASSWORD}@localhost:5432/syndesis?sslmode=disable
- name: PG_EXPORTER_EXTEND_QUERY_PATH
value: /etc/postgres/exporter/queries.yaml
image: ' '

imagePullPolicy: IfNotPresent
name: syndesis-db-metrics
livenessProbe:
failureThreshold: 5
tcpSocket:
port: 9187
initialDelaySeconds: 60
readinessProbe:
failureThreshold: 5
tcpSocket:
port: 9187
initialDelaySeconds: 30
ports:
- containerPort: 9187
name: metrics
resources:
limits:
memory: 256Mi
requests:
memory: 20Mi
volumeMounts:
- mountPath: /etc/postgres/exporter
name: syndesis-db-metrics-config
volumes:
- name: syndesis-db-metrics-config
configMap:
name: syndesis-db-metrics-config
- name: syndesis-db-data
persistentVolumeClaim:
claimName: syndesis-db
- configMap:
defaultMode: 511
name: syndesis-sampledb-config
name: syndesis-sampledb-config
- configMap:
name: syndesis-db-conf
name: syndesis-db-conf
triggers:
- type: ConfigChange
- imageChangeParams:
automatic: true
containerNames:
- postgresql
from:
kind: ImageStreamTag
name: postgresql:9.5
namespace: ${POSTGRESQL_IMAGE_STREAM_NAMESPACE}
type: ImageChange
- imageChangeParams:
automatic: true
containerNames:
- syndesis-db-metrics
from:
kind: ImageStreamTag
name: postgres_exporter:v0.4.7
namespace: ${IMAGE_STREAM_NAMESPACE}
type: ImageChange
1 change: 1 addition & 0 deletions install/addons/syndesis-server-servicemonitor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
syndesis.io/app: syndesis
syndesis.io/component: syndesis-server
syndesis.io/type: infrastructure
syndesis.io/addon: server-service-monitor
monitoring-key: middleware
application-monitoring: "true"
name: syndesis-server
Expand Down
18 changes: 18 additions & 0 deletions install/addons/syndesis-todo-1-service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: syndesis
syndesis.io/app: todo
syndesis.io/component: todo
syndesis.io/addon: todo
name: todo
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 8080
selector:
app: syndesis
syndesis.io/app: todo
syndesis.io/component: todo
21 changes: 21 additions & 0 deletions install/addons/syndesis-todo-2-route.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: route.openshift.io/v1
kind: Route
metadata:
labels:
app: syndesis
syndesis.io/app: todo
syndesis.io/component: todo
syndesis.io/addon: todo
name: todo
spec:
host: todo-${ROUTE_HOSTNAME}
path: /
port:
targetPort: 8080
tls:
insecureEdgeTerminationPolicy: Allow
termination: edge
to:
kind: Service
name: todo
weight: 100
15 changes: 15 additions & 0 deletions install/addons/syndesis-todo-3-imagestream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
labels:
app: syndesis
syndesis.io/app: todo
syndesis.io/addon: todo
name: todo
spec:
lookupPolicy:
local: false
status:
tags:
- items:
tag: latest
31 changes: 31 additions & 0 deletions install/addons/syndesis-todo-4-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
labels:
app: syndesis
syndesis.io/app: todo
syndesis.io/addon: todo
name: todo
spec:
postCommit: {}
resources: {}
runPolicy: Serial
source:
git:
uri: 'https://github.com/syndesisio/todo-example.git'
type: Git
output:
to:
kind: ImageStreamTag
name: 'todo:latest'
strategy:
sourceStrategy:
from:
kind: ImageStreamTag
name: 'php:7.0'
namespace: openshift
type: Source
triggers:
- type: ConfigChange
- imageChange:
type: ImageChange