Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Add test for openshift apply bug #94

Merged
merged 1 commit into from
May 21, 2020
Merged
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
48 changes: 46 additions & 2 deletions molecule/default/tasks/apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,44 @@
- containerPort: 8080
name: http
protocol: TCP
k8s_pod_resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 100m
memory: 100Mi

- name: Update the earlier deployment
k8s:
definition:
apiVersion: apps/v1
kind: Deployment
metadata:
name: apply-deploy
namespace: "{{ apply_namespace }}"
spec:
replicas: 1
selector:
matchLabels:
app: "{{ k8s_pod_name }}"
template: "{{ k8s_pod_template }}"
wait: yes
apply: yes
vars:
k8s_pod_name: apply-deploy
k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-purple
k8s_pod_service_account: apply-deploy
k8s_pod_ports:
- containerPort: 8080
name: http
protocol: TCP
k8s_pod_resources:
requests:
cpu: 50m
limits:
cpu: 50m
memory: 50Mi

- name: Remove the serviceaccount
k8s:
Expand All @@ -327,7 +365,7 @@
name: apply-deploy
namespace: "{{ apply_namespace }}"

- name: Update the earlier deployment
- name: Apply deployment after service account removed
k8s:
definition:
apiVersion: apps/v1
Expand All @@ -345,12 +383,18 @@
apply: yes
vars:
k8s_pod_name: apply-deploy
k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-purple
k8s_pod_image: gcr.io/kuar-demo/kuard-amd64:v0.10.0-green
k8s_pod_service_account: apply-deploy
k8s_pod_ports:
- containerPort: 8080
name: http
protocol: TCP
k8s_pod_resources:
requests:
cpu: 50m
limits:
cpu: 50m
memory: 50Mi
register: deploy_after_serviceaccount_removal
ignore_errors: yes

Expand Down
6 changes: 6 additions & 0 deletions molecule/default/tasks/waiter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@
protocol: TCP
register: update_deploy

# It looks like the Deployment is updated to have the desired state *before* the pods are terminated
# Wait a couple of seconds to allow the old pods to at least get to Terminating state
- name: Avoid race condition
pause:
seconds: 2

- name: Get updated pods
k8s_info:
api_version: v1
Expand Down
11 changes: 7 additions & 4 deletions molecule/default/vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ k8s_pod_spec:
exec:
command:
- /bin/true
resources:
limits:
cpu: "100m"
memory: "100Mi"
resources: "{{ k8s_pod_resources }}"
ports: "{{ k8s_pod_ports }}"


k8s_pod_service_account: default

k8s_pod_resources:
limits:
cpu: "100m"
memory: "100Mi"

k8s_pod_command: []

k8s_pod_ports: []
Expand Down