Skip to content

Commit 2093016

Browse files
Andrew Farriesroboquat
Andrew Farries
authored andcommitted
[installer] Make chargbee configurable for server
1 parent 0886b21 commit 2093016

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

install/installer/pkg/components/server/configmap.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
7474
return nil
7575
})
7676

77+
chargebeeSecret := ""
78+
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
79+
if cfg.WebApp != nil && cfg.WebApp.Server != nil {
80+
chargebeeSecret = cfg.WebApp.Server.ChargebeeSecret
81+
}
82+
return nil
83+
})
84+
7785
githubApp := GitHubApp{}
7886
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
7987
if cfg.WebApp != nil && cfg.WebApp.Server != nil && cfg.WebApp.Server.GithubApp != nil {
@@ -162,9 +170,9 @@ func configmap(ctx *common.RenderContext) ([]runtime.Object, error) {
162170
ImageBuilderAddr: "image-builder-mk3:8080",
163171
CodeSync: CodeSync{},
164172
VSXRegistryUrl: fmt.Sprintf("https://open-vsx.%s", ctx.Config.Domain), // todo(sje): or "https://{{ .Values.vsxRegistry.host | default "open-vsx.org" }}" if not using OpenVSX proxy
165-
EnablePayment: false,
173+
EnablePayment: chargebeeSecret != "",
174+
ChargebeeProviderOptionsFile: fmt.Sprintf("%s/providerOptions", chargebeeMountPath),
166175
InsecureNoDomain: false,
167-
ChargebeeProviderOptionsFile: "/chargebee/providerOptions",
168176
PrebuildLimiter: map[string]int{
169177
// default limit for all cloneURLs
170178
"*": 50,

install/installer/pkg/components/server/constants.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const (
1414
ContainerPortName = "http"
1515
authProviderFilePath = "/gitpod/auth-providers"
1616
licenseFilePath = "/gitpod/license"
17+
chargebeeMountPath = "/chargebee"
1718
PrometheusPort = 9500
1819
PrometheusPortName = "metrics"
1920
InstallationAdminPort = common.ServerInstallationAdminPort

install/installer/pkg/components/server/deployment.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,30 @@ func deployment(ctx *common.RenderContext) ([]runtime.Object, error) {
164164
env = append(env, envv...)
165165
}
166166

167+
chargebeeSecret := ""
168+
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
169+
if cfg.WebApp != nil && cfg.WebApp.Server != nil && cfg.WebApp.Server.ChargebeeSecret != "" {
170+
chargebeeSecret = cfg.WebApp.Server.ChargebeeSecret
171+
172+
volumes = append(volumes,
173+
corev1.Volume{
174+
Name: "chargebee-config",
175+
VolumeSource: corev1.VolumeSource{
176+
Secret: &corev1.SecretVolumeSource{
177+
SecretName: chargebeeSecret,
178+
},
179+
},
180+
})
181+
182+
volumeMounts = append(volumeMounts, corev1.VolumeMount{
183+
Name: "chargebee-config",
184+
MountPath: chargebeeMountPath,
185+
ReadOnly: true,
186+
})
187+
}
188+
return nil
189+
})
190+
167191
var podAntiAffinity *corev1.PodAntiAffinity
168192
_ = ctx.WithExperimental(func(cfg *experimental.Config) error {
169193
if cfg.WebApp != nil && cfg.WebApp.UsePodAntiAffinity {

install/installer/pkg/config/v1/experimental/experimental.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ type ServerConfig struct {
125125
OAuthServer OAuthServer `json:"oauthServer"`
126126
Session Session `json:"session"`
127127
GithubApp *GithubApp `json:"githubApp"`
128+
ChargebeeSecret string `json:"chargebeeSecret"`
128129
DisableDynamicAuthProviderLogin bool `json:"disableDynamicAuthProviderLogin"`
129130
EnableLocalApp bool `json:"enableLocalApp"`
130131
DefaultBaseImageRegistryWhiteList []string `json:"defaultBaseImageRegistryWhitelist"`

0 commit comments

Comments
 (0)