Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/install/installer/pkg/components/minio/incluster/minio.go
2504 views
1
// Copyright (c) 2021 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package incluster
6
7
import (
8
"fmt"
9
10
"github.com/gitpod-io/gitpod/installer/pkg/cluster"
11
"github.com/gitpod-io/gitpod/installer/pkg/common"
12
"github.com/gitpod-io/gitpod/installer/pkg/helm"
13
"github.com/gitpod-io/gitpod/installer/third_party/charts"
14
"helm.sh/helm/v3/pkg/cli/values"
15
)
16
17
var Helm = func(apiPort int32, consolePort int32, commonHelmValues []string) common.HelmFunc {
18
return common.CompositeHelmFunc(
19
helm.ImportTemplate(charts.Minio(), helm.TemplateConfig{}, func(cfg *common.RenderContext) (*common.HelmConfig, error) {
20
affinity, err := helm.AffinityYaml(cluster.AffinityLabelMeta)
21
if err != nil {
22
return nil, err
23
}
24
25
affinityTemplate, err := helm.KeyFileValue("minio.affinity", affinity)
26
if err != nil {
27
return nil, err
28
}
29
30
tolerations, err := helm.WithTolerationWorkspaceComponentNotReadyYaml(cfg)
31
if err != nil {
32
return nil, err
33
}
34
tolerationsTemplate, err := helm.KeyFileValue("minio.tolerations", tolerations)
35
if err != nil {
36
return nil, err
37
}
38
39
return &common.HelmConfig{
40
Enabled: true,
41
Values: &values.Options{
42
Values: append(
43
[]string{
44
helm.KeyValue("minio.auth.rootUser", cfg.Values.StorageAccessKey),
45
helm.KeyValue("minio.auth.rootPassword", cfg.Values.StorageSecretKey),
46
helm.KeyValue("minio.service.ports.api", fmt.Sprintf("%d", apiPort)),
47
helm.KeyValue("minio.service.ports.console", fmt.Sprintf("%d", consolePort)),
48
},
49
commonHelmValues...,
50
),
51
// This is too complex to be sent as a string
52
FileValues: []string{
53
affinityTemplate,
54
tolerationsTemplate,
55
},
56
},
57
}, nil
58
}),
59
)
60
}
61
62