Sfoglia il codice sorgente

assorted changes (#3635)

Co-authored-by: David Townley <davidtownley@Davids-MacBook-Air.local>
d-g-town 2 anni fa
parent
commit
395f01b21c

+ 10 - 10
dashboard/src/components/AzureCostConsent.tsx

@@ -53,7 +53,7 @@ const AzureCostConsent: React.FC<Props> = ({
           noWrapper
           expandText="[+] Show details"
           collapseText="[-] Hide details"
-          Header={<Cost>$314.92 / mo</Cost>}
+          Header={<Cost>$210.24 / mo</Cost>}
           ExpandedSection={
             <>
               <Spacer height="15px" />
@@ -62,14 +62,14 @@ const AzureCostConsent: React.FC<Props> = ({
                 <Spacer height="15px" />
                 • Amazon EC2:
                 <Spacer height="15px" />
-                <Tab />+ System workloads: Standard_D2ps_v5 instance (2) =
-                $110.88/mo
+                <Tab />+ System workloads: Standard_B2als_v2 instance (3) =
+                $82.34/mo
                 <Spacer height="15px" />
-                <Tab />+ Monitoring workloads: Standard_A2_v2 instance (1) =
-                $65.52/mo
+                <Tab />+ Monitoring workloads: Standard_B2als_v2 instance (1) =
+                $27.45/mo
                 <Spacer height="15px" />
-                <Tab />+ Application workloads: Standard_A2_v2 instance (1) =
-                $65.52/mo
+                <Tab />+ Application workloads: Standard_B2als_v2 instance (1) =
+                $27.45/mo
               </Fieldset>
             </>
           }
@@ -103,12 +103,12 @@ const AzureCostConsent: React.FC<Props> = ({
         <Spacer y={0.5} />
         <Text color="helper">
           All Azure resources will be automatically deleted when you delete your
-          Porter project. Please enter the Azure base cost ("314.92") below to
+          Porter project. Please enter the Azure base cost ("210.24") below to
           proceed:
         </Text>
         <Spacer y={1} />
         <Input
-          placeholder="314.92"
+          placeholder="210.24"
           value={confirmCost}
           setValue={setConfirmCost}
           width="100%"
@@ -116,7 +116,7 @@ const AzureCostConsent: React.FC<Props> = ({
         />
         <Spacer y={1} />
         <Button
-          disabled={confirmCost !== "314.92"}
+          disabled={confirmCost !== "210.24"}
           onClick={() => {
             setShowCostConfirmModal(false);
             setConfirmCost("");

+ 21 - 3
dashboard/src/components/AzureProvisionerSettings.tsx

@@ -30,9 +30,27 @@ import Text from "./porter/Text";
 
 const locationOptions = [
   { value: "eastus", label: "East US" },
+  { value: "eastus2", label: "East US 2" },
+    { value: "westus2", label: "West US 2" },
+    { value: "westus3", label: "West US 3" },
+    { value: "centralus", label: "Central US" },
+    { value: "southcentralus", label: "South Central US" },
+    { value: "australiaeast", label: "Australia East" },
+    { value: "brazilsouth", label: "Brazil South" },
+    { value: "centralindia", label: "Central India" },
+    { value: "southcentralus", label: "South Central US" },
+    { value: "eastasia", label: "East Asia" },
+    { value: "francecentral", label: "France Central" },
+    { value: "northeurope", label: "North Europe" },
+    { value: "norwayeast", label: "Norway East" },
+    { value: "swedencentral", label: "Sweden Central" },
+    { value: "switzerlandnorth", label: "Switzerland North" },
+    { value: "uksouth", label: "UK South" },
+    { value: "westeurope", label: "West Europe" },
 ];
 
 const machineTypeOptions = [
+  { value: "Standard_B2als_v2", label: "Standard_B2als_v2"},
   { value: "Standard_A2_v2", label: "Standard_A2_v2" },
   { value: "Standard_A4_v2", label: "Standard_A4_v2" },
 ];
@@ -60,7 +78,7 @@ const AzureProvisionerSettings: React.FC<Props> = (props) => {
   const [createStatus, setCreateStatus] = useState("");
   const [clusterName, setClusterName] = useState("");
   const [azureLocation, setAzureLocation] = useState("eastus");
-  const [machineType, setMachineType] = useState("Standard_A2_v2");
+  const [machineType, setMachineType] = useState("Standard_B2als_v2");
   const [isExpanded, setIsExpanded] = useState(false);
   const [minInstances, setMinInstances] = useState(1);
   const [maxInstances, setMaxInstances] = useState(10);
@@ -170,14 +188,14 @@ const AzureProvisionerSettings: React.FC<Props> = (props) => {
             location: azureLocation,
             nodePools: [
               new AKSNodePool({
-                instanceType: "Standard_D2ps_v5",
+                instanceType: "Standard_B2als_v2",
                 minInstances: 1,
                 maxInstances: 3,
                 nodePoolType: NodePoolType.SYSTEM,
                 mode: "User",
               }),
               new AKSNodePool({
-                instanceType: "Standard_A2_v2",
+                instanceType: "Standard_B2als_v2",
                 minInstances: 1,
                 maxInstances: 3,
                 nodePoolType: NodePoolType.MONITORING,

+ 12 - 5
internal/porter_app/parse.go

@@ -42,7 +42,7 @@ func ParseYAML(ctx context.Context, porterYaml []byte, appName string) (*porterv
 
 	switch version.Version {
 	case PorterYamlVersion_V2:
-		appProto, envVariables, err = v2.AppProtoFromYaml(ctx, porterYaml, appName)
+		appProto, envVariables, err = v2.AppProtoFromYaml(ctx, porterYaml)
 		if err != nil {
 			return nil, nil, telemetry.Error(ctx, span, err, "error converting v2 yaml to proto")
 		}
@@ -50,10 +50,7 @@ func ParseYAML(ctx context.Context, porterYaml []byte, appName string) (*porterv
 	// track this span in telemetry and reach out to customers who are still using old porter.yaml if they exist.
 	// once no one is converting from old porter.yaml, we can remove this code
 	case PorterYamlVersion_V1, "":
-		if appName == "" {
-			return nil, nil, telemetry.Error(ctx, span, nil, "v1 porter yaml requires externally-provided app name")
-		}
-		appProto, envVariables, err = v1.AppProtoFromYaml(ctx, porterYaml, appName)
+		appProto, envVariables, err = v1.AppProtoFromYaml(ctx, porterYaml)
 		if err != nil {
 			return nil, nil, telemetry.Error(ctx, span, err, "error converting v1 yaml to proto")
 		}
@@ -65,6 +62,16 @@ func ParseYAML(ctx context.Context, porterYaml []byte, appName string) (*porterv
 		return nil, nil, telemetry.Error(ctx, span, nil, "porter yaml output is nil")
 	}
 
+	if appName != "" {
+		telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "override-name", Value: appName})
+		if appProto.Name != "" && appProto.Name != appName {
+			telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "parsed-name", Value: appProto.Name})
+			return nil, nil, telemetry.Error(ctx, span, nil, "name specified in porter.yaml does not match app name")
+		}
+
+		appProto.Name = appName
+	}
+
 	return appProto, envVariables, nil
 }
 

+ 2 - 6
internal/porter_app/v1/yaml.go

@@ -15,12 +15,10 @@ import (
 )
 
 // AppProtoFromYaml converts an old version Porter YAML file into a PorterApp proto object
-func AppProtoFromYaml(ctx context.Context, porterYamlBytes []byte, appName string) (*porterv1.PorterApp, map[string]string, error) {
+func AppProtoFromYaml(ctx context.Context, porterYamlBytes []byte) (*porterv1.PorterApp, map[string]string, error) {
 	ctx, span := telemetry.NewSpan(ctx, "v1-app-proto-from-yaml")
 	defer span.End()
 
-	telemetry.WithAttributes(span, telemetry.AttributeKV{Key: "app-name", Value: appName})
-
 	if porterYamlBytes == nil {
 		return nil, nil, telemetry.Error(ctx, span, nil, "porter yaml is nil")
 	}
@@ -31,9 +29,7 @@ func AppProtoFromYaml(ctx context.Context, porterYamlBytes []byte, appName strin
 		return nil, nil, telemetry.Error(ctx, span, err, "error unmarshaling porter yaml")
 	}
 
-	appProto := &porterv1.PorterApp{
-		Name: appName,
-	}
+	appProto := &porterv1.PorterApp{}
 
 	if porterYaml.Build != nil {
 		appProto.Build = &porterv1.Build{

+ 1 - 11
internal/porter_app/v2/yaml.go

@@ -12,7 +12,7 @@ import (
 )
 
 // AppProtoFromYaml converts a Porter YAML file into a PorterApp proto object
-func AppProtoFromYaml(ctx context.Context, porterYamlBytes []byte, appName string) (*porterv1.PorterApp, map[string]string, error) {
+func AppProtoFromYaml(ctx context.Context, porterYamlBytes []byte) (*porterv1.PorterApp, map[string]string, error) {
 	ctx, span := telemetry.NewSpan(ctx, "v2-app-proto-from-yaml")
 	defer span.End()
 
@@ -26,20 +26,10 @@ func AppProtoFromYaml(ctx context.Context, porterYamlBytes []byte, appName strin
 		return nil, nil, telemetry.Error(ctx, span, err, "error unmarshaling porter yaml")
 	}
 
-	// if the porter yaml is missing a name field, use the app name that is provided in the request
-	if porterYaml.Name == "" {
-		porterYaml.Name = appName
-	}
-
-	if porterYaml.Name != "" && appName != "" && porterYaml.Name != appName {
-		return nil, nil, telemetry.Error(ctx, span, nil, "name specified in porter.yaml does not match app name")
-	}
-
 	appProto := &porterv1.PorterApp{
 		Name: porterYaml.Name,
 	}
 
-
 	if porterYaml.Build != nil {
 		appProto.Build = &porterv1.Build{
 			Context:    porterYaml.Build.Context,