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 support for ssh_key_unlock #165

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ spec:
type: "Machine"
ssh_username: "cat"
ssh_secret: my-ssh-secret
ssh_key_unlock: my-ssh-secret
runner_pull_policy: IfNotPresent
7 changes: 7 additions & 0 deletions roles/credential/templates/job_definition.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ spec:
name: "{{ ssh_secret }}"
key: id_rsa
{% endif %}
{% if ssh_key_unlock is defined and ssh_key_unlock != "" %}
- name: SSH_KEY_UNLOCK
valueFrom:
secretKeyRef:
name: "{{ ssh_secret }}"
key: password
{% endif %}
{% if ssh_username is defined and ssh_username != "" %}
- name: SSH_USERNAME
value: "{{ ssh_username }}"
Expand Down
5 changes: 5 additions & 0 deletions roles/job_runner/tasks/credentials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
include_tasks: credentials/create_ssh_credential.yml
when:
- lookup('env','SSH_SECRET') != ''
- lookup('env','SSH_KEY_UNLOCK') != ''
- lookup('env','KUBERNETES_BEARER_TOKEN') == ''
- lookup('env','USERNAME_SECRET') == ''
- lookup('env','PASSWORD_SECRET') == ''
Expand All @@ -12,6 +13,7 @@
when:
- lookup('env','KUBERNETES_BEARER_TOKEN') != ''
- lookup('env','SSH_SECRET') == ''
- lookup('env','SSH_KEY_UNLOCK') == ''
- lookup('env','USERNAME_SECRET') == ''
- lookup('env','PASSWORD_SECRET') == ''
- lookup('env','TOKEN_SECRET') == ''
Expand All @@ -21,6 +23,7 @@
when:
- lookup('env','KUBERNETES_BEARER_TOKEN') == ''
- lookup('env','SSH_SECRET') == ''
- lookup('env','SSH_KEY_UNLOCK') == ''
- lookup('env','USERNAME_SECRET') != ''
- lookup('env','PASSWORD_SECRET') != ''
- lookup('env','TOKEN_SECRET') == ''
Expand All @@ -30,6 +33,7 @@
when:
- lookup('env','KUBERNETES_BEARER_TOKEN') == ''
- lookup('env','SSH_SECRET') == ''
- lookup('env','SSH_KEY_UNLOCK') == ''
- lookup('env','USERNAME_SECRET') == ''
- lookup('env','PASSWORD_SECRET') == ''
- lookup('env','TOKEN_SECRET') != ''
Expand All @@ -38,6 +42,7 @@
include_tasks: credentials/create_generic_credential.yml
when:
- lookup('env','SSH_SECRET') == ''
- lookup('env','SSH_KEY_UNLOCK') == ''
- lookup('env','KUBERNETES_BEARER_TOKEN') == ''
- lookup('env','USERNAME_SECRET') == ''
- lookup('env','PASSWORD_SECRET') == ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
credential_type: "{{ lookup('env','TYPE') }}"
inputs:
ssh_key_data: "{{ lookup('env','SSH_SECRET') }}"
ssh_key_unlock: "{{ lookup('env','SSH_KEY_UNLOCK') }}"
username: "{{ lookup('env','SSH_USERNAME') }}"
state: present
register: credentials
Expand Down
Loading