[FOLIO-2055] create an Ansible role for backend-module that deploys the container to K8s cluster Created: 31/May/19  Updated: 03/Jun/20  Resolved: 29/Jul/19

Status: Closed
Project: FOLIO
Components: None
Affects versions: None
Fix versions: None

Type: Task Priority: P2
Reporter: Jakub Skoczen Assignee: mark.stacy
Resolution: Done Votes: 0
Labels: platform-backlog
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Issue links:
Blocks
blocks FOLIO-2183 integrate backend-module pipeline int... Closed
blocks UXPROD-1827 CI-integrated continuous deployment (... Closed
is blocked by OKAPI-729 Discovery: url pattern (DNS for service) Open
is blocked by FOLIO-2054 Stand up cluster for CI using AWS K8s... Closed
is blocked by FOLIO-2069 Deploy Okapi to K8s cluster Closed
Relates
relates to FOLIO-2056 create a pipeline for a front-end mod... Closed
relates to FOLIO-2130 SPIKE: how to clean up unused contain... Closed
relates to FOLIO-2131 SPIKE: how to deploy containers based... Closed
relates to FOLIO-1862 SPIKE: consider loadSample/loadRefere... Open
Sprint: CP: sprint 67, CP: sprint 69, CP: sprint 68
Story Points: 5
Development Team: Core: Platform

 Description   

Scope

This issue is scoped to deploying pre-release and release artifacts (commits to master and releases). Deployment of arbitrary commits on feature branches is out of scope. (see FOLIO-2131 Closed )

Assumptions

Jenkins pipeline performs the following steps first:

  1. Builds the source code, runs units tests, build a container
  2. A module descriptor for the module has been generated and registered with an upstream module descriptor registry (e.g. folio-registry.aws.indexdata.com)
  3. A Docker image for the module is available on a Docker registry (e.g. Docker Hub)

Process

In broad terms, this is the process that should be followed:

  1. Deploy the Docker image to the K8s cluster. See FOLIO-2069 Closed for a sample Ansible playbook that generates service and deployment YAML from a template and deploys to a K8s cluster. The service DNS name should be the same as the full module ID.
  2. Use the Okapi API to pull module descriptors from the upstream repository to the target Okapi instance
  3. Post a deployment descriptor to the Okapi /_/discovery/modules API for the module with the URL pointing to the K8s service. Note: if OKAPI-729 Open is resolved, this step will not be necessary.

Open questions

  • What is the best way to pass database credentials to the module instance?
  • What (if anything) should be done about tenant data upgrading? (this is relevant for the existing reference environments like folio-snapshot/stable and folio-testing, but OUT OF SCOPE for this ticket)
  • What is the process for cleaning up unused module instances? (see FOLIO-2130 Closed , Okapi does not clean up externally deployed instances)
  • What is the best way to manage resource utilization for containers? (may also be relevant to FOLIO-2069 Closed ). See FOLIO-1729 Closed .


 Comments   
Comment by Jakub Skoczen [ 10/Jul/19 ]

Ian Hardy mark.stacy Guys, let's flash out the steps for deploying this module and making use of Okapi's dependency resolution – it would involve making a couple calls to the Okapi API to get the deps and then cross-checking them against the discovery endpoint to confirm what is running and what is not. Also, we will need to name the modules with the module name and a version number (and Kubernets has some limitations in terms of naming services).

Comment by mark.stacy [ 19/Jul/19 ]

Jakub Skoczen Ian Hardy Wayne Schneider John Malconian PR submitted (copy markdown over to issue)

Role Accomplishes:
1. Generate Database Secret, Service, and Deployment YAML from a template and deploys to a K8s cluster.
2. Post Module Descriptor to Okapi (/_/proxy/modules)
3. Post Deployment Descriptor (/_/discovery/modules)

Review: @wafschneider @ihardy @funkymalc
README: https://github.com/folio-org/folio-ansible/tree/FOLIO-2055/roles/module-kubernetes

ISSUES

Comment by Ann-Marie Breaux (Inactive) [ 25/Jul/19 ]

HI mark.stacy and Jakub Skoczen This showed up in the manual testing queue, but I don't think there's anything for us to do. Do you want to close this ticket?

Comment by John Malconian [ 25/Jul/19 ]

Updated status to 'In Code Review'

Comment by Ian Hardy [ 29/Jul/19 ]

Wayne's latest changes look good to me, my vote merge them in and handle the last todo (replace module_list with folio_modules) perhaps as part of folio-2187?

I also noticed that the roles included in meta/main.yml include the common role, which is a bit tricky on k8s since the common role expects to be running on a Debian system. I think I can work around this in the module deploy pipeline temporarily, but this might be another issue to address in 2187.

Generated at Thu Feb 08 23:17:52 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.