Prechádzať zdrojové kódy

Merge branch 'master' into dev

Mohammed Nafees 3 rokov pred
rodič
commit
b3543f2f41

+ 176 - 2
cli/cmd/deploy.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"os"
 	"path/filepath"
+	"sort"
 	"strings"
 	"time"
 
@@ -18,6 +19,7 @@ import (
 	"github.com/porter-dev/porter/cli/cmd/utils"
 	templaterUtils "github.com/porter-dev/porter/internal/templater/utils"
 	"github.com/spf13/cobra"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/client-go/util/homedir"
 )
 
@@ -224,7 +226,7 @@ var updateEnvGroupCmd = &cobra.Command{
 	Aliases: []string{"eg", "envgroup", "env-groups", "envgroups"},
 	Short:   "Updates an environment group's variables, specified by the --name flag.",
 	Run: func(cmd *cobra.Command, args []string) {
-		color.New(color.FgRed).Println("need to specify an operation to continue")
+		color.New(color.FgRed).Fprintln(os.Stderr, "need to specify an operation to continue")
 	},
 }
 
@@ -268,6 +270,7 @@ var version uint
 var varType string
 var normalEnvGroupVars []string
 var secretEnvGroupVars []string
+var waitForSuccessfulDeploy bool
 
 func init() {
 	buildFlagsEnv = []string{}
@@ -372,6 +375,13 @@ func init() {
 
 	updateCmd.PersistentFlags().MarkDeprecated("force-push", "--force-push is now deprecated")
 
+	updateCmd.PersistentFlags().BoolVar(
+		&waitForSuccessfulDeploy,
+		"wait",
+		false,
+		"set this to wait and be notified when a deployment is successful, otherwise time out",
+	)
+
 	updateCmd.AddCommand(updateGetEnvCmd)
 
 	updateGetEnvCmd.PersistentFlags().StringVar(
@@ -480,6 +490,14 @@ func updateFull(_ *types.GetAuthenticatedUserResponse, client *api.Client, args
 		return err
 	}
 
+	if waitForSuccessfulDeploy {
+		err := checkDeploymentStatus(client)
+
+		if err != nil {
+			return err
+		}
+	}
+
 	return nil
 }
 
@@ -588,7 +606,21 @@ func updateUpgrade(_ *types.GetAuthenticatedUserResponse, client *api.Client, ar
 		return err
 	}
 
-	return updateUpgradeWithAgent(updateAgent)
+	err = updateUpgradeWithAgent(updateAgent)
+
+	if err != nil {
+		return err
+	}
+
+	if waitForSuccessfulDeploy {
+		err := checkDeploymentStatus(client)
+
+		if err != nil {
+			return err
+		}
+	}
+
+	return nil
 }
 
 func updateSetEnvGroup(_ *types.GetAuthenticatedUserResponse, client *api.Client, args []string) error {
@@ -1029,3 +1061,145 @@ func updateUpgradeWithAgent(updateAgent *deploy.DeployAgent) error {
 
 	return nil
 }
+
+func checkDeploymentStatus(client *api.Client) error {
+	color.New(color.FgBlue).Println("waiting for deployment to be ready, this may take a few minutes and will time out if it takes longer than 30 minutes")
+
+	sharedConf := &PorterRunSharedConfig{
+		Client: client,
+	}
+
+	err := sharedConf.setSharedConfig()
+
+	if err != nil {
+		return fmt.Errorf("could not retrieve kubernetes credentials: %w", err)
+	}
+
+	prevRefresh := time.Now()
+	timeWait := prevRefresh.Add(30 * time.Minute)
+	success := false
+
+	depls, err := sharedConf.Clientset.AppsV1().Deployments(namespace).List(
+		context.Background(),
+		metav1.ListOptions{
+			LabelSelector: fmt.Sprintf("app.kubernetes.io/instance=%s", app),
+		},
+	)
+
+	if err != nil {
+		return fmt.Errorf("could not get deployments for app %s: %w", app, err)
+	}
+
+	if len(depls.Items) == 0 {
+		return fmt.Errorf("could not find any deployments for app %s", app)
+	}
+
+	sort.Slice(depls.Items, func(i, j int) bool {
+		return depls.Items[i].CreationTimestamp.After(depls.Items[j].CreationTimestamp.Time)
+	})
+
+	depl := depls.Items[0]
+
+	// determine if the deployment has an appropriate number of ready replicas
+	minAvailable := *(depl.Spec.Replicas) - getMaxUnavailable(depl)
+
+	var revision string
+
+	for k, v := range depl.Spec.Template.ObjectMeta.Annotations {
+		if k == "helm.sh/revision" {
+			revision = v
+			break
+		}
+	}
+
+	if revision == "" {
+		return fmt.Errorf("could not find revision for deployment")
+	}
+
+	pods, err := sharedConf.Clientset.CoreV1().Pods(namespace).List(
+		context.Background(), metav1.ListOptions{
+			LabelSelector: fmt.Sprintf("app.kubernetes.io/instance=%s", app),
+		},
+	)
+
+	if err != nil {
+		return fmt.Errorf("error fetching pods for app %s: %w", app, err)
+	}
+
+	if len(pods.Items) == 0 {
+		return fmt.Errorf("could not find any pods for app %s", app)
+	}
+
+	var rsName string
+
+	for _, pod := range pods.Items {
+		if pod.ObjectMeta.Annotations["helm.sh/revision"] == revision {
+			for _, ref := range pod.OwnerReferences {
+				if ref.Kind == "ReplicaSet" {
+					rs, err := sharedConf.Clientset.AppsV1().ReplicaSets(namespace).Get(
+						context.Background(),
+						ref.Name,
+						metav1.GetOptions{},
+					)
+
+					if err != nil {
+						return fmt.Errorf("error fetching new replicaset: %w", err)
+					}
+
+					rsName = rs.Name
+
+					break
+				}
+			}
+
+			if rsName != "" {
+				break
+			}
+		}
+	}
+
+	if rsName == "" {
+		return fmt.Errorf("could not find replicaset for app %s", app)
+	}
+
+	for time.Now().Before(timeWait) {
+		// refresh the client every 10 minutes
+		if time.Now().After(prevRefresh.Add(10 * time.Minute)) {
+			err = sharedConf.setSharedConfig()
+
+			if err != nil {
+				return fmt.Errorf("could not retrieve kube credentials: %s", err.Error())
+			}
+
+			prevRefresh = time.Now()
+		}
+
+		rs, err := sharedConf.Clientset.AppsV1().ReplicaSets(namespace).Get(
+			context.Background(),
+			rsName,
+			metav1.GetOptions{},
+		)
+
+		if err != nil {
+			return fmt.Errorf("error fetching new replicaset: %w", err)
+		}
+
+		if minAvailable <= rs.Status.ReadyReplicas {
+			success = true
+		}
+
+		if success {
+			break
+		}
+
+		time.Sleep(2 * time.Second)
+	}
+
+	if success {
+		color.New(color.FgGreen).Printf("%s has been successfully deployed on the cluster\n", app)
+	} else {
+		return fmt.Errorf("timed out waiting for deployment to be ready, please check the Porter dashboard for more information")
+	}
+
+	return nil
+}

+ 30 - 3
cmd/migrate/main.go

@@ -52,12 +52,33 @@ func main() {
 		return
 	}
 
+	tx := db.Begin()
+
+	switch tx.Dialector.Name() {
+	case "sqlite":
+		if err := tx.Raw("PRAGMA schema.locking_mode = EXCLUSIVE").Error; err != nil {
+			tx.Rollback()
+
+			logger.Fatal().Err(err).Msg("error acquiring lock on db_migrations")
+			return
+		}
+	case "postgres":
+		if err := tx.Raw("LOCK TABLE db_migrations IN SHARE ROW EXCLUSIVE MODE").Error; err != nil {
+			tx.Rollback()
+
+			logger.Fatal().Err(err).Msg("error acquiring lock on db_migrations")
+			return
+		}
+	}
+
 	dbMigration := &models.DbMigration{}
 
-	if err := db.Model(&models.DbMigration{}).First(dbMigration).Error; err != nil {
+	if err := tx.Model(&models.DbMigration{}).First(dbMigration).Error; err != nil {
 		if errors.Is(err, pgorm.ErrRecordNotFound) {
 			dbMigration.Version = 0
 		} else {
+			tx.Rollback()
+
 			logger.Fatal().Err(err).Msg("failed to check for db migration version")
 			return
 		}
@@ -68,9 +89,11 @@ func main() {
 	if dbMigration.Version < latestMigrationVersion {
 		for ver, fn := range startup_migrations.StartupMigrations {
 			if ver > dbMigration.Version {
-				err := fn(db, logger)
+				err := fn(tx, logger)
 
 				if err != nil {
+					tx.Rollback()
+
 					logger.Fatal().Err(err).Msg("failed to run startup migration script")
 					return
 				}
@@ -79,12 +102,16 @@ func main() {
 
 		dbMigration.Version = latestMigrationVersion
 
-		if err := db.Save(dbMigration).Error; err != nil {
+		if err := tx.Save(dbMigration).Error; err != nil {
+			tx.Rollback()
+
 			logger.Fatal().Err(err).Msg("failed to update migration version to latest")
 			return
 		}
 	}
 
+	tx.Commit()
+
 	if shouldRotate, oldKeyStr, newKeyStr := shouldKeyRotate(); shouldRotate {
 		oldKey := [32]byte{}
 		newKey := [32]byte{}

+ 5 - 2
dashboard/src/main/home/cluster-dashboard/preview-environments/deployments/DeploymentDetail.tsx

@@ -4,7 +4,7 @@ import TitleSection from "components/TitleSection";
 import pr_icon from "assets/pull_request_icon.svg";
 import { useRouteMatch, useLocation } from "react-router";
 import DynamicLink from "components/DynamicLink";
-import { PRDeployment } from "../types";
+import { DeploymentStatus, PRDeployment } from "../types";
 import PullRequestIcon from "assets/pull_request_icon.svg";
 import Loading from "components/Loading";
 import { Context } from "shared/Context";
@@ -100,7 +100,10 @@ const DeploymentDetail = () => {
 
   const repository = `${prDeployment.gh_repo_owner}/${prDeployment.gh_repo_name}`;
 
-  if (!prDeployment.namespace && prDeployment.status === "creating") {
+  if (
+    !prDeployment.namespace &&
+    ["creating", "updating"].includes(prDeployment.status)
+  ) {
     return (
       <>
         <BreadcrumbRow>

+ 108 - 89
dashboard/src/main/home/cluster-dashboard/preview-environments/environments/CreateEnvironment.tsx

@@ -17,6 +17,8 @@ import Banner from "components/Banner";
 import Modal from "main/home/modals/Modal";
 import { useRouting } from "shared/routing";
 import PorterYAMLErrorsModal from "../components/PorterYAMLErrorsModal";
+import { PlaceHolder } from "brace";
+import Placeholder from "components/Placeholder";
 
 const CreateEnvironment: React.FC = () => {
   const router = useRouting();
@@ -87,6 +89,102 @@ const CreateEnvironment: React.FC = () => {
     }
   };
 
+  const renderPullRequestList = () => {
+    return (
+      <>
+        <Helper>
+          Select an open pull request to preview. Pull requests must contain a{" "}
+          <Code>porter.yaml</Code> file.
+        </Helper>
+        <Br height="10px" />
+        <PullRequestList>
+          {(pullRequests ?? []).map((pullRequest: PullRequest, i: number) => {
+            return (
+              <PullRequestRow
+                onClick={() => {
+                  handlePRRowItemClick(pullRequest);
+                }}
+                isLast={i === pullRequests.length - 1}
+                isSelected={pullRequest === selectedPR}
+              >
+                <PRName>
+                  <PRIcon src={pr_icon} alt="pull request icon" />
+                  <EllipsisTextWrapper tooltipText={pullRequest.pr_title}>
+                    {pullRequest.pr_title}
+                  </EllipsisTextWrapper>
+                </PRName>
+
+                <Flex>
+                  <DeploymentImageContainer>
+                    {/* <InfoWrapper>
+                    <LastDeployed>
+                      #{pullRequest.pr_number} last updated xyz
+                    </LastDeployed>
+                  </InfoWrapper>
+                  <SepDot>•</SepDot> */}
+                    <MergeInfoWrapper>
+                      <MergeInfo>
+                        {pullRequest.branch_from}
+                        <i className="material-icons">arrow_forward</i>
+                        {pullRequest.branch_into}
+                      </MergeInfo>
+                    </MergeInfoWrapper>
+                  </DeploymentImageContainer>
+                </Flex>
+              </PullRequestRow>
+            );
+          })}
+        </PullRequestList>
+        {showErrorsModal && selectedPR ? (
+          <PorterYAMLErrorsModal
+            errors={porterYAMLErrors}
+            onClose={() => setShowErrorsModal(false)}
+            repo={selectedPR.repo_owner + "/" + selectedPR.repo_name}
+            branch={selectedPR.branch_from}
+          />
+        ) : null}
+        {selectedPR && porterYAMLErrors.length ? (
+          <ValidationErrorBannerWrapper>
+            <Banner type="warning">
+              We found some errors in the porter.yaml file in the&nbsp;
+              {selectedPR.branch_from}&nbsp;branch. &nbsp;
+              <LearnMoreButton onClick={() => setShowErrorsModal(true)}>
+                Learn more
+              </LearnMoreButton>
+            </Banner>
+          </ValidationErrorBannerWrapper>
+        ) : null}
+        <CreatePreviewDeploymentWrapper>
+          <SubmitButton
+            onClick={handleCreatePreviewDeployment}
+            disabled={loading || !selectedPR || porterYAMLErrors.length > 0}
+          >
+            Create preview deployment
+          </SubmitButton>
+          {selectedPR && porterYAMLErrors.length ? (
+            <RevalidatePorterYAMLSpanWrapper>
+              Please fix your porter.yaml file to continue.{" "}
+              <RevalidateSpan
+                onClick={(e) => {
+                  e.preventDefault();
+                  e.stopPropagation();
+
+                  if (!selectedPR) {
+                    return;
+                  }
+
+                  handlePRRowItemClick(selectedPR);
+                }}
+              >
+                Refresh
+              </RevalidateSpan>
+            </RevalidatePorterYAMLSpanWrapper>
+          ) : null}
+        </CreatePreviewDeploymentWrapper>
+      </>
+    );
+  };
+
   return (
     <>
       <BreadcrumbRow>
@@ -108,95 +206,16 @@ const CreateEnvironment: React.FC = () => {
         capitalize={false}
       />
       <DarkMatter />
-      <Helper>
-        Select an open pull request to preview. Pull requests must contain a{" "}
-        <Code>porter.yaml</Code> file.
-      </Helper>
-      <Br height="10px" />
-      <PullRequestList>
-        {(pullRequests ?? []).map((pullRequest: PullRequest, i: number) => {
-          return (
-            <PullRequestRow
-              onClick={() => {
-                handlePRRowItemClick(pullRequest);
-              }}
-              isLast={i === pullRequests.length - 1}
-              isSelected={pullRequest === selectedPR}
-            >
-              <PRName>
-                <PRIcon src={pr_icon} alt="pull request icon" />
-                <EllipsisTextWrapper tooltipText={pullRequest.pr_title}>
-                  {pullRequest.pr_title}
-                </EllipsisTextWrapper>
-              </PRName>
-
-              <Flex>
-                <DeploymentImageContainer>
-                  {/* <InfoWrapper>
-                    <LastDeployed>
-                      #{pullRequest.pr_number} last updated xyz
-                    </LastDeployed>
-                  </InfoWrapper>
-                  <SepDot>•</SepDot> */}
-                  <MergeInfoWrapper>
-                    <MergeInfo>
-                      {pullRequest.branch_from}
-                      <i className="material-icons">arrow_forward</i>
-                      {pullRequest.branch_into}
-                    </MergeInfo>
-                  </MergeInfoWrapper>
-                </DeploymentImageContainer>
-              </Flex>
-            </PullRequestRow>
-          );
-        })}
-      </PullRequestList>
-      {showErrorsModal && selectedPR ? (
-        <PorterYAMLErrorsModal
-          errors={porterYAMLErrors}
-          onClose={() => setShowErrorsModal(false)}
-          repo={selectedPR.repo_owner + "/" + selectedPR.repo_name}
-          branch={selectedPR.branch_from}
-        />
-      ) : null}
-      {selectedPR && porterYAMLErrors.length ? (
-        <ValidationErrorBannerWrapper>
-          <Banner type="warning">
-            We found some errors in the porter.yaml file in the&nbsp;
-            {selectedPR.branch_from}&nbsp;branch. &nbsp;
-            <LearnMoreButton onClick={() => setShowErrorsModal(true)}>
-              Learn more
-            </LearnMoreButton>
-          </Banner>
-        </ValidationErrorBannerWrapper>
-      ) : null}
-      <CreatePreviewDeploymentWrapper>
-        <SubmitButton
-          onClick={handleCreatePreviewDeployment}
-          disabled={loading || !selectedPR || porterYAMLErrors.length > 0}
-        >
-          Create preview deployment
-        </SubmitButton>
-        {selectedPR && porterYAMLErrors.length ? (
-          <RevalidatePorterYAMLSpanWrapper>
-            Please fix your porter.yaml file to continue.{" "}
-            <RevalidateSpan
-              onClick={(e) => {
-                e.preventDefault();
-                e.stopPropagation();
-
-                if (!selectedPR) {
-                  return;
-                }
-
-                handlePRRowItemClick(selectedPR);
-              }}
-            >
-              Refresh
-            </RevalidateSpan>
-          </RevalidatePorterYAMLSpanWrapper>
-        ) : null}
-      </CreatePreviewDeploymentWrapper>
+      {pullRequests?.length ? (
+        renderPullRequestList()
+      ) : (
+        <>
+          <Br height="30px" />
+          <Placeholder height="370px">
+            You do not have any pull requests.
+          </Placeholder>
+        </>
+      )}
     </>
   );
 };

+ 0 - 201
internal/integrations/preview/embed/deploy_driver.schema.json.unused

@@ -1,201 +0,0 @@
-{
-  "$schema": "http://json-schema.org/schema#",
-  "title": "schema for the default deploy driver",
-  "type": "object",
-  "properties": {
-    "name": {
-      "type": "string",
-      "description": "resource name",
-      "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
-      "maxLength": 50
-    },
-    "driver": {
-      "type": "string",
-      "description": "resource driver",
-      "enum": ["deploy", ""]
-    },
-    "depends_on": {
-      "type": "array",
-      "description": "list of resource names this resource depends on",
-      "minItems": 1,
-      "items": {
-        "type": "string",
-        "description": "dependency resource name",
-        "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
-        "maxLength": 50
-      }
-    },
-    "source": {
-      "type": "object",
-      "description": "resource source",
-      "properties": {
-        "name": {
-          "type": "string",
-          "description": "source Helm chart name"
-        },
-        "version": {
-          "type": "string",
-          "description": "source Helm chart version"
-        },
-        "repo": {
-          "type": "string",
-          "description": "source Helm chart repo URL",
-          "default": "https://charts.getporter.dev"
-        }
-      },
-      "required": ["name"]
-    },
-    "target": {
-      "type": "object",
-      "description": "resource target",
-      "properties": {
-        "project": {
-          "type": "integer",
-          "description": "target Porter project ID"
-        },
-        "cluster": {
-          "type": "integer",
-          "description": "target Porter cluster ID"
-        },
-        "namespace": {
-          "type": "string",
-          "description": "target namespace"
-        }
-      }
-    },
-    "config": {
-      "type": "object",
-      "description": "resource configuration",
-      "additionalProperties": true
-    },
-    "if": {
-      "properties": {
-        "source": {
-          "properties": { "repo": { "const": "https://charts.getporter.dev" } }
-        }
-      }
-    },
-    "then": {
-      "properties": {
-        "config": {
-          "properties": {
-            "waitForJob": {
-              "type": "boolean",
-              "description": "wait for job to complete"
-            },
-            "onlyCreate": {
-              "type": "boolean",
-              "description": "only create the resource"
-            },
-            "build": {
-              "type": "object",
-              "description": "build configuration",
-              "properties": {
-                "use_cache": {
-                  "type": "boolean",
-                  "description": "use Porter build cache"
-                },
-                "method": {
-                  "type": "string",
-                  "description": "build method",
-                  "default": "docker",
-                  "enum": ["docker", "pack", "registry"]
-                },
-                "context": {
-                  "type": "string",
-                  "description": "build context"
-                },
-                "dockerfile": {
-                  "type": "string",
-                  "description": "Dockerfile path"
-                },
-                "image": {
-                  "type": "string",
-                  "description": "image name"
-                },
-                "builder": {
-                  "type": "string",
-                  "description": "buildpacks builder image"
-                },
-                "buildpacks": {
-                  "type": "array",
-                  "description": "list of buildpacks",
-                  "minItems": 1,
-                  "items": {
-                    "type": "string",
-                    "description": "buildpack"
-                  }
-                },
-                "env": {
-                  "type": "object",
-                  "description": "build-time environment variables",
-                  "additionalProperties": { "type": "string" }
-                }
-              },
-              "allOf": [
-                {
-                  "if": {
-                    "properties": {
-                      "method": { "const": "docker" }
-                    }
-                  },
-                  "then": {
-                    "dependentRequired": {
-                      "method": ["dockerfile"]
-                    }
-                  }
-                },
-                {
-                  "if": {
-                    "properties": {
-                      "method": { "const": "registry" }
-                    }
-                  },
-                  "then": {
-                    "dependentRequired": {
-                      "method": ["image"]
-                    }
-                  }
-                }
-              ]
-            },
-            "env_groups": {
-              "type": "array",
-              "description": "list of environment groups to use in the deployment",
-              "minItems": 1,
-              "items": {
-                "type": "object",
-                "description": "environment group",
-                "properties": {
-                  "name": {
-                    "type": "string",
-                    "description": "environment group name"
-                  },
-                  "version": {
-                    "type": "integer",
-                    "minimum": 0,
-                    "default": 0,
-                    "description": "environment group version"
-                  },
-                  "namespace": {
-                    "type": "string",
-                    "description": "environment group namespace"
-                  }
-                },
-                "required": ["name"]
-              }
-            },
-            "values": {
-              "type": "object",
-              "description": "Helm values to use for the deployment",
-              "additionalProperties": true
-            }
-          },
-          "required": ["build"]
-        }
-      },
-      "required": ["config"]
-    }
-  },
-  "required": ["name", "source"]
-}

+ 0 - 73
internal/integrations/preview/embed/job.values.schema.json

@@ -1,73 +0,0 @@
-{
-  "$schema": "http://json-schema.org/schema#",
-  "type": "object",
-  "properties": {
-    "replicaCount": {
-      "type": "integer",
-      "minimum": 1,
-      "default": 1
-    },
-    "container": {
-      "type": "object",
-      "properties": {
-        "port": {
-          "type": "integer",
-          "default": 80
-        },
-        "command": {
-          "type": "string"
-        },
-        "env": {
-          "type": "object",
-          "properties": {
-            "normal": {
-              "type": "object",
-              "additionalProperties": {
-                "type": "string"
-              }
-            }
-          }
-        }
-      }
-    },
-    "schedule": {
-      "type": "object",
-      "properties": {
-        "enabled": {
-          "type": "boolean",
-          "default": false
-        },
-        "value": {
-          "type": "string",
-          "default": "*/5 * * * *"
-        },
-        "successfulHistory": {
-          "type": "integer",
-          "default": 20
-        },
-        "failedHistory": {
-          "type": "integer",
-          "default": 20
-        }
-      }
-    },
-    "resources": {
-      "type": "object",
-      "properties": {
-        "requests": {
-          "type": "object",
-          "properties": {
-            "cpu": {
-              "type": "string",
-              "pattern": "^\\d+(m){0,1}$"
-            },
-            "memory": {
-              "type": "string",
-              "pattern": "^\\d+(Ki|Mi|Gi)$"
-            }
-          }
-        }
-      }
-    }
-  }
-}

+ 0 - 90
internal/integrations/preview/embed/porteryaml.schema.json.unused

@@ -1,90 +0,0 @@
-{
-  "$schema": "http://json-schema.org/schema#",
-  "type": "object",
-  "properties": {
-    "version": {
-      "type": "string",
-      "description": "porter.yaml version",
-      "pattern": "^v[1-9][0-9]*$"
-    },
-    "resources": {
-      "type": "array",
-      "description": "list of resources",
-      "minItems": 1,
-      "items": {
-        "type": "object",
-        "properties": {
-          "name": {
-            "type": "string",
-            "description": "resource name",
-            "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
-            "maxLength": 50
-          },
-          "driver": {
-            "type": "string",
-            "description": "resource driver"
-          },
-          "depends_on": {
-            "type": "array",
-            "description": "list of resource names this resource depends on",
-            "minItems": 1,
-            "items": {
-              "type": "string",
-              "description": "dependency resource name",
-              "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
-              "maxLength": 50
-            }
-          },
-          "source": {
-            "type": "object",
-            "description": "resource source",
-            "properties": {
-              "name": {
-                "type": "string",
-                "description": "source Helm chart name"
-              },
-              "version": {
-                "type": "string",
-                "description": "source Helm chart version"
-              },
-              "repo": {
-                "type": "string",
-                "description": "source Helm chart repo URL"
-              }
-            }
-          },
-          "target": {
-            "type": "object",
-            "description": "resource target",
-            "properties": {
-              "project": {
-                "type": "integer",
-                "description": "target Porter project ID"
-              },
-              "cluster": {
-                "type": "integer",
-                "description": "target Porter cluster ID"
-              },
-              "namespace": {
-                "type": "string",
-                "description": "target namespace"
-              },
-              "app_name": {
-                "type": "string",
-                "description": "target app name",
-                "pattern": "^[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
-                "maxLength": 50
-              }
-            }
-          },
-          "config": {
-            "type": "object",
-            "description": "resource config"
-          }
-        },
-        "required": ["name"]
-      }
-    }
-  },
-  "required": ["version", "resources"]
-}

+ 0 - 289
internal/integrations/preview/embed/web.values.schema.json

@@ -1,289 +0,0 @@
-{
-  "$schema": "http://json-schema.org/schema#",
-  "type": "object",
-  "properties": {
-    "replicaCount": {
-      "type": "integer",
-      "minimum": 1,
-      "default": 1
-    },
-    "ingress": {
-      "type": "object",
-      "properties": {
-        "enabled": {
-          "type": "boolean",
-          "default": true
-        },
-        "hosts": {
-          "type": "array",
-          "items": {
-            "type": "string"
-          }
-        },
-        "porter_hosts": {
-          "type": "array",
-          "items": {
-            "type": "string"
-          }
-        },
-        "provider": {
-          "type": "string"
-        },
-        "custom_domain": {
-          "type": "boolean",
-          "default": false
-        },
-        "custom_paths": {
-          "type": "string"
-        },
-        "rewriteCustomPathsEnabled": {
-          "type": "boolean",
-          "default": true
-        },
-        "annotations": {
-          "type": "array",
-          "items": {
-            "type": "string"
-          }
-        },
-        "wildcard": {
-          "type": "boolean",
-          "default": false
-        },
-        "tls": {
-          "type": "boolean",
-          "default": true
-        },
-        "useDefaultIngressTLSSecret": {
-          "type": "boolean",
-          "default": false
-        }
-      }
-    },
-    "container": {
-      "type": "object",
-      "properties": {
-        "port": {
-          "type": "integer",
-          "default": 80
-        },
-        "command": {
-          "type": "string"
-        },
-        "args": {
-          "type": "array",
-          "items": {
-            "type": "string"
-          }
-        },
-        "env": {
-          "type": "object",
-          "properties": {
-            "normal": {
-              "type": "object",
-              "additionalProperties": {
-                "type": "string"
-              }
-            }
-          }
-        }
-      }
-    },
-    "resources": {
-      "type": "object",
-      "properties": {
-        "requests": {
-          "type": "object",
-          "properties": {
-            "cpu": {
-              "type": "string",
-              "pattern": "^\\d+(m){0,1}$"
-            },
-            "memory": {
-              "type": "string",
-              "pattern": "^\\d+(Ki|Mi|Gi)$"
-            }
-          }
-        }
-      }
-    },
-    "autoscaling": {
-      "type": "object",
-      "properties": {
-        "enabled": {
-          "type": "boolean",
-          "default": false
-        },
-        "minReplicas": {
-          "type": "integer",
-          "default": 1
-        },
-        "maxReplicas": {
-          "type": "integer",
-          "default": 10
-        },
-        "targetCPUUtilizationPercentage": {
-          "type": "integer",
-          "default": 50
-        },
-        "targetMemoryUtilizationPercentage": {
-          "type": "integer",
-          "default": 50
-        }
-      }
-    },
-    "health": {
-      "type": "object",
-      "properties": {
-        "livenessProbe": {
-          "type": "object",
-          "properties": {
-            "enabled": {
-              "type": "boolean",
-              "default": false
-            },
-            "path": {
-              "type": "string",
-              "default": "/livez"
-            },
-            "scheme": {
-              "type": "string",
-              "default": "HTTP"
-            },
-            "initialDelaySeconds": {
-              "type": "integer",
-              "default": 0
-            },
-            "periodSeconds": {
-              "type": "integer",
-              "default": 5
-            },
-            "timeoutSeconds": {
-              "type": "integer",
-              "default": 1
-            },
-            "successThreshold": {
-              "type": "integer",
-              "default": 1
-            },
-            "failureThreshold": {
-              "type": "integer",
-              "default": 3
-            },
-            "auth": {
-              "type": "object",
-              "properties": {
-                "enabled": {
-                  "type": "boolean",
-                  "default": false
-                },
-                "username": {
-                  "type": "string"
-                },
-                "password": {
-                  "type": "string"
-                }
-              }
-            }
-          }
-        },
-        "readinessProbe": {
-          "type": "object",
-          "properties": {
-            "enabled": {
-              "type": "boolean",
-              "default": false
-            },
-            "path": {
-              "type": "string",
-              "default": "/readyz"
-            },
-            "scheme": {
-              "type": "string",
-              "default": "HTTP"
-            },
-            "initialDelaySeconds": {
-              "type": "integer",
-              "default": 0
-            },
-            "periodSeconds": {
-              "type": "integer",
-              "default": 5
-            },
-            "timeoutSeconds": {
-              "type": "integer",
-              "default": 1
-            },
-            "successThreshold": {
-              "type": "integer",
-              "default": 1
-            },
-            "failureThreshold": {
-              "type": "integer",
-              "default": 3
-            },
-            "auth": {
-              "type": "object",
-              "properties": {
-                "enabled": {
-                  "type": "boolean",
-                  "default": false
-                },
-                "username": {
-                  "type": "string"
-                },
-                "password": {
-                  "type": "string"
-                }
-              }
-            }
-          }
-        },
-        "startupProbe": {
-          "type": "object",
-          "properties": {
-            "enabled": {
-              "type": "boolean",
-              "default": false
-            },
-            "path": {
-              "type": "string",
-              "default": "/startupz"
-            },
-            "scheme": {
-              "type": "string",
-              "default": "HTTP"
-            },
-            "failureThreshold": {
-              "type": "integer",
-              "default": 3
-            },
-            "periodSeconds": {
-              "type": "integer",
-              "default": 5
-            },
-            "timeoutSeconds": {
-              "type": "integer",
-              "default": 1
-            },
-            "auth": {
-              "type": "object",
-              "properties": {
-                "enabled": {
-                  "type": "boolean",
-                  "default": false
-                },
-                "username": {
-                  "type": "string"
-                },
-                "password": {
-                  "type": "string"
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-}

+ 0 - 136
internal/integrations/preview/embed/worker.values.schema.json

@@ -1,136 +0,0 @@
-{
-  "$schema": "http://json-schema.org/schema#",
-  "type": "object",
-  "properties": {
-    "replicaCount": {
-      "type": "integer",
-      "minimum": 1,
-      "default": 1
-    },
-    "container": {
-      "type": "object",
-      "properties": {
-        "port": {
-          "type": "integer",
-          "default": 80
-        },
-        "command": {
-          "type": "string"
-        },
-        "env": {
-          "type": "object",
-          "properties": {
-            "normal": {
-              "type": "object",
-              "additionalProperties": {
-                "type": "string"
-              }
-            }
-          }
-        }
-      }
-    },
-    "resources": {
-      "type": "object",
-      "properties": {
-        "requests": {
-          "type": "object",
-          "properties": {
-            "cpu": {
-              "type": "string",
-              "pattern": "^\\d+(m){0,1}$"
-            },
-            "memory": {
-              "type": "string",
-              "pattern": "^\\d+(Ki|Mi|Gi)$"
-            }
-          }
-        }
-      }
-    },
-    "autoscaling": {
-      "type": "object",
-      "properties": {
-        "enabled": {
-          "type": "boolean",
-          "default": false
-        },
-        "minReplicas": {
-          "type": "integer",
-          "default": 1
-        },
-        "maxReplicas": {
-          "type": "integer",
-          "default": 10
-        },
-        "targetCPUUtilizationPercentage": {
-          "type": "integer",
-          "default": 50
-        },
-        "targetMemoryUtilizationPercentage": {
-          "type": "integer",
-          "default": 50
-        }
-      }
-    },
-    "health": {
-      "type": "object",
-      "properties": {
-        "enabled": {
-          "type": "boolean",
-          "default": false
-        },
-        "command": {
-          "type": "string",
-          "default": "ls -l"
-        },
-        "periodSeconds": {
-          "type": "integer",
-          "default": 5
-        },
-        "failureThreshold": {
-          "type": "integer",
-          "default": 3
-        },
-        "readinessProbe": {
-          "type": "object",
-          "properties": {
-            "enabled": {
-              "type": "boolean",
-              "default": false
-            },
-            "command": {
-              "type": "string",
-              "default": "ls -l"
-            },
-            "periodSeconds": {
-              "type": "integer",
-              "default": 5
-            }
-          }
-        },
-        "startupProbe": {
-          "type": "object",
-          "properties": {
-            "enabled": {
-              "type": "boolean",
-              "default": false
-            },
-            "command": {
-              "type": "string",
-              "default": "ls -l"
-            },
-            "failureThreshold": {
-              "type": "integer",
-              "default": 3
-            },
-            "periodSeconds": {
-              "type": "integer",
-              "default": 5
-            }
-          }
-        }
-      }
-    }
-  }
-}