-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expose docker engine, implement delete operations (#398)
- Loading branch information
1 parent
627c188
commit 3c6d29d
Showing
59 changed files
with
4,152 additions
and
1,028 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,25 @@ node_types: | |
- '--become' | ||
- '--key-file={{ SELF.os_ssh_key_file }}' | ||
- '--user={{ SELF.os_ssh_user }}' | ||
delete: exit 0 | ||
delete: | ||
implementation: | ||
primary: Ansible | ||
operation_host: HOST | ||
environment: | ||
ANSIBLE_HOST_KEY_CHECKING: 'False' | ||
inputs: | ||
playbook: | ||
q: | ||
- name: wait for ssh | ||
wait_for_connection: | ||
- name: stop container | ||
community.docker.docker_container: | ||
name: '{{ SELF.application_name }}' | ||
state: absent | ||
playbookArgs: | ||
- '--become' | ||
- '--key-file={{ SELF.os_ssh_key_file }}' | ||
- '--user={{ SELF.os_ssh_user }}' | ||
node.agent~service.application#docker.image::[email protected]: | ||
derived_from: node.agent | ||
metadata: | ||
|
@@ -267,7 +285,36 @@ node_types: | |
selector: | ||
app: '{{ SELF.application_name }}' | ||
type: ClusterIP | ||
delete: exit 0 | ||
delete: | ||
implementation: | ||
primary: Ansible | ||
operation_host: ORCHESTRATOR | ||
environment: | ||
K8S_AUTH_HOST: | ||
eval: .::k8s_host | ||
K8S_AUTH_SSL_CA_CERT: | ||
eval: .::k8s_ca_cert_file | ||
K8S_AUTH_CERT_FILE: | ||
eval: .::k8s_client_cert_file | ||
K8S_AUTH_KEY_FILE: | ||
eval: .::k8s_client_key_file | ||
inputs: | ||
playbook: | ||
q: | ||
- name: delete service | ||
kubernetes.core.k8s: | ||
state: absent | ||
api_version: v1 | ||
kind: Service | ||
namespace: default | ||
name: '{{ SELF.application_name }}' | ||
- name: delete deployment | ||
kubernetes.core.k8s: | ||
state: absent | ||
api_version: app/v1 | ||
kind: Deployment | ||
namespace: default | ||
name: '{{ SELF.application_name }}' | ||
node.agent~service.application#tar.archive::ansible@*->remote.machine: | ||
derived_from: node.agent | ||
metadata: | ||
|
@@ -2815,28 +2862,81 @@ node_types: | |
app: '{{ SELF.application_name }}' | ||
type: ClusterIP | ||
- name: apply manifest | ||
ansible.builtin.shell: kubectl apply -f {{ manifest.path }} | ||
ansible.builtin.shell: kubectl --server {{ SELF.k8s_host }} --certificate-authority {{ SELF.k8s_ca_cert_file }} --client-certificate {{ SELF.k8s_client_cert_file }} --client-key {{ SELF.k8s_client_key_file }} apply -f {{ manifest.path }} | ||
args: | ||
executable: /usr/bin/bash | ||
- name: wait for deployment | ||
ansible.builtin.shell: kubectl rollout status deployment/{{ SELF.application_name }} --timeout 60s | ||
ansible.builtin.shell: kubectl --server {{ SELF.k8s_host }} --certificate-authority {{ SELF.k8s_ca_cert_file }} --client-certificate {{ SELF.k8s_client_cert_file }} --client-key {{ SELF.k8s_client_key_file }} rollout status deployment/{{ SELF.application_name }} --timeout 60s | ||
args: | ||
executable: /usr/bin/bash | ||
delete: | ||
implementation: | ||
primary: Ansible | ||
operation_host: ORCHESTRATOR | ||
inputs: | ||
playbook: | ||
q: | ||
- name: touch manifest | ||
register: manifest | ||
ansible.builtin.tempfile: | ||
suffix: '{{ SELF.application_name }}.application.manifest.yaml' | ||
- name: create manifest | ||
ansible.builtin.copy: | ||
dest: '{{ manifest.path }}' | ||
content: | | ||
{{ deployment | to_yaml }} | ||
--- | ||
{{ service | to_yaml }} | ||
vars: | ||
deployment: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: '{{ SELF.application_name }}' | ||
namespace: default | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: '{{ SELF.application_name }}' | ||
template: | ||
metadata: | ||
labels: | ||
app: '{{ SELF.application_name }}' | ||
spec: | ||
containers: | ||
- image: '{{ ".artifacts::docker_image::file" | eval }}' | ||
name: '{{ SELF.application_name }}' | ||
env: [] | ||
ports: | ||
- containerPort: '{{ SELF.application_port }}' | ||
service: | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: '{{ SELF.application_name }}' | ||
namespace: default | ||
spec: | ||
ports: | ||
- name: '{{ SELF.application_protocol }}' | ||
port: '{{ SELF.application_port }}' | ||
targetPort: '{{ SELF.application_port }}' | ||
selector: | ||
app: '{{ SELF.application_name }}' | ||
type: ClusterIP | ||
- name: unapply manifest | ||
ansible.builtin.shell: kubectl --server {{ SELF.k8s_host }} --certificate-authority {{ SELF.k8s_ca_cert_file }} --client-certificate {{ SELF.k8s_client_cert_file }} --client-key {{ SELF.k8s_client_key_file }} delete -f {{ manifest.path }} | ||
args: | ||
executable: /usr/bin/bash | ||
delete: exit 0 | ||
node.agent~service.application#docker.image::[email protected]>remote.machine: | ||
derived_from: node.agent | ||
metadata: | ||
vintner_generated: 'true' | ||
vintner_orchestrator: unfurl | ||
properties: | ||
os_ssh_user: | ||
type: string | ||
default: | ||
get_input: os_ssh_user | ||
os_ssh_key_file: | ||
os_ssh_host: | ||
type: string | ||
default: | ||
get_input: os_ssh_key_file | ||
eval: .::.requirements::[.name=host]::.target::management_address | ||
attributes: | ||
application_address: | ||
type: string | ||
|
@@ -2847,14 +2947,10 @@ node_types: | |
create: | ||
implementation: | ||
primary: Ansible | ||
operation_host: HOST | ||
environment: | ||
ANSIBLE_HOST_KEY_CHECKING: 'False' | ||
operation_host: ORCHESTRATOR | ||
inputs: | ||
playbook: | ||
q: | ||
- name: wait for ssh | ||
wait_for_connection: | ||
- name: touch compose | ||
register: compose | ||
ansible.builtin.tempfile: | ||
|
@@ -2876,8 +2972,35 @@ node_types: | |
ansible.builtin.shell: docker compose -f {{ compose.path }} up -d | ||
args: | ||
executable: /usr/bin/bash | ||
playbookArgs: | ||
- '--become' | ||
- '--key-file={{ SELF.os_ssh_key_file }}' | ||
- '--user={{ SELF.os_ssh_user }}' | ||
delete: exit 0 | ||
environment: | ||
DOCKER_HOST: '{{ SELF.os_ssh_host }}' | ||
delete: | ||
implementation: | ||
primary: Ansible | ||
operation_host: ORCHESTRATOR | ||
inputs: | ||
playbook: | ||
q: | ||
- name: touch compose | ||
register: compose | ||
ansible.builtin.tempfile: | ||
suffix: '{{ SELF.application_name }}.compose.yaml' | ||
- name: create compose | ||
ansible.builtin.copy: | ||
dest: '{{ compose.path }}' | ||
content: '{{ manifest | to_yaml }}' | ||
vars: | ||
manifest: | ||
name: '{{ SELF.application_name }}' | ||
services: | ||
application: | ||
container_name: '{{ SELF.application_name }}' | ||
image: '{{ ".artifacts::docker_image::file" | eval }}' | ||
network_mode: host | ||
environment: {} | ||
- name: apply compose | ||
ansible.builtin.shell: docker compose -f {{ compose.path }} down | ||
args: | ||
executable: /usr/bin/bash | ||
environment: | ||
DOCKER_HOST: '{{ SELF.os_ssh_host }}' |
Oops, something went wrong.