From baf3e55dafb7ab7adb3dcfff899d2effa485781a Mon Sep 17 00:00:00 2001 From: Ryan Nowak Date: Thu, 7 May 2020 12:16:16 -0700 Subject: [PATCH] Add documentation for namespace Fixes: #416 --- docs/reference/commandline/tye-deploy.md | 14 ++++++++++++-- docs/reference/commandline/tye-undeploy.md | 14 ++++++++++++-- docs/reference/schema.md | 9 +++++++++ src/schema/tye-schema.json | 4 ++++ 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/docs/reference/commandline/tye-deploy.md b/docs/reference/commandline/tye-deploy.md index 276c4ad4..90042681 100644 --- a/docs/reference/commandline/tye-deploy.md +++ b/docs/reference/commandline/tye-deploy.md @@ -7,7 +7,7 @@ ## Synopsis ```text -tye deploy [-?|-h|--help] [-i|--interactive] [-v|--verbosity ] [-f|--force] [] +tye deploy [-?|-h|--help] [-i|--interactive] [-n|--namespace ] [-v|--verbosity ] [-f|--force] [] ``` ## Description @@ -19,7 +19,13 @@ The `tye deploy` command will deploy an application to Kubernetes. `tye deploy` - Generate a Kubernetes Deployment and Service for each project. - Apply the generated Deployment and Service to your current Kubernetes context. -`tye deploy` operates in the current Kubernetes namespace. Use `kubectl config view --minify --output 'jsonpath={..namespace}'` to view the current namespace. +`tye deploy` chooses the Kubernetes namespace to operate in according to the following priority: + +- The value of `--namespace` passed at the command line +- The value of `namespace` configured in `tye.yaml` (if present) +- The Kubernetes namespace for the current context + +> :bulb: Use `kubectl config view --minify --output 'jsonpath={..namespace}'` to view the current namespace. ## Arguments @@ -39,6 +45,10 @@ If a directory path is specified, `tye deploy` will default to using these files Does an interactive deployment that will accept input for values that are required by default. +- `-n|--namespace` + + Specifies the Kubernetes namespace for deployment. Overrides a namespace value set in `tye.yaml`. + - `-v|--verbosity ` The verbosity of logs emitted by `tye deploy`. Defaults to Info. diff --git a/docs/reference/commandline/tye-undeploy.md b/docs/reference/commandline/tye-undeploy.md index 317689b3..097cc409 100644 --- a/docs/reference/commandline/tye-undeploy.md +++ b/docs/reference/commandline/tye-undeploy.md @@ -7,7 +7,7 @@ ## Synopsis ```text -tye undeploy [-?|-h|--help] [-i|--interactive] [-v|--verbosity ] [--what-if] [] +tye undeploy [-?|-h|--help] [-i|--interactive] [-n|--namespace ] [-v|--verbosity ] [--what-if] [] ``` ## Description @@ -19,7 +19,13 @@ The `tye undeploy` command will delete a deployed application from Kubernetes. ` - Offer a choice to delete each resource (interactive) - Delete each resource (if applicable) -`tye undeploy` operates in the current Kubernetes namespace. Use `kubectl config view --minify --output 'jsonpath={..namespace}'` to view the current namespace. +`tye undeploy` chooses the Kubernetes namespace to operate in according to the following priority: + +- The value of `--namespace` passed at the command line +- The value of `namespace` configured in `tye.yaml` (if present) +- The Kubernetes namespace for the current context + +> :bulb: Use `kubectl config view --minify --output 'jsonpath={..namespace}'` to view the current namespace. Undeploy decides which resources to delete based on the `app.kubernetes.io/part-of=...` label. This label will be set to the application name for all resources created by Tye. `tye undeploy` does not rely on the list of services in `tye.yaml` or a solution file. @@ -41,6 +47,10 @@ If a directory path is specified, `tye undeploy` will default to using these fil Does an interactive undeploy that will prompt for deletion of each resource. +- `-n|--namespace` + + Specifies the Kubernetes namespace for deployment. Overrides a namespace value set in `tye.yaml`. + - `-v|--verbosity ` The verbosity of logs emitted by `tye undeploy`. Defaults to Info. diff --git a/docs/reference/schema.md b/docs/reference/schema.md index 9babb67c..c039dfce 100644 --- a/docs/reference/schema.md +++ b/docs/reference/schema.md @@ -46,6 +46,7 @@ services: ```yaml name: myapplication registry: exampleuser +namespace: examplenamespace services: ``` @@ -68,6 +69,14 @@ The registry could be a DockerHub username (`exampleuser`) or the hostname of a If this is not specified in configuration, interactive deployments will prompt for it. +#### `namespace` (string) + +Allows configuring the Kubernetes namespace used by commands that operate on Kubernetes. If unconfigured, Tye will use the namespace of the current Kubernetes context. + +The namespace specified in `tye.yaml` can be overridden at the command line. + +> :bulb: Use `kubectl config view --minify --output 'jsonpath={..namespace}'` to view the current namespace. + #### `services` (`Service[]`) *required* Specifies the list of services. Applications must have at least one service. diff --git a/src/schema/tye-schema.json b/src/schema/tye-schema.json index ca152bf6..5038bdeb 100644 --- a/src/schema/tye-schema.json +++ b/src/schema/tye-schema.json @@ -13,6 +13,10 @@ "description": "Dockerhub username or hostname of remote registry. Used for tagging images.", "type": "string" }, + "namespace": { + "description": "The Kubernetes namespace to use.", + "type": "string" + }, "services": { "description": "The application's services.", "type": "array",