forked from kyma-project/control-plane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
disabled_components.go
65 lines (58 loc) · 1.77 KB
/
disabled_components.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package runtime
import (
"fmt"
"github.com/kyma-project/control-plane/components/kyma-environment-broker/internal/broker"
"github.com/kyma-project/control-plane/components/kyma-environment-broker/internal/runtime/components"
)
//
// DisabledComponentsProvider provides a list of the components to disable per a specific plan
// more specifically it's map[PLAN_ID or SELECTOR][COMPONENT_NAME]
//
// Components located under the AllPlansSelector will be removed from every plan
// All plans must be specified
//
type DisabledComponentsProvider map[string]map[string]struct{}
func NewDisabledComponentsProvider() DisabledComponentsProvider {
return map[string]map[string]struct{}{
broker.AllPlansSelector: {
components.Backup: {},
components.BackupInit: {},
},
broker.OpenStackPlanID: {
components.KnativeEventingKafka: {},
},
broker.GCPPlanID: {
components.KnativeEventingKafka: {},
},
broker.AzurePlanID: {
components.NatsStreaming: {},
components.KnativeProvisionerNatss: {},
},
broker.AzureLitePlanID: {
components.NatsStreaming: {},
components.KnativeProvisionerNatss: {},
},
broker.AzureHAPlanID: {
components.NatsStreaming: {},
components.KnativeProvisionerNatss: {},
},
broker.AWSPlanID: {
components.KnativeEventingKafka: {},
},
broker.TrialPlanID: {
components.KnativeEventingKafka: {},
},
broker.FreemiumPlanID: {
components.KnativeEventingKafka: {},
},
}
}
func (p DisabledComponentsProvider) DisabledComponentsPerPlan(planID string) (map[string]struct{}, error) {
if _, ok := p[planID]; !ok {
return nil, fmt.Errorf("unknown plan %s", planID)
}
return p[planID], nil
}
func (p DisabledComponentsProvider) DisabledForAll() map[string]struct{} {
return p[broker.AllPlansSelector]
}