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

add basic sample app that works w/ project admin #34

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/sample-applications/default_sc.yaml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be renamed to something that more obviously hints about the contents? I'm not sure what "SC" would stand for in this context.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why 2 separated files?

Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql
namespace: mysql-persistent
labels:
app: mysql
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
182 changes: 182 additions & 0 deletions test/sample-applications/mysql-persistent-csi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
apiVersion: v1
kind: List
items:
- kind: Namespace
apiVersion: v1
metadata:
name: mysql-persistent
labels:
app: mysql
- apiVersion: v1
kind: ServiceAccount
metadata:
name: mysql-persistent-sa
namespace: mysql-persistent
labels:
component: mysql-persistent
- kind: SecurityContextConstraints
apiVersion: security.openshift.io/v1
metadata:
name: mysql-persistent-scc
allowPrivilegeEscalation: false
allowPrivilegedContainer: false
volumes:
- '*'
users:
- system: nacuser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if created user has different name, it will work? (should this have space between : ?)

- system:serviceaccount:mysql-persistent:mysql-persistent-sa
- apiVersion: v1
kind: Service
metadata:
annotations:
template.openshift.io/expose-uri: mariadb://{.spec.clusterIP}:{.spec.ports[?(.name=="mysql")].port}
name: mysql
namespace: mysql-persistent
labels:
app: mysql
service: mysql
spec:
ports:
- protocol: TCP
name: mysql
port: 3306
selector:
app: mysql
- apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
template.alpha.openshift.io/wait-for-ready: 'true'
name: mysql
namespace: mysql-persistent
labels:
e2e-app: "true"
spec:
selector:
matchLabels:
app: mysql
strategy:
type: Recreate
template:
metadata:
labels:
e2e-app: "true"
app: mysql
curl-tool: "true"
spec:
serviceAccountName: mysql-persistent-sa
containers:
- image: registry.redhat.io/rhel8/mariadb-105:latest
name: mysql
env:
- name: MYSQL_USER
value: changeme
- name: MYSQL_PASSWORD
value: changeme
- name: MYSQL_ROOT_PASSWORD
value: root
- name: MYSQL_DATABASE
value: todolist
ports:
- containerPort: 3306
name: mysql
resources:
limits:
memory: 512Mi
volumeMounts:
- name: mysql-data
mountPath: /var/lib/mysql
livenessProbe:
tcpSocket:
port: mysql
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
startupProbe:
exec:
command:
- /usr/bin/timeout
- 1s
- /usr/bin/mysql
- $(MYSQL_DATABASE)
- -h
- 127.0.0.1
- -u$(MYSQL_USER)
- -p$(MYSQL_PASSWORD)
- -e EXIT
initialDelaySeconds: 5
periodSeconds: 30
timeoutSeconds: 2
successThreshold: 1
failureThreshold: 40 # 40x30sec before restart pod
restartPolicy: Always
- image: docker.io/curlimages/curl:8.5.0
name: curl-tool
command: ["/bin/sleep", "infinity"]
volumes:
- name: mysql-data
persistentVolumeClaim:
claimName: mysql
- apiVersion: v1
kind: Service
metadata:
name: todolist
namespace: mysql-persistent
labels:
app: todolist
service: todolist
e2e-app: "true"
spec:
ports:
- name: web
port: 8000
targetPort: 8000
selector:
app: todolist
service: todolist
- apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: todolist
namespace: mysql-persistent
labels:
app: todolist
service: todolist
e2e-app: "true"
spec:
replicas: 1
selector:
app: todolist
service: todolist
strategy:
type: Recreate
template:
metadata:
labels:
app: todolist
service: todolist
e2e-app: "true"
spec:
containers:
- name: todolist
image: quay.io/migtools/oadp-ci-todolist-mariadb-go:latest
env:
- name: foo
value: bar
ports:
- containerPort: 8000
protocol: TCP
initContainers:
- name: init-myservice
image: docker.io/curlimages/curl:8.5.0
command: ['sh', '-c', 'sleep 10; until /usr/bin/nc -z -w 1 mysql 3306; do echo Trying to connect to mysql DB port; sleep 5; done; echo mysql DB port reachable']
- apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: todolist-route
namespace: mysql-persistent
spec:
path: "/"
to:
kind: Service
name: todolist