mirror of
https://github.com/ansible-collections/kubernetes.core.git
synced 2026-05-08 05:52:37 +00:00
Merge pull request #94 from willthames/apply_nested_dict
Add test for openshift apply bug
This commit is contained in:
@@ -316,16 +316,13 @@
|
|||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
name: http
|
name: http
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
|
k8s_pod_resources:
|
||||||
- name: Remove the serviceaccount
|
requests:
|
||||||
k8s:
|
cpu: 100m
|
||||||
state: absent
|
memory: 100Mi
|
||||||
definition:
|
limits:
|
||||||
apiVersion: v1
|
cpu: 100m
|
||||||
kind: ServiceAccount
|
memory: 100Mi
|
||||||
metadata:
|
|
||||||
name: apply-deploy
|
|
||||||
namespace: "{{ apply_namespace }}"
|
|
||||||
|
|
||||||
- name: Update the earlier deployment
|
- name: Update the earlier deployment
|
||||||
k8s:
|
k8s:
|
||||||
@@ -351,6 +348,53 @@
|
|||||||
- containerPort: 8080
|
- containerPort: 8080
|
||||||
name: http
|
name: http
|
||||||
protocol: TCP
|
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
|
register: deploy_after_serviceaccount_removal
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
|
|
||||||
|
|||||||
@@ -229,6 +229,12 @@
|
|||||||
protocol: TCP
|
protocol: TCP
|
||||||
register: update_deploy
|
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
|
- name: Get updated pods
|
||||||
k8s_info:
|
k8s_info:
|
||||||
api_version: v1
|
api_version: v1
|
||||||
|
|||||||
@@ -15,14 +15,17 @@ k8s_pod_spec:
|
|||||||
exec:
|
exec:
|
||||||
command:
|
command:
|
||||||
- /bin/true
|
- /bin/true
|
||||||
resources:
|
resources: "{{ k8s_pod_resources }}"
|
||||||
limits:
|
|
||||||
cpu: "100m"
|
|
||||||
memory: "100Mi"
|
|
||||||
ports: "{{ k8s_pod_ports }}"
|
ports: "{{ k8s_pod_ports }}"
|
||||||
|
|
||||||
|
|
||||||
k8s_pod_service_account: default
|
k8s_pod_service_account: default
|
||||||
|
|
||||||
|
k8s_pod_resources:
|
||||||
|
limits:
|
||||||
|
cpu: "100m"
|
||||||
|
memory: "100Mi"
|
||||||
|
|
||||||
k8s_pod_command: []
|
k8s_pod_command: []
|
||||||
|
|
||||||
k8s_pod_ports: []
|
k8s_pod_ports: []
|
||||||
|
|||||||
Reference in New Issue
Block a user