瀏覽代碼

Feature flag quota (#3882)

sdess09 2 年之前
父節點
當前提交
786da5c3b0

+ 1 - 0
api/types/project.go

@@ -42,6 +42,7 @@ type Project struct {
 	FullAddOns             bool    `json:"full_add_ons"`
 	EnableReprovision      bool    `json:"enable_reprovision"`
 	ValidateApplyV2        bool    `json:"validate_apply_v2"`
+	QuotaIncrease          bool    `json:"quota_increase"`
 }
 
 type FeatureFlags struct {

+ 1 - 4
dashboard/src/components/ProvisionerSettings.tsx

@@ -518,7 +518,6 @@ const ProvisionerSettings: React.FC<Props> = (props) => {
     await requestQuotaIncrease()
     await createCluster()
   }
-
   const requestQuotaIncrease = async () => {
 
     try {
@@ -551,8 +550,6 @@ const ProvisionerSettings: React.FC<Props> = (props) => {
 
   }
 
-
-
   const preflightChecks = async () => {
 
     try {
@@ -1112,7 +1109,7 @@ const ProvisionerSettings: React.FC<Props> = (props) => {
                   <Spacer y={.5} />
                   {(preflightFailed && preflightData) &&
                     <>
-                      {(showHelpMessage) ? <>
+                      {(showHelpMessage && currentProject?.quota_increase) ? <>
                         <Text color="helper">
                           Your account currently is blocked from provisioning in {awsRegion} due to a quota limit imposed by AWS. Either change the region or request to increase quotas.
                         </Text>

+ 1 - 1
dashboard/src/main/home/sidebar/ClusterList.tsx

@@ -120,7 +120,7 @@ const ClusterList: React.FC<PropsType> = (props) => {
             {(clusters.length > 1 || user.isPorterUser) && <i className="material-icons">arrow_drop_down</i>}
           </NavButton>
         </MainSelector>
-        {(clusters.length > 1 || user.isPorterUser) && renderDropdown()}
+        {(clusters.length > 1) && renderDropdown()}
         {
           clusterModalVisible && <ProvisionClusterModal
             closeModal={() => setClusterModalVisible(false)} />

+ 7 - 1
internal/models/project.go

@@ -49,6 +49,9 @@ const (
 	// RDSDatabasesEnabled allows for users to provision RDS instances within their cluster vpc
 	RDSDatabasesEnabled FeatureFlagLabel = "rds_databases_enabled"
 
+	// QuotaIncrease enables whether we allow for auto increase of quota_increase
+	QuotaIncrease FeatureFlagLabel = "quota_increase"
+
 	// SimplifiedViewEnabled shows the new UI dashboard or not
 	SimplifiedViewEnabled FeatureFlagLabel = "simplified_view_enabled"
 
@@ -72,6 +75,7 @@ var ProjectFeatureFlags = map[FeatureFlagLabel]bool{
 	MultiCluster:           false,
 	PreviewEnvsEnabled:     false,
 	RDSDatabasesEnabled:    false,
+	QuotaIncrease:          false,
 	SimplifiedViewEnabled:  true,
 	StacksEnabled:          false,
 	ValidateApplyV2:        true,
@@ -195,6 +199,8 @@ func (p *Project) GetFeatureFlag(flagName FeatureFlagLabel, launchDarklyClient *
 			return p.MultiCluster
 		case "preview_envs_enabled":
 			return p.PreviewEnvsEnabled
+		case "quota_increase":
+			return false
 		case "rds_databases_enabled":
 			return p.RDSDatabasesEnabled
 		case "simplified_view_enabled":
@@ -225,7 +231,6 @@ func (p *Project) ToProjectType(launchDarklyClient *features.Client) types.Proje
 
 	projectID := p.ID
 	projectName := p.Name
-
 	return types.Project{
 		ID:    projectID,
 		Name:  projectName,
@@ -245,6 +250,7 @@ func (p *Project) ToProjectType(launchDarklyClient *features.Client) types.Proje
 		EnableReprovision:      p.GetFeatureFlag(EnableReprovision, launchDarklyClient),
 		ValidateApplyV2:        p.GetFeatureFlag(ValidateApplyV2, launchDarklyClient),
 		FullAddOns:             p.GetFeatureFlag(FullAddOns, launchDarklyClient),
+		QuotaIncrease:          p.GetFeatureFlag(QuotaIncrease, launchDarklyClient),
 	}
 }