github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/runtime/disabled_components.go (about)

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