Merge pull request #94 from willthames/apply_nested_dict

Add test for openshift apply bug
This commit is contained in:
Fabian von Feilitzsch
2020-05-21 15:41:21 -04:00
committed by GitHub
3 changed files with 67 additions and 14 deletions

View File

@@ -316,16 +316,13 @@
- containerPort: 8080
name: http
protocol: TCP
- name: Remove the serviceaccount
k8s:
state: absent
definition:
apiVersion: v1
kind: ServiceAccount
metadata:
name: apply-deploy
namespace: "{{ apply_namespace }}"
k8s_pod_resources:
requests:
cpu: 100m
memory: 100Mi
limits:
cpu: 100m
memory: 100Mi
- name: Update the earlier deployment
k8s:
@@ -351,6 +348,53 @@
- containerPort: 8080
name: http
protocol: TCP
k8s_pod_resources:
requests:
cpu: 50m
limits:
cpu: 50m
memory: 50Mi
- name: Remove the serviceaccount
k8s:
state: absent
definition:
apiVersion: v1
kind: ServiceAccount
metadata:
name: apply-deploy
namespace: "{{ apply_namespace }}"
- name: Apply deployment after service account removed
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-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

View File

@@ -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

View File

@@ -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: []