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

tests/k8s_user_impersonation: adjustement for k8s 1.24 #520

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
3 changes: 3 additions & 0 deletions changelogs/fragments/k8s_user_impersonation_k8s_1_24.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- "Adjust k8s_user_impersonation tests to be compatible with Kubernetes 1.24 (https://github.com/ansible-collections/kubernetes.core/pull/520)."
21 changes: 18 additions & 3 deletions tests/integration/targets/k8s_user_impersonation/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@
- "{{ user_01 }}"
- "{{ user_02 }}"

- name: Create Service token
kubernetes.core.k8s:
definition:
apiVersion: v1
kind: Secret
type: kubernetes.io/service-account-token
metadata:
name: "{{ item }}"
annotations:
kubernetes.io/service-account.name: "{{ item }}"
namespace: "{{ test_ns }}"
with_items:
- "{{ user_01 }}"
- "{{ user_02 }}"

- name: Read Service Account - user_01
kubernetes.core.k8s_info:
kind: ServiceAccount
Expand All @@ -38,7 +53,7 @@
kubernetes.core.k8s_info:
kind: Secret
namespace: '{{ test_ns }}'
name: '{{ result.resources[0].secrets[0].name }}'
name: '{{ user_01 }}'
no_log: true
register: _secret

Expand All @@ -47,7 +62,7 @@

- name: Read Service Account - user_02
kubernetes.core.k8s_info:
kind: ServiceAccount
kind: Secret
namespace: "{{ test_ns }}"
name: "{{ user_02 }}"
register: result
Expand All @@ -56,7 +71,7 @@
kubernetes.core.k8s_info:
kind: Secret
namespace: '{{ test_ns }}'
name: '{{ result.resources[0].secrets[0].name }}'
name: '{{ user_02 }}'
no_log: true
register: _secret

Expand Down