Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions cmd/enter.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ type EnterCmd struct {

// EnterCmdFlags are the flags available for the enter-command
type EnterCmdFlags struct {
container string
container string
namespace string
labelSelector string
}

func init() {
Expand All @@ -37,12 +39,16 @@ devspace:
devspace enter
devspace enter bash
devspace enter -c myContainer
devspace enter bash -n my-namespace
devspace enter bash -l release=test
#######################################################`,
Run: cmd.Run,
}
rootCmd.AddCommand(cobraCmd)

cobraCmd.Flags().StringVarP(&cmd.flags.container, "container", "c", "", "Container name within pod where to execute command")
cobraCmd.Flags().StringVarP(&cmd.flags.namespace, "namespace", "n", "", "Namespace where to select pods")
cobraCmd.Flags().StringVarP(&cmd.flags.labelSelector, "label-selector", "l", "", "Comma separated key=value selector list (e.g. release=test)")
}

// Run executes the command logic
Expand All @@ -55,5 +61,5 @@ func (cmd *EnterCmd) Run(cobraCmd *cobra.Command, args []string) {
log.Fatalf("Unable to create new kubectl client: %v", err)
}

services.StartTerminal(cmd.kubectl, cmd.flags.container, args, log.GetInstance())
services.StartTerminal(cmd.kubectl, cmd.flags.container, cmd.flags.labelSelector, cmd.flags.namespace, args, log.GetInstance())
}
8 changes: 4 additions & 4 deletions cmd/reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ func init() {
#######################################################
Resets your project by removing all DevSpace related
data from your project and your cluster, including:
1. DevSpace release (cluster)
2. Docker registry (cluster)
1. DevSpace deployments
2. Docker registry (if deployed)
3. DevSpace config files in .devspace/ (local)

Use the flag --all-data to also remove:
1. Tiller server (cluster)
2. Helm home (local)
1. Tiller server (if deployed)
2. Helm home (if helm is used)

If you simply want to shutdown your DevSpace, use the
command: devspace down
Expand Down
21 changes: 15 additions & 6 deletions cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ type UpCmdFlags struct {
build bool
sync bool
deploy bool
switchContext bool
portforwarding bool
verboseSync bool
container string
labelSelector string
namespace string
}

//UpFlagsDefault are the default flags for UpCmdFlags
Expand All @@ -54,10 +57,13 @@ var UpFlagsDefault = &UpCmdFlags{
initRegistries: true,
build: false,
sync: true,
switchContext: false,
deploy: false,
portforwarding: true,
verboseSync: false,
container: "",
namespace: "",
labelSelector: "",
}

const clusterRoleBindingName = "devspace-users"
Expand All @@ -75,9 +81,9 @@ func init() {
#################### devspace up ######################
#######################################################
Starts and connects your DevSpace:
1. Connects to the Tiller server
2. Builds your Docker image (if your Dockerfile has changed)
3. Deploys the Helm chart in /chart
1. Builds your Docker images (if any Dockerfile has changed)
2. Deploys your application via helm or kubectl
3. Forwards container ports to the local computer
4. Starts the sync client
5. Enters the container shell
#######################################################`,
Expand All @@ -93,6 +99,9 @@ Starts and connects your DevSpace:
cobraCmd.Flags().BoolVar(&cmd.flags.verboseSync, "verbose-sync", cmd.flags.verboseSync, "When enabled the sync will log every file change")
cobraCmd.Flags().BoolVar(&cmd.flags.portforwarding, "portforwarding", cmd.flags.portforwarding, "Enable port forwarding")
cobraCmd.Flags().BoolVarP(&cmd.flags.deploy, "deploy", "d", cmd.flags.deploy, "Force chart deployment")
cobraCmd.Flags().BoolVar(&cmd.flags.switchContext, "switch-context", cmd.flags.switchContext, "Switch kubectl context to the devspace context")
cobraCmd.Flags().StringVarP(&cmd.flags.namespace, "namespace", "n", "", "Namespace where to select pods")
cobraCmd.Flags().StringVarP(&cmd.flags.labelSelector, "label-selector", "l", "", "Comma separated key=value selector list (e.g. release=test)")
}

// Run executes the command logic
Expand All @@ -114,7 +123,7 @@ func (cmd *UpCmd) Run(cobraCmd *cobra.Command, args []string) {
}

// Create kubectl client
cmd.kubectl, err = kubectl.NewClient()
cmd.kubectl, err = kubectl.NewClientWithContextSwitch(cmd.flags.switchContext)
if err != nil {
log.Fatalf("Unable to create new kubectl client: %v", err)
}
Expand Down Expand Up @@ -155,7 +164,7 @@ func (cmd *UpCmd) Run(cobraCmd *cobra.Command, args []string) {
}()
}

services.StartTerminal(cmd.kubectl, cmd.flags.container, args, log.GetInstance())
services.StartTerminal(cmd.kubectl, cmd.flags.container, cmd.flags.labelSelector, cmd.flags.namespace, args, log.GetInstance())
}

func (cmd *UpCmd) ensureNamespace() error {
Expand Down Expand Up @@ -189,7 +198,7 @@ func (cmd *UpCmd) ensureClusterRoleBinding() error {

_, err := cmd.kubectl.RbacV1beta1().ClusterRoleBindings().Get(clusterRoleBindingName, metav1.GetOptions{})
if err != nil {
clusterConfig, _ := kubectl.GetClientConfig()
clusterConfig, _ := kubectl.GetClientConfig(false)
if clusterConfig.AuthProvider != nil && clusterConfig.AuthProvider.Name == "gcp" {
createRoleBinding := stdinutil.GetFromStdin(&stdinutil.GetFromStdinParams{
Question: "Do you want the ClusterRoleBinding '" + clusterRoleBindingName + "' to be created automatically? (yes|no)",
Expand Down
7 changes: 5 additions & 2 deletions docs/docs/cli/add.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
title: devspace add
---

With `devspace add`, you can add ports for portForwarding and paths to the sync configuration.
With `devspace add`, you can add ports for portForwarding, deployments, packages and paths to the sync configuration.

```bash
Usage:
devspace add [command]

Available Commands:
deployment Add a deployment
package Add a helm chart
port Lists port forwarding configuration
port Add a new port forward configuration
sync Add a sync path to the devspace

Flags:
-h, --help help for add

Use "devspace add [command] --help" for more information about a command.
```
5 changes: 3 additions & 2 deletions docs/docs/cli/add_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: devspace add package
---

With `devspace add package`, you can easily add a package (helm chart) like mysql, nginx etc. to your devspace. To view all available packages run `devspace add package`.
With `devspace add package`, you can easily add a package (helm chart) like mysql, nginx etc. to a deployment in your devspace (Only works if deployment method is helm). To view all available packages run `devspace add package`.

The devspace add package command adds the helm chart as a dependency in the requirements.yaml and calls the internal `helm dependency update` (helm doesn't need to be installed), which downloads the chart and places it in the chart/charts folder. To remove the dependency call `devspace remove package PACKAGE`.

Expand All @@ -15,12 +15,13 @@ Usage:
Flags:
--app-version string App version
--chart-version string Chart version
-d, --deployment string The deployment name to use
-h, --help help for package
--skip-question Skips the question to show the readme in a browser

Examples:
devspace add package # Shows all available packages
devspace add package mysql # Adds the mysql chart to the devspace
devspace add package mysql --app-version=5.7.14 # Adds the mysql chart with app version 5.7.14 to the devspace
devspace add package mysql --chart-version=0.10.3 # Adds the mysql chart with chart version 0.10.3 to the devspace
devspace add package mysql --chart-version=0.10.3 -d devspace-default # Adds the mysql chart with chart version 0.10.3 to the devspace
```
2 changes: 1 addition & 1 deletion docs/docs/cli/down.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: devspace down
---

Run `devspace down` to shutdown your DevSpace.
Run `devspace down` to shutdown your DevSpace. Stops your DevSpace by removing the release via helm (if deployment method is helm) or by running kubectl delete over the manifests. If you want to remove all DevSpace related data from your project, use: devspace reset.

```bash
Usage:
Expand Down
9 changes: 6 additions & 3 deletions docs/docs/cli/enter.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ Usage:
devspace enter [flags]

Flags:
-c, --container string Container name within pod where to execute command
-h, --help help for enter
-c, --container string Container name within pod where to execute command
-h, --help help for enter
-l, --label-selector string Comma separated key=value selector list (e.g. release=test)
-n, --namespace string Namespace where to select pods

Examples:
devspace enter
devspace enter bash
devspace enter echo 123
devspace enter -c myContainer
devspace enter echo 123 -n my-namespace
devspace enter bash -l release=test
```
10 changes: 3 additions & 7 deletions docs/docs/cli/init.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ title: devspace init

Run `devspace init` to get your project ready to start a DevSpace.

```bash
```
Usage:
devspace init [flags]

Expand All @@ -13,15 +13,14 @@ Flags:
-l, --language string Programming language of your project
-o, --overwrite Overwrite existing chart files and Dockerfile
-r, --reconfigure Change existing configuration
--templateRepoPath string Local path for cloning chart template repository (uses temp folder
if not specified)
--templateRepoPath string Local path for cloning chart template repository (uses temp folder if not specified)
--templateRepoUrl string Git repository for chart templates (default "https://github.com/covexo/devspace-templates.git")
```

## File Structure
Running `devspace init` will create the following files for you:

```bash
```
YOUR_PROJECT_PATH/
|
|-- Dockerfile
Expand All @@ -31,11 +30,8 @@ YOUR_PROJECT_PATH/
| |-- values.yaml
| |-- templates/
| |-- deployment.yaml
| |-- service.yaml
| |-- ingress.yaml
|
|-- .devspace/
| |-- .gitignore
| |-- cluster.yaml
| |-- config.yaml
```
7 changes: 4 additions & 3 deletions docs/docs/cli/remove_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: devspace remove package
---

With `devspace remove package`, you can remove a package from the devspace.
With `devspace remove package`, you can remove a package from a devspace deployment.

`devspace remove package` deletes the specified packagename from the chart/requirements.yaml and executes the internal `helm dependency update` function.

Expand All @@ -11,6 +11,7 @@ Usage:
devspace remove package [flags]

Flags:
--all Remove all packages
-h, --help help for package
--all Remove all packages
-d, --deployment string The deployment name to use
-h, --help help for package
```
45 changes: 22 additions & 23 deletions docs/docs/cli/up.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,36 @@
title: devspace up
---

With `devspace up`, you build your image, start your DevSpace and connect to it.
With `devspace up`, the defined images are build, deployments are deployed and services started.

The command will do the following:

1. Ensure that a tiller server is available (if not it will automatically deploy one to the specified namespace)
2. Optionally it will deploy a docker registry if this was desired
3. Build the docker image if changed or forced by -b
* Push the built image to the specified registry
5. Redeploy the chart if release was not found, image was rebuilt or -d option was specified
6. Establish port forwarding and sync
7. Execute the specified command in the container (default: open a terminal)
1. Build the specified images using docker or kaniko
2. Push the built images to the corresponding registries (either to a local or remote registry)
3. Deploy the configured deployments via helm or kubectl
4. Establish port forwarding and sync
5. Execute the specified command in the selected container (default: open a terminal)

```bash
```
Usage:
devspace up [flags]

Flags:
-b, --build Force image build
-c, --container string Container name where to open the shell
-d, --deploy Force chart deployment
-h, --help help for up
--init-registries Initialize registries (and install internal one) (default true)
--no-sleep Enable no-sleep (Override the containers.default.command and containers.default.args values with empty strings)
--portforwarding Enable port forwarding (default true)
--sync Enable code synchronization (default true)
--tiller Install/upgrade tiller (default true)
--verbose-sync When enabled the sync will log every file change
-b, --build Force image build
-c, --container string Container name where to open the shell
-d, --deploy Force chart deployment
-h, --help help for up
--init-registries Initialize registries (and install internal one) (default true)
-l, --label-selector string Comma separated key=value selector list (e.g. release=test)
-n, --namespace string Namespace where to select pods
--portforwarding Enable port forwarding (default true)
--switch-context Switch kubectl context to the devspace context
--sync Enable code synchronization (default true)
--tiller Install/upgrade tiller (default true)
--verbose-sync When enabled the sync will log every file change

Examples:
devspace up # Start the devspace
devspace up bash # Execute bash command after deploying
devspace up # Start the devspace
devspace up bash # Execute bash command after deploying
devspace up --switch-context # Change kubectl context to devspace context that is used
```

**Note**: Every time you run `devspace up`, your containers will be re-deployed. This way, you will always start with a clean state.
Loading