Path: blob/main/components/ws-daemon/pkg/daemon/config.go
2501 views
// Copyright (c) 2020 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package daemon56import (7"context"89"github.com/gitpod-io/gitpod/ws-daemon/pkg/cgroup"10"github.com/gitpod-io/gitpod/ws-daemon/pkg/container"11"github.com/gitpod-io/gitpod/ws-daemon/pkg/content"12"github.com/gitpod-io/gitpod/ws-daemon/pkg/cpulimit"13"github.com/gitpod-io/gitpod/ws-daemon/pkg/diskguard"14"github.com/gitpod-io/gitpod/ws-daemon/pkg/iws"15"github.com/gitpod-io/gitpod/ws-daemon/pkg/netlimit"16"k8s.io/apimachinery/pkg/api/resource"17)1819// Config configures the workspace node daemon20type Config struct {21Runtime RuntimeConfig `json:"runtime"`2223Content content.Config `json:"content"`24Uidmapper iws.UidmapperConfig `json:"uidmapper"`25CPULimit cpulimit.Config `json:"cpulimit"`26IOLimit IOLimitConfig `json:"ioLimit"`27ProcLimit int64 `json:"procLimit"`28NetLimit netlimit.Config `json:"netlimit"`29OOMScores cgroup.OOMScoreAdjConfig `json:"oomScores"`30DiskSpaceGuard diskguard.Config `json:"disk"`31WorkspaceController WorkspaceControllerConfig `json:"workspaceController"`3233RegistryFacadeHost string `json:"registryFacadeHost,omitempty"`34}3536type WorkspaceControllerConfig struct {37MaxConcurrentReconciles int `json:"maxConcurrentReconciles,omitempty"`38}3940type RuntimeConfig struct {41Container *container.Config `json:"containerRuntime"`42Kubeconfig string `json:"kubeconfig"`43KubernetesNamespace string `json:"namespace"`44SecretsNamespace string `json:"secretsNamespace"`4546WorkspaceCIDR string `json:"workspaceCIDR,omitempty"`47}4849type IOLimitConfig struct {50WriteBWPerSecond resource.Quantity `json:"writeBandwidthPerSecond"`51ReadBWPerSecond resource.Quantity `json:"readBandwidthPerSecond"`52WriteIOPS int64 `json:"writeIOPS"`53ReadIOPS int64 `json:"readIOPS"`54}5556type ConfigReloader interface {57ReloadConfig(context.Context, *Config) error58}5960type ConfigReloaderFunc func(context.Context, *Config) error6162func (f ConfigReloaderFunc) ReloadConfig(ctx context.Context, cfg *Config) error {63return f(ctx, cfg)64}6566type CompositeConfigReloader []ConfigReloader6768func (cs CompositeConfigReloader) ReloadConfig(ctx context.Context, cfg *Config) error {69for _, c := range cs {70err := c.ReloadConfig(ctx, cfg)71if err != nil {72return err73}74if err := ctx.Err(); err != nil {75return err76}77}78return nil79}808182