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

Convert to a Helm Chart #52

Open
2 of 4 tasks
ThomasThelen opened this issue Nov 15, 2021 · 6 comments
Open
2 of 4 tasks

Convert to a Helm Chart #52

ThomasThelen opened this issue Nov 15, 2021 · 6 comments

Comments

@ThomasThelen
Copy link
Member

ThomasThelen commented Nov 15, 2021

Right now deployment is handled through a make file. It would be great if developers could use the same tooling across all kubernetes deployments, like helm.

One hoop to jump through is ordering the deployment process; we want some pods to start after others have started. Helm doesn't have an official way to specify an ordering of deployments, but it looks like there's at least one workaround.

One way is to use chart hooks. Since we have six deployments, we'll have six helm charts. It's possible to run a chart hook before a helm chart is deployed. We're also able to set the hook priority with a hook-weight. Since hooks with high priorities are deployed first, it can be used as an ordering mechanism. This unfortunately doesn't provide a means to tell the scheduler deployment to wait for the redis deployment (it only allows us to deploy redis first, and immediately the scheduler).

I think we might actually be able to attach an initContainer to the scheduler and worker that pings redis until it finally gets a response. Then the container will pass control to the slinky cli. Doing this, we should be able to start all deployments at once without using chart hooks.

Tasks

  • Create an initial Helm chart
  • Adapt Helm chart to support persistence, esp. w/in our Ceph PV provider
  • Secure Redis and Virtuoso
  • Maybe: Consider using a StatefulSet for non-scaling/persistent pods. Probably don't do this but do make an issue to track the work as a next step
@mbjones
Copy link
Member

mbjones commented Nov 16, 2021

Kubernetes is designed to be a "declarative" system for describing the state of a set of services (e.g., service X should exist). I think it might make sense to make the components robust with respect to services that are currently not yet up -- i.e., ordering shouldn't matter. This might be enabled by having, for example, the deployment that depends on redis do error checking such that, if redis is not available, the deployment backs off and tries again in a bit. This will also help if, for example, kubernetes decides to move the redis service to another node, and there is a brief period where it is unavailable. From a 12 factor perspective, I take guidance from ideas like "resources can be attached to and detached from deploys at will.", and "processes are disposable, meaning they can be started or stopped at a moment’s notice."

@amoeba amoeba added this to the 0.3.0 milestone Feb 26, 2022
@amoeba
Copy link
Contributor

amoeba commented Aug 1, 2022

I'm going to start in on this today since the current set of YAML files don't fully deploy Slinky to a local cluster (they depend on our cluster, specifically cephfs) or our cluster (make doesn't apply Service defs or set up ingress).

@amoeba amoeba moved this from Might Do to Doing in Slinky Production Release Drill-Down Aug 1, 2022
amoeba added a commit that referenced this issue Aug 2, 2022
This helm chart should install and work at this point only if you've built the slinky and web images locally and tagged them with label "0.3.0"

Plenty more work to be done to make this chart great

#52
@amoeba
Copy link
Contributor

amoeba commented Aug 2, 2022

I pushed a first pass Helm chart to develop under /helm, see https://github.com/DataONEorg/slinky/tree/develop/helm. This installs and the service runs correctly (starts processing). A note for anyone trying to build this, it needs access to a 0.3.0 slinky image I've only built locally and made available on my dev cluster (which you can build too), and pushing those images up is a next order of business. There are some TODOs that need be addressed /helm folder too.

@amoeba amoeba self-assigned this Aug 2, 2022
@mbjones
Copy link
Member

mbjones commented Aug 2, 2022

Thanks, @amoeba -- I've been pretty happy with the use of GitHub Actions to build and push an image to the GitHub package repository associated with the associated repository -- that makes it easy to automate, easy to find the packages, they can be downloaded into any cluster, and we control the space so we can trust the images. They are public, so one has to watch to not commit secrets, etc. I have some examples in the bookkeeper and purser helm charts, among others.

@mbjones
Copy link
Member

mbjones commented Aug 2, 2022

Also, I found that the use of sub-charts was really effective to get dependent services installed (e.g., rabbitmq) in our dataone-indexer refactor -- see https://github.com/DataONEorg/dataone-indexer/blob/feature-9-rabbitmq-worker/helm/Chart.yaml

amoeba added a commit that referenced this issue Aug 2, 2022
amoeba added a commit that referenced this issue Aug 3, 2022
The version of the Helm chart at this point installs to the dev cluster and works correctly

Ref #52
@amoeba
Copy link
Contributor

amoeba commented Aug 3, 2022

I've got a working version of the Helm chart installed on the dev cluster, available at https://api.test.dataone.org/slinky. Note: The query editor on that page works but returns a static result for now (more work needed there). Query editor should work now.

; helm install -n slinky \
          --set ingress.enabled=true \
          --set ingress.host=api.test.dataone.org \
          --set ingress.tls.secretName=ingress-nginx-tls-cert \
          --set ingress.clusterIssuer=letsencrypt-prod \
      slinky .
NAME: slinky
LAST DEPLOYED: Tue Aug  2 19:05:12 2022
NAMESPACE: slinky
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
-------------------------------------------------------------------------------
     _ _       _
 ___| (_)_ __ | | ___   _
/ __| | | '_ \| |/ / | | |
\__ \ | | | | |   <| |_| |
|___/_|_|_| |_|_|\_\\__, |
                    |___/
-------------------------------------------------------------------------------
version: 0.3.0

** Please be patient while the chart is being deployed and services are available **
You can check their status with kubectl get pods

Ingress enabled at https://api.test.dataone.org/slinky

There are three tasks I left undone:

  • Ask whether we should be using Deployments for Virtuoso and Redis or something like a StatefulSet
  • Re-enable persistent storage for Virtuoso and Redis
  • Secure redis and Virtuoso

@amoeba amoeba changed the title Consider a Helm Chart Convert to a Helm Chart Aug 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants