kuma

Форк
0
41 строка · 1.4 Кб
1
package universal
2

3
import (
4
	"time"
5

6
	"github.com/pkg/errors"
7
	"go.uber.org/multierr"
8

9
	"github.com/kumahq/kuma/pkg/config"
10
	config_types "github.com/kumahq/kuma/pkg/config/types"
11
)
12

13
func DefaultUniversalRuntimeConfig() *UniversalRuntimeConfig {
14
	return &UniversalRuntimeConfig{
15
		DataplaneCleanupAge: config_types.Duration{Duration: 3 * 24 * time.Hour},
16
		VIPRefreshInterval:  config_types.Duration{Duration: 500 * time.Millisecond},
17
	}
18
}
19

20
var _ config.Config = &UniversalRuntimeConfig{}
21

22
// UniversalRuntimeConfig defines Universal-specific configuration
23
type UniversalRuntimeConfig struct {
24
	config.BaseConfig
25

26
	// DataplaneCleanupAge defines how long Dataplane should be offline to be cleaned up by GC
27
	DataplaneCleanupAge config_types.Duration `json:"dataplaneCleanupAge" envconfig:"kuma_runtime_universal_dataplane_cleanup_age"`
28
	// VIPRefreshInterval defines how often all meshes' VIPs should be recomputed
29
	VIPRefreshInterval config_types.Duration `json:"vipRefreshInterval" envconfig:"kuma_runtime_universal_vip_refresh_interval"`
30
}
31

32
func (u *UniversalRuntimeConfig) Validate() error {
33
	var errs error
34
	if u.DataplaneCleanupAge.Duration <= 0 {
35
		errs = multierr.Append(errs, errors.Errorf(".DataplaneCleanupAge must be positive"))
36
	}
37
	if u.VIPRefreshInterval.Duration <= 0 {
38
		errs = multierr.Append(errs, errors.Errorf(".VIPRefreshInterval must be positive"))
39
	}
40
	return errs
41
}
42

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.