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 k8s auth to lookup hashi_vault - operator #220

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bfd798a
Create _auth_method_k8s.py
chris93111 Feb 13, 2022
f065345
add k8s auth
chris93111 Feb 13, 2022
4a5e245
Add role params for k8s auth
chris93111 Feb 13, 2022
e1d3581
Update auth.py
chris93111 Feb 13, 2022
1355f7d
use role_id
chris93111 Feb 13, 2022
1c344ef
use role_id
chris93111 Feb 13, 2022
86293c0
Update _authenticator.py
chris93111 Feb 13, 2022
38c5833
swith to role_id
chris93111 Feb 13, 2022
6a41d72
Update plugins/module_utils/_auth_method_k8s.py
chris93111 Feb 13, 2022
19df02f
change k8s to kubernetes
chris93111 Feb 13, 2022
24c960f
kubernetes_token
chris93111 Feb 13, 2022
ecb09ae
k8s to kubernetes + kubernetes_token
chris93111 Feb 13, 2022
6c62724
add same validate of token auth
chris93111 Feb 13, 2022
8352337
add doc on params kubernetes_token_path
chris93111 Feb 13, 2022
ee819aa
add kubernetes_token_path
chris93111 Feb 13, 2022
bb55aed
add HashiVaultValueError
chris93111 Feb 13, 2022
0e68f9f
Update hashi_vault.py
chris93111 Feb 13, 2022
963417f
fix
chris93111 Feb 14, 2022
6f5a77f
fix
chris93111 Feb 14, 2022
bc662bb
Update auth.py
chris93111 Feb 14, 2022
fcc80b3
Update plugins/lookup/hashi_vault.py
chris93111 Feb 16, 2022
2ad2618
Update plugins/doc_fragments/auth.py
chris93111 Feb 16, 2022
2ca793b
Update plugins/doc_fragments/auth.py
chris93111 Feb 16, 2022
42d7f71
change to auth.kubernetes + switch depracated
chris93111 Feb 16, 2022
0bf56f7
fix login
chris93111 Feb 16, 2022
79c21e2
use_token
chris93111 Feb 16, 2022
d9c856b
lint
chris93111 Mar 4, 2022
ee611ed
fix error with no token found
chris93111 Mar 4, 2022
f33bcc4
lint
chris93111 Mar 5, 2022
27f9283
lint
chris93111 Mar 5, 2022
4e674cb
Merge pull request #1 from ansible-collections/main
chris93111 Mar 5, 2022
897fe87
lint
chris93111 Apr 1, 2022
fd99231
Bump version_added
briantist Apr 1, 2022
d49061d
Merge branch 'main' into patch-1
chris93111 May 15, 2022
39b6f09
Merge pull request #2 from ansible-collections/main
chris93111 Aug 6, 2022
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
6 changes: 4 additions & 2 deletions plugins/module_utils/_auth_method_k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from ansible_collections.community.hashi_vault.plugins.module_utils._hashi_vault_common import HashiVaultAuthMethodBase, HashiVaultValueError
import os


class HashiVaultAuthMethodKubernetes(HashiVaultAuthMethodBase):
'''HashiVault option group class for auth: k8s'''

Expand All @@ -37,7 +38,8 @@ def validate(self):
self._options.set_option('kubernetes_token', token_file.read().strip())

if self._options.get_option('kubernetes_token') is None:
raise HashiVaultValueError(self._options.get_option('kubernetes_token')+self._options.get_option_default('kubernetes_token_path')+"No Kubernetes Token specified or discovered.")
raise HashiVaultValueError(self._options.get_option_default('kubernetes_token_path') +
" No Kubernetes Token specified or discovered.")
chris93111 marked this conversation as resolved.
Show resolved Hide resolved

def authenticate(self, client, use_token=True):
origin_params = self._options.get_filled_options(*self.OPTIONS)
Expand All @@ -51,5 +53,5 @@ def authenticate(self, client, use_token=True):
except (NotImplementedError, AttributeError):
self.warn("Kubernetes authentication requires HVAC version 1.0.0 or higher. Deprecated method 'auth_kubernetes' will be used.")
response = client.auth_kubernetes(**params)

return response