Skip to content

June release hotfixes #10968

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 4 commits into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/licensor/ee/pkg/licensor/licensor.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type LicensePayload struct {
Seats int `json:"seats"`

// CustomerID is used to identify installations in installation analytics
CustomerID string `json:"customerID"`
CustomerID string `json:"customerID,omitempty"`
}

type licensePayload struct {
Expand Down
20 changes: 12 additions & 8 deletions components/ws-manager/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,18 @@ var runCmd = &cobra.Command{
log.WithError(err).Fatal(err, "unable to create controller", "controller", "Pod")
}

err = (&manager.VolumeSnapshotReconciler{
Monitor: monitor,
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("VolumeSnapshot"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr)
if err != nil {
log.WithError(err).Fatal(err, "unable to create controller", "controller", "VolumeSnapshot")
// enable the volume snapshot controller when the VolumeSnapshot CRD exists
_, err = clientset.DiscoveryClient.ServerResourcesForGroupVersion(volumesnapshotv1.SchemeGroupVersion.String())
if err == nil {
err = (&manager.VolumeSnapshotReconciler{
Monitor: monitor,
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("controllers").WithName("VolumeSnapshot"),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr)
if err != nil {
log.WithError(err).Fatal(err, "unable to create controller", "controller", "VolumeSnapshot")
}
}

if cfg.PProf.Addr != "" {
Expand Down
6 changes: 6 additions & 0 deletions install/installer/pkg/components/docker-registry/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ var Helm = common.CompositeHelmFunc(
}
}

// Append the custom parameters
registryValues = helm.CustomizeAnnotation(registryValues, "docker-registry.podAnnotations", cfg, Component, common.TypeMetaDeployment)
registryValues = helm.CustomizeLabel(registryValues, "docker-registry.podLabels", cfg, Component, common.TypeMetaDeployment)
registryValues = helm.CustomizeAnnotation(registryValues, "docker-registry.service.annotations", cfg, Component, common.TypeMetaService)
registryValues = helm.CustomizeEnvvar(registryValues, "docker-registry.extraEnvVars", cfg, Component)

inCluster := pointer.BoolDeref(cfg.Config.ContainerRegistry.InCluster, false)
s3Storage := cfg.Config.ContainerRegistry.S3Storage
enablePersistence := "true"
Expand Down
58 changes: 57 additions & 1 deletion install/installer/pkg/helm/helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@ import (
"os"
"os/signal"
"path/filepath"
"sigs.k8s.io/yaml"
"strings"
"syscall"

"sigs.k8s.io/yaml"

"github.com/gitpod-io/gitpod/installer/pkg/common"
"github.com/gitpod-io/gitpod/installer/third_party/charts"
"helm.sh/helm/v3/pkg/action"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/downloader"
"helm.sh/helm/v3/pkg/getter"
"helm.sh/helm/v3/pkg/release"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// TemplateConfig
Expand Down Expand Up @@ -209,3 +212,56 @@ func ImportTemplate(chart *charts.Chart, templateCfg TemplateConfig, pkgConfig P
return append(templates, rel.Manifest), nil
}
}

// CustomizeAnnotation check for customized annotations and output in Helm format
func CustomizeAnnotation(registryValues []string, prefix string, ctx *common.RenderContext, component string, typeMeta metav1.TypeMeta, existingAnnotations ...func() map[string]string) []string {
annotations := common.CustomizeAnnotation(ctx, component, common.TypeMetaDeployment, existingAnnotations...)
if len(annotations) > 0 {
for k, v := range annotations {
registryValues = append(registryValues, KeyValue(fmt.Sprintf("%s.%s", prefix, k), v))
}
}

return registryValues
}

// CustomizeLabel check for customized labels and output in Helm format - also removes the default labels, which conflict with Helm
func CustomizeLabel(registryValues []string, prefix string, ctx *common.RenderContext, component string, typeMeta metav1.TypeMeta, existingLabels ...func() map[string]string) []string {
labels := common.CustomizeLabel(ctx, component, common.TypeMetaDeployment, existingLabels...)

// Remove the default labels
for k := range common.DefaultLabels(component) {
delete(labels, k)
}

if len(labels) > 0 {
for k, v := range labels {
registryValues = append(registryValues, KeyValue(fmt.Sprintf("%s.%s", prefix, k), v))
}
}

return registryValues
}

// CustomizeEnvvar check for customized envvars and output in Helm format - assumes name/value only
func CustomizeEnvvar(registryValues []string, prefix string, ctx *common.RenderContext, component string, existingEnvvars ...[]corev1.EnvVar) []string {
// Helm is unlikely to have any existing envvars, so treat them as optional
envvars := common.CustomizeEnvvar(ctx, component, func() []corev1.EnvVar {
envs := make([]corev1.EnvVar, 0)

for _, e := range existingEnvvars {
envs = append(envs, e...)
}

return envs
}())

if len(envvars) > 0 {
for k, v := range envvars {
registryValues = append(registryValues, KeyValue(fmt.Sprintf("%s[%d].name", prefix, k), v.Name))
registryValues = append(registryValues, KeyValue(fmt.Sprintf("%s[%d].value", prefix, k), v.Value))
}
}

return registryValues
}