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

[usage] Configure Stripe Price IDs through installer #14124

Merged
merged 1 commit into from
Oct 25, 2022

Conversation

easyCZ
Copy link
Member

@easyCZ easyCZ commented Oct 24, 2022

Description

Loads Stripe Price ID configuration from installer config. These fields are already defined in https://github.com/gitpod-io/ops/commit/a5855e723fe7b703d81b5f09a4869fef186b5581

The prices IDs are only loaded into the deployment, but do not get used. This allows us to validate it before we make code changes to start using them.

Related Issue(s)

Fixes #14115

How to test

  1. Preview configmap for usage contains the price IDs

Release Notes

NONE

Documentation

Werft options:

  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-integration-tests=all
    Valid options are all, workspace, webapp, ide

@easyCZ easyCZ requested review from a team October 24, 2022 12:23
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-mp-usage-configure-price-ids.1 because the annotations in the pull request description changed
(with .werft/ from main)

@github-actions github-actions bot added team: SID team: webapp Issue belongs to the WebApp team labels Oct 24, 2022
@easyCZ easyCZ force-pushed the mp/usage-configure-price-ids branch from f769968 to 342bcc4 Compare October 24, 2022 13:29
@laushinka
Copy link
Contributor

Thanks for this, @easyCZ! How do I preview the configmap?

@easyCZ
Copy link
Member Author

easyCZ commented Oct 25, 2022

In preview, kubectl get configmap usage -o yaml

@@ -277,6 +277,12 @@ EOF`);
exec(`yq w -i ${this.options.installerConfigPath} experimental.webapp.usage.defaultSpendingLimit.minForUsersOnStripe 1000`, { slice: slice })
exec(`yq w -i ${this.options.installerConfigPath} experimental.webapp.usage.creditsPerMinuteByWorkspaceClass['default'] 0.1666666667`, { slice: slice })
exec(`yq w -i ${this.options.installerConfigPath} experimental.webapp.usage.creditsPerMinuteByWorkspaceClass['gitpodio-internal-xl'] 0.3333333333`, { slice: slice })

// Configure Price IDs
exec(`yq w -i ${this.options.installerConfigPath} experimental.webapp.stripe.individualUsagePriceIds['EUR'] price_1LmYVxGadRXm50o3AiLq0Qmo`, { slice: slice })
Copy link
Contributor

Choose a reason for hiding this comment

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

I see empty strings in the installer config when I ran kubectl get configmap usage -o yaml, but I expected these ones for preview?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, it's gonna be because changes to .werft don't get triggered by PRs. I need to manually trigger.

Copy link
Member Author

@easyCZ easyCZ Oct 25, 2022

Choose a reason for hiding this comment

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

I've triggered the build. If you look at the preview env now, it does contain the config.

Sorry, this one always catches me out and I forgot to do this for the PR when I created it, I had it on a different branch before.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, looks good!

Comment on lines +170 to +179
type StripePriceIDs struct {
EUR string `json:"eur"`
USD string `json:"usd"`
}

type StripeConfig struct {
IndividualUsagePriceIDs StripePriceIDs `json:"individualUsagePriceIds"`
TeamUsagePriceIDs StripePriceIDs `json:"teamUsagePriceIds"`
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Hey Milan, I've just joined the team so I'm still catching up on decisions around the installer 😬

How do we decide if things go to "experimental" or not? maybe @mrsimonemms could help clarifying as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

@ArthurSens as a general rule, anything that's in experimental is for config that's either specific to SaaS or (in rarer cases) to support a specific paying customer. Anything in experimental should be considered liable to change without notice.

Things are only added to the main config if it's something that we are happy to publicly support (including community/open source users), we have updated the public documentation (and usually added to the KOTS config) and that we are confident we won't need to amend.

Looking at this, it looks like @easyCZ has correctly put it in experimental as this is a SaaS-specific config parameter.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks Simon. Yes, indeed this is config only specific to SaaS at this point, hence defined in the experimental section.

@easyCZ
Copy link
Member Author

easyCZ commented Oct 25, 2022

@ArthurSens Are you happy with the PR as is? If so, would appreciate a ✅

Copy link
Contributor

@ArthurSens ArthurSens left a comment

Choose a reason for hiding this comment

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

Yes, if Simon didn't see any problems so I'm also good :)

@roboquat roboquat merged commit 7a5f156 into main Oct 25, 2022
@roboquat roboquat deleted the mp/usage-configure-price-ids branch October 25, 2022 19:53
@roboquat roboquat added the deployed: webapp Meta team change is running in production label Oct 26, 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/M team: SID team: webapp Issue belongs to the WebApp team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move Stripe price IDs to the installer
5 participants