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

Refactor OSS Helm Charts #14794

Merged
merged 23 commits into from
Jul 20, 2022
Merged

Refactor OSS Helm Charts #14794

merged 23 commits into from
Jul 20, 2022

Conversation

xpuska513
Copy link
Contributor

What

Describe what the change is solving
It helps to add screenshots if it affects the frontend.

  • Refactored helm chart and splitted it out into own separate charts as per helm best practices
  • Added CI workflow to publish new charts to ArtifactHub and it's own helm repository

How

Describe the solution
Refactoring done using Helm docs and help of community members
CI workflow made using git mkver

Recommended reading order

  1. x.java
  2. y.python

🚨 User Impact 🚨

Are there any breaking changes? What is the end result perceived by the user? If yes, please merge this PR with the 🚨🚨 emoji so changelog authors can further highlight this if needed.
Probable user impact:

  • Failure during upgrade due to misconfigured bitnami/minio chart, an README file will be added about mitigating this issue

Pre-merge Checklist

Expand the relevant checklist and delete the others.

Community member or Airbyter

  • Community member? Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
    • docs/integrations/README.md
    • airbyte-integrations/builds.md
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub by running the /publish command described here
  • After the connector is published, connector added to connector index as described here
  • Seed specs have been re-generated by building the platform and committing the changes to the seed spec files, as described here
Updating a connector

Community member or Airbyter

  • Grant edit access to maintainers (instructions)
  • Secrets in the connector's spec are annotated with airbyte_secret
  • Unit & integration tests added and passing. Community members, please provide proof of success locally e.g: screenshot or copy-paste unit, integration, and acceptance test output. To run acceptance tests for a Python connector, follow instructions in the README. For java connectors run ./gradlew :airbyte-integrations:connectors:<name>:integrationTest.
  • Code reviews completed
  • Documentation updated
    • Connector's README.md
    • Connector's bootstrap.md. See description and examples
    • Changelog updated in docs/integrations/<source or destination>/<name>.md including changelog. See changelog example
  • PR name follows PR naming conventions

Airbyter

If this is a community PR, the Airbyte engineer reviewing this PR is responsible for the below items.

  • Create a non-forked branch based on this PR and test the below items on it
  • Build is successful
  • If new credentials are required for use in CI, add them to GSM. Instructions.
  • /test connector=connectors/<name> command is passing
  • New Connector version released on Dockerhub and connector version bumped by running the /publish command described here
Connector Generator
  • Issue acceptance criteria met
  • PR name follows PR naming conventions
  • If adding a new generator, add it to the list of scaffold modules being tested
  • The generator test modules (all connectors with -scaffold in their name) have been updated with the latest scaffold by running ./gradlew :airbyte-integrations:connector-templates:generator:testScaffoldTemplates then checking in your changes
  • Documentation which references the generator is updated as needed

Tests

Unit

Put your unit tests output here.

Integration

Put your integration tests output here.

Acceptance

Put your acceptance tests output here.

@CLAassistant
Copy link

CLAassistant commented Jul 18, 2022

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added area/platform issues related to the platform kubernetes labels Jul 18, 2022
@xpuska513 xpuska513 requested review from davinchia, git-phu, supertopher and a team July 18, 2022 14:06
@xpuska513 xpuska513 requested a review from didistars328 July 19, 2022 11:13
@xpuska513 xpuska513 requested a review from git-phu July 19, 2022 19:36
- name: "Helm package main chart"
shell: bash
run: |
sleep 120
Copy link
Contributor

Choose a reason for hiding this comment

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

what is this sleep for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since in main chart I'm referencing charts from our new repo, we need to wait for changes to be indexed, that's why I added bash sleep there

Copy link
Contributor

Choose a reason for hiding this comment

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

can we add an echo telling the user that so they know they should expect to wait 2 minutes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, already added it

Copy link
Contributor

Choose a reason for hiding this comment

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

kyrylo, can we also add a comment here to make clear what this sleep is for

sleep 120
declare -a StringArray=("airbyte")
for val in ${StringArray[@]}; do
cd ./airbyte/charts/${val} && cat Chart.yaml && helm dep update && cd $GITHUB_WORKSPACE
Copy link
Contributor

Choose a reason for hiding this comment

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

to make sure i understand, helm dep update means we always update our chart dependencies before publishing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to update and download dependencies of chart before publishing it(it packages everything into single tarball archive)

mkver.conf Outdated
@@ -0,0 +1,80 @@
tagPrefix: v
Copy link
Contributor

Choose a reason for hiding this comment

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

i'm not very familiar with mkver. can you write a short summary explaining this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically mkver just doing semantic versioning for us, its using conventional commits for it. This config specifies settings for semantic gersioning like tag format, version format, files to automatically patch.
In short words, same thing as bumpversion. Actually we might use bumpversion instead of mkver, but need to tune it, so helm charts will have it's own versioning

@@ -154,61 +142,50 @@ Add environment variables to configure database values
{{- printf "jdbc:postgresql://%s:%s/%s" $host $port $dbName -}}
{{- end -}}

{{/*
Copy link
Contributor

Choose a reason for hiding this comment

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

what happened to these templates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Strange that PullSecrets got deleted, let me check on that.
About temporal, since I moved it into it's own chart, this template won't work as expected, I did it in much faster manner, simply by explicit editing of the configmap.yaml file. (New services will have following format: {{ .Release.Name }}-{{ .Chart.Name }} e.g aribyte-worker

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted changes done to PullSecrets

Copy link
Contributor

@davinchia davinchia left a comment

Choose a reason for hiding this comment

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

Looks great @xpuska513 !

I have some questions for my understanding since I haven't used some of these bits and it's been a while since I've set up helm publishing.

Questions:

  1. It looks like because we added the charts to the bumpversion.cfg, upgrading airbyte will also upgrade the helm charts (assuming there aren't any changes to the helm charts) and there isn't more work to do. Is that right?
  2. Can I confirm that hosting the helm charts in the Airbyte OSS repo means a user can do helm add repo and no longer needs to git checkout the airbyte repo to use our helm charts?
  3. How are we authenticating to publish Helm charts? Am I missing something?
  4. When publishing new helm charts, do the commits needs to follow the conventional commits due to the mkver configuration?

Since this is a big PR, I'm okay merging this as in and refining different parts further.

@xpuska513
Copy link
Contributor Author

  • It looks like because we added the charts to the bumpversion.cfg, upgrading airbyte will also upgrade the helm charts (assuming there aren't any changes to the helm charts) and there isn't more work to do. Is that right?
  • Can I confirm that hosting the helm charts in the Airbyte OSS repo means a user can do helm add repo and no longer needs to git checkout the airbyte repo to use our helm charts?
  • How are we authenticating to publish Helm charts? Am I missing something?
  • When publishing new helm charts, do the commits needs to follow the conventional commits due to the mkver configuration?
  1. I believe it should upgrade only the appVersion parameter in chart.yaml
  2. Yep, end user can simply add our repo via helm repo add airbyte https://aibytehq.github.io/helm-charts and use all our charts from there without clonning the repo
  3. I'm clonning the helm-chart repo locally into github runner workspace, then running helm package that basically packages our chart and makes it usable, after that workflow copies that created .tgz arvhice to helm-charts repo and runs helm repo index which scans for new packaged charts and indexes the changed in index.yaml file which is basically help helm to understand the repo contents and then push the changes to helm-charts repo.
  4. About it, let me do some another test in my fork so I can be sure that mkver won't touch main components semantic versioning

Copy link
Contributor

@supertopher supertopher left a comment

Choose a reason for hiding this comment

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

Looks great, nothing but nits

thanks @xpuska513

run: |
declare -a StringArray=("airbyte-bootloader" "airbyte-server" "airbyte-temporal" "airbyte-webapp" "airbyte-pod-sweeper" "airbyte-worker")
for val in ${StringArray[@]}; do
cd ./airbyte/charts/${val} && helm dep update && cd $GITHUB_WORKSPACE
Copy link
Contributor

Choose a reason for hiding this comment

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

why are these commands linked with &&?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just an old habit, like to do oneliner if we won't need to do anything in directory anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

works for me, thanks for explaining

- name: "Helm package main chart"
shell: bash
run: |
sleep 120
Copy link
Contributor

Choose a reason for hiding this comment

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

can we add an echo telling the user that so they know they should expect to wait 2 minutes?

## @param bootloader.resources.limits [object] The resources limits for the airbyte bootloader image
## @param bootloader.resources.requests [object] The requested resources for the airbyte bootloader image
resources:
## Example:
Copy link
Contributor

Choose a reason for hiding this comment

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

nice to have the examples 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also updated the docs using helm-docs

@xpuska513
Copy link
Contributor Author

@davinchia, so I updated the workflow, now it doesn't need mkversion at all and potentially it shouldn't screw up sem ver of your main applications.

{{- end }}
containers:
- name: airbyte-server-container
image: {{ printf "%s:%s" .Values.image.repository (default .Chart.AppVersion .Values.image.tag) }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now we also can forget about manually setting the image tag, it'll now use .Chart.AppVersion (that automatically should bump itself) as default value for image tag

Copy link
Contributor

Choose a reason for hiding this comment

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

nice

Copy link
Contributor

@supertopher supertopher left a comment

Choose a reason for hiding this comment

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

looks solid

run: |
declare -a StringArray=("airbyte-bootloader" "airbyte-server" "airbyte-temporal" "airbyte-webapp" "airbyte-pod-sweeper" "airbyte-worker")
for val in ${StringArray[@]}; do
cd ./airbyte/charts/${val} && helm dep update && cd $GITHUB_WORKSPACE
Copy link
Contributor

Choose a reason for hiding this comment

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

works for me, thanks for explaining

{{- end }}
containers:
- name: airbyte-server-container
image: {{ printf "%s:%s" .Values.image.repository (default .Chart.AppVersion .Values.image.tag) }}
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@xpuska513
Copy link
Contributor Author

Bumped the version, as for me looks good.
@git-phu ?

Copy link
Contributor

@git-phu git-phu left a comment

Choose a reason for hiding this comment

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

looks good to me, nice work!

@xpuska513 xpuska513 merged commit c7774a5 into airbytehq:master Jul 20, 2022
mfsiega-airbyte pushed a commit that referenced this pull request Jul 21, 2022
* Add refactored helm charts

* Add mkver.conf

* Remove unused workflow debug info

* Add newline

* Add switch for rendering main chart templates

* Update .bumpversion.cfg

* Replace repository in main chart

* Update helm-docs. Remove commented values. Replace placeholders to more sensable. Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update workflow

* Update test workflow

* Update test workflow

* Disable on push for main workflow. Add test action for test workflow

* Delete test workflow. Update main workflow

* Remove mkver.conf since its not used no more

* Reference appVersion instead of manually set image tag

* Revert image pull secrets

* Bump appVersion to the latest

* Update values.yaml
- condition: temporal.enabled
name: temporal
repository: "https://airbytehq.github.io/helm-charts/"
version: placeholder

Choose a reason for hiding this comment

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

Are these placeholders supposed to be here @xpuska513 ? I just submitted an issue here: #15656

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're supposed, let me update the docs and explained a little bit more in the #15656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/platform issues related to the platform kubernetes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants