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

feat: playbook to deploy the snowdrop-bot to k8s #173

Merged
merged 2 commits into from Feb 18, 2021
Merged

feat: playbook to deploy the snowdrop-bot to k8s #173

merged 2 commits into from Feb 18, 2021

Conversation

jacobdotcosta
Copy link
Member

Optionally builds the application locally, and deploys it to k8s. It uses buildah in the process.

builds the application locally and deploys it to k8s
@cmoulliard
Copy link
Member

  • I think that we should also include, part of this role, the process to install/uninstall the K8S resources needed to deploy snowdrop-bot on K8s

  • Do we have to install additional K8s resources such as : secret, service account, pvc, pc, ... ?

kc get deployment,service,ingress -n bot
NAME                                 READY   UP-TO-DATE   AVAILABLE   AGE
deployment.extensions/snowdrop-bot   1/1     1            1           84d

NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
service/snowdrop-bot   ClusterIP   10.107.48.179   <none>        8080/TCP   84d

NAME                              HOSTS   ADDRESS          PORTS   AGE
ingress.extensions/snowdrop-bot   *       195.201.87.126   80      84d

WDYT @jacobdotcosta

@jacobdotcosta
Copy link
Member Author

No PV is being used currently, due to problems when starting the bot with the H2 database. I'll check the service and the ingress, how they have been deployed.

The URL to obtain the tag from as well as the build reference folders were wrong and the project didn't build correctly
@jacobdotcosta
Copy link
Member Author

I've created snowdrop-bot issue 130 to create a database and have some persistency.


This project consists of 2 playbooks:
* [build](#build): builds the project
* [deploy](#deploy): deploys the application to [quay.io](https://quay.io/) and restarts the k8s pod
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont deploy the application but we push the image to the quay registry. Can you then rename deploy to push and do the same within the role/tasks ?


# Introduction

Ansible playbook to deploy the `snowdrop-bot` into k8s using [quay.io](https://quay.io/) registry.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We dont deploy the application but the role defined part of this PR is about compile or package/build/push the image to the quay registry. Can you then review this description section please ?

This playbook deploys the `snowdrop-bot` by performing the following tasks:
1. Create local image
1. Push image to [quay.io](https://quay.io/) with 2 tags, one for the version and another for the `latest`
1. Scale down and up again the pod (the pod must be deployed against the `latest` version)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose to move the last step described here into another section "Rollout" as what you describe concerns the process to push an image to quay registry and that you use instead the following command to

kubectl rollout restart -h
Restart a resource.

     Resource will be rollout restarted.

Examples:

  # Restart a deployment
  kubectl rollout restart deployment/nginx

See: kubernetes/kubernetes#33664 (comment)

Comment on lines +52 to +59
- name: "Scale down pod"
shell: "{{ kube_cli_tool }} scale --replicas=0 deployment snowdrop-bot -n bot {{ kube_cfg_append }}"

- name: "Wait 10 seconds"
pause:
seconds: 10

- name: "Scale up pod"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be moved into another file rollout.yml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be renamed as the title to buikld-push.yml

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed the rollout tasks to a new playbook.
What do you mean with To be renamed as the title to buikld-push.yml?

@cmoulliard
Copy link
Member

PR is still missing what I commented 13days ago ;-)

@jacobdotcosta
Copy link
Member Author

PR is still missing what I commented 13days ago ;-)

I have reviewed the descriptors and this information is provided from the application itself in target/kubernetes folder. The kubernetes.yml file generated by quarkus includes the deployment, the service and the ingress so IMO these files don't fit here in this playbook.

Since we don't have a testing environment I'd prefer leaving this playbook as is for now as it works to update the bot as create a new issue to implement this as a future improvement.

WDYT @cmoulliard ?

@cmoulliard
Copy link
Member

I have reviewed the descriptors and this information is provided from the application itself in target/kubernetes folder. The kubernetes.yml file generated by quarkus includes the deployment, the service and the ingress so IMO these files don't fit here in this playbook.

Ok. LGTM then

@cmoulliard
Copy link
Member

Go ahead and merge it then

@jacobdotcosta jacobdotcosta merged commit 99eab93 into snowdrop:master Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - Team work Meeting, demo, infra support, ....
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants