Debian Codegraph @

api/types/pluginconfig.go

raw
1 // Copyright 2019 The Kubernetes Authors.
2 // SPDX-License-Identifier: Apache-2.0
3
4 package types
5
6 type HelmConfig struct {
7 Enabled bool
8 Command string
9 ApiVersions []string
10 KubeVersion string
11 Debug bool
12 }
13
14 // PluginConfig holds plugin configuration.
15 type PluginConfig struct {
16 // PluginRestrictions distinguishes plugin restrictions.
17 PluginRestrictions PluginRestrictions
18
19 // BpLoadingOptions distinguishes builtin plugin behaviors.
20 BpLoadingOptions BuiltinPluginLoadingOptions
21
22 // FnpLoadingOptions sets the way function-based plugin behaviors.
23 FnpLoadingOptions FnPluginLoadingOptions
24
25 // HelmConfig contains metadata needed for allowing and running helm.
26 HelmConfig HelmConfig
27 }
28
29 func EnabledPluginConfig(b BuiltinPluginLoadingOptions) (pc *PluginConfig) {
30 pc = MakePluginConfig(PluginRestrictionsNone, b)
31 pc.HelmConfig.Enabled = true
32 // If this command is not on PATH, tests needing it should skip.
33 pc.HelmConfig.Command = "helmV3"
34 return
35 }
36
37 func DisabledPluginConfig() *PluginConfig {
38 return MakePluginConfig(
39 PluginRestrictionsBuiltinsOnly,
40 BploUseStaticallyLinked)
41 }
42
43 func MakePluginConfig(pr PluginRestrictions,
44 b BuiltinPluginLoadingOptions) *PluginConfig {
45 return &PluginConfig{
46 PluginRestrictions: pr,
47 BpLoadingOptions: b,
48 }
49 }