Skip to content

[usage] Use a config file to configure usage component #11028

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

Merged
merged 1 commit into from
Jul 4, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Jun 30, 2022

Description

Moves usage component configuration into a file (mounted as a ConfigMap) instead of providing arguments on the command line.

Related Issue(s)

Fixes #10753

How to test

  1. Get preview context
  2. Check usage component started correctly

Release Notes

NONE

Documentation

NONE

Werft options:

  • /werft with-preview

"path/filepath"
)

func getStripeConfig(cfg *experimental.Config) (corev1.Volume, corev1.VolumeMount, string, bool) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This exists because it's essential to have a single place that can give us all of - volume, mount and the path where it will be. Before, these were scattered around which also scattered the logic for deciding if to add the argument

@easyCZ
Copy link
Member Author

easyCZ commented Jun 30, 2022

/werft run with-preview

👍 started the job as gitpod-build-mp-usage-config-file.6
(with .werft/ from main)

@easyCZ easyCZ marked this pull request as ready for review June 30, 2022 13:06
@easyCZ easyCZ requested review from a team June 30, 2022 13:06
@github-actions github-actions bot added team: delivery Issue belongs to the self-hosted team team: webapp Issue belongs to the WebApp team labels Jun 30, 2022
@easyCZ easyCZ force-pushed the mp/usage-config-file branch from 983ede3 to 65ef78c Compare July 1, 2022 07:49
@easyCZ
Copy link
Member Author

easyCZ commented Jul 1, 2022

/werft run with-preview

👍 started the job as gitpod-build-mp-usage-config-file.11
(with .werft/ from main)

@easyCZ
Copy link
Member Author

easyCZ commented Jul 1, 2022

/werft run with-preview

👍 started the job as gitpod-build-mp-usage-config-file.12
(with .werft/ from main)

@easyCZ easyCZ force-pushed the mp/usage-config-file branch from 65ef78c to f17c0a1 Compare July 1, 2022 09:40
@easyCZ easyCZ force-pushed the mp/usage-config-file branch from f17c0a1 to fe4babe Compare July 1, 2022 11:58
@easyCZ
Copy link
Member Author

easyCZ commented Jul 4, 2022

/werft run with-preview

👍 started the job as gitpod-build-mp-usage-config-file.15
(with .werft/ from main)

if err != nil {
log.WithError(err).Fatal("Failed to start usage server.")
}
},
}

localConfig := path.Join(os.ExpandEnv("GOMOD"), "..", "config.json")
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the use case here? Why do we expect config.json one level up from the go.mod?

Copy link
Member Author

Choose a reason for hiding this comment

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

GOMOD points to where the go.mod is defined, in our case that is GOMOD="/workspace/gitpod/components/usage/go.mod". The .. drops the filename and we then join it with our desired filename.

See playground

@roboquat roboquat merged commit e8ab39e into main Jul 4, 2022
@roboquat roboquat deleted the mp/usage-config-file branch July 4, 2022 15:14
@roboquat roboquat added the deployed: webapp Meta team change is running in production label Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: webapp Meta team change is running in production release-note-none size/XL team: delivery Issue belongs to the self-hosted team team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure the usage component using a config file rather than command line arguments.
4 participants