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

Create Helm chart for bookkeeper #66

Open
gothub opened this issue Sep 22, 2020 · 10 comments
Open

Create Helm chart for bookkeeper #66

gothub opened this issue Sep 22, 2020 · 10 comments
Assignees
Milestone

Comments

@gothub
Copy link
Collaborator

gothub commented Sep 22, 2020

Helm is a k8s package manager, which could make the deployment of bookkeeper simpler. See
https://github.com/helm/helm

@gothub gothub self-assigned this Sep 22, 2020
mbjones added a commit that referenced this issue Feb 17, 2022
Partial work on issue #66. The current helm template produces the
bookkeeper-specific deployment files, but does not yet handle the
postgres deployment. Postgres is probably best pulled in via a
subchart.
@mbjones
Copy link
Member

mbjones commented Feb 17, 2022

Started helm configuration in https://github.com/DataONEorg/bookkeeper/tree/k8s-config/helm

The deployment fails to start because the app can't find the bookkeeper.yml file in the PVC. Logs from failure:

$ kubectl logs -n bookkeeper pod/bookkeeper-75694b758b-9nr6j
java.io.FileNotFoundException: File /opt/local/bookkeeper/bookkeeper.yml not found
        at io.dropwizard.configuration.FileConfigurationSourceProvider.open(FileConfigurationSourceProvider.java:18)
        at io.dropwizard.configuration.BaseConfigurationFactory.build(BaseConfigurationFactory.java:79)
        at io.dropwizard.cli.ConfiguredCommand.parseConfiguration(ConfiguredCommand.java:126)
        at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:74)
        at io.dropwizard.cli.Cli.run(Cli.java:79)
        at io.dropwizard.Application.run(Application.java:94)
        at org.dataone.bookkeeper.Bookkeeper.main(Bookkeeper.java:140)

TODO: Discuss with @gothub what the bootstrap sequence was envisioned for getting config files onto the PVCs. Probably easiest to embed a default in the ConfigMap.

@gothub
Copy link
Collaborator Author

gothub commented Feb 17, 2022

Originally the bookkeeper.yml file was built into the Docker image, so I moved it out so that it could be manually placed on the statically provisioned NFS-based PV. The intent was to be able to update the configuration independent of the Docker image build.

Incorporating the config info into a ConfigMap sounds good, although refactoring to read from a ConfigMap from a Java program would be required. I haven't looked into this yet.

@mbjones
Copy link
Member

mbjones commented Feb 17, 2022

One convenient way to handle the ConfigMap without java changes is to mount the config file as a volume using the ConfigMap as the source. Then, changes to the ConfigMap can be made externally and updated with helm update, and there are no code changes needed.

@mbjones
Copy link
Member

mbjones commented Feb 17, 2022

For example, use a ConfigMap like this to load the contents of a config directory into a ConfigMap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Release.Name }}-configfiles
  {{- template "index-monitor.labels" . }}
data:
{{ (.Files.Glob "config/*").AsConfig | indent 2 }}

And then you can mount those files as a volume in your pods with a snippet like this:

spec:
  volumes:
      - name: {{ .Release.Name }}-config-volume
        configMap:
          name: {{ .Release.Name }}-configfiles
          defaultMode: 0644

Once that is done, someone can update the config by modifying the files in the config directory and make a new ConfigMap which they post using a helm update. This puts reconfiguring the app into a versioned helm command, and allows rollback. For configfiles that don't change often, this might be preferred to using a mutable PVC. Let's discuss our options on slack.

@mbjones
Copy link
Member

mbjones commented Feb 18, 2022

I moved the config file into a configmap and mounted it, and got past that error. now just postgres deploy and config are needed. See sha 60a67de.

@mbjones
Copy link
Member

mbjones commented Feb 18, 2022

Began migrating postgres into helm config. See sha 35145ea.

While I am currently mirroring the pg setup from previously, we should consider whether to use an embedded helm subchart for postgres, or whether to install it independently altogether.

Previously I moved the bookkeeper.yml config file into helm, but note that it is not configured with the correct dbname/pass -- determine if those values can be derived from values.yaml.

mbjones added a commit that referenced this issue Feb 18, 2022
The bookkeeper.yml file can now get values from values.yaml which
are substituted using the template syntax.  Still need to figure out how
to pass in the secret that way.

Also committed the postgres.yaml config that I forgot last time.

This continues work on issue #66.
@mbjones
Copy link
Member

mbjones commented Feb 18, 2022

From sha 4e4b3ef we can now use values from values.yaml in bookkeeper.yml.

@mbjones
Copy link
Member

mbjones commented Apr 27, 2022

From sha 5fc896d, we now have a functional helm deployment with both bookkeeper and postgres running, and the web REST API responding on the ingress on the dev cluster. Needs lots of cleanup and refinement work, and testing.

@mbjones mbjones added this to the 1.0.0 release milestone Apr 11, 2023
@mbjones
Copy link
Member

mbjones commented Apr 13, 2023

Basic helm config now working, fully configurable through the values.yaml file. Releasing this as docker image 0.4.0 in sha ca5a7f4.

@mbjones
Copy link
Member

mbjones commented Apr 13, 2023

Merged into develop with PR #72

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants