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
17 changes: 8 additions & 9 deletions cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ import (

// AddCmd holds the information needed for the add command
type AddCmd struct {
flags *AddCmdFlags
syncFlags *addSyncCmdFlags
portFlags *addPortCmdFlags
dsConfig *v1.DevSpaceConfig
privateConfig *v1.PrivateConfig
workdir string
flags *AddCmdFlags
syncFlags *addSyncCmdFlags
portFlags *addPortCmdFlags
dsConfig *v1.DevSpaceConfig
workdir string
}

// AddCmdFlags holds the possible flags for the add command
Expand Down Expand Up @@ -128,14 +127,14 @@ func (cmd *AddCmd) RunAddSync(cobraCmd *cobra.Command, args []string) {
log.Fatalf("Error parsing selectors: %s", err.Error())
}

excludedPaths := make([]*string, 0, 0)
excludedPaths := make([]string, 0, 0)

if cmd.syncFlags.ExcludedPaths != "" {
excludedPathStrings := strings.Split(cmd.syncFlags.ExcludedPaths, ",")

for _, v := range excludedPathStrings {
excludedPath := strings.TrimSpace(v)
excludedPaths = append(excludedPaths, &excludedPath)
excludedPaths = append(excludedPaths, excludedPath)
}
}

Expand All @@ -144,7 +143,7 @@ func (cmd *AddCmd) RunAddSync(cobraCmd *cobra.Command, args []string) {
LabelSelector: labelSelectorMap,
ContainerPath: configutil.String(cmd.syncFlags.ContainerPath),
LocalSubPath: configutil.String(cmd.syncFlags.LocalPath),
ExcludeRegex: excludedPaths,
ExcludePaths: excludedPaths,
})

err = configutil.SaveConfig()
Expand Down
11 changes: 5 additions & 6 deletions cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ import (

// InstallCmd is a struct that defines a command call for "install"
type InstallCmd struct {
flags *InstallCmdFlags
helm *helmClient.HelmClientWrapper
kubectl *kubernetes.Clientset
privateConfig *v1.PrivateConfig
dsConfig *v1.DevSpaceConfig
workdir string
flags *InstallCmdFlags
helm *helmClient.HelmClientWrapper
kubectl *kubernetes.Clientset
dsConfig *v1.DevSpaceConfig
workdir string
}

// InstallCmdFlags are the flags available for the install-command
Expand Down
4 changes: 2 additions & 2 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ func (cmd *ListCmd) RunListSync(cobraCmd *cobra.Command, args []string) {

excludedPaths := ""

for _, v := range value.ExcludeRegex {
for _, v := range value.ExcludePaths {
if len(excludedPaths) > 0 {
excludedPaths += ", "
}

excludedPaths += *v
excludedPaths += v
}

syncPaths = append(syncPaths, []string{
Expand Down
13 changes: 8 additions & 5 deletions cmd/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,14 @@ func (cmd *UpCmd) startSync() []*synctool.SyncConfig {
log.Panicf("Unable to list devspace pods: %s", err.Error())
} else if pod != nil {
syncConfig := &synctool.SyncConfig{
Kubectl: cmd.kubectl,
Pod: pod,
Container: &pod.Spec.Containers[0],
WatchPath: absLocalPath,
DestPath: *syncPath.ContainerPath,
Kubectl: cmd.kubectl,
Pod: pod,
Container: &pod.Spec.Containers[0],
WatchPath: absLocalPath,
DestPath: *syncPath.ContainerPath,
ExcludePaths: syncPath.ExcludePaths,
DownloadExcludePaths: syncPath.DownloadExcludePaths,
UploadExcludePaths: syncPath.UploadExcludePaths,
}

err = syncConfig.Start()
Expand Down
3 changes: 1 addition & 2 deletions docs/.devspace/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
logs/
private.yaml
cache.yaml
overwrite.yaml
18 changes: 18 additions & 0 deletions docs/.devspace/private.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: v1
release:
name: devspace-docs
namespace: devspace-docs
latestBuild: "2018-08-27T17:32:42.5568625+02:00"
latestImage: 10.99.117.105:5000/devspace-docs:vkY31ug8IQ
registry:
release:
name: devspace-registry
namespace: devspace-docs
latestBuild: ""
latestImage: ""
user:
username: user-xNAsk
password: tY2XpapTMUjt
cluster:
tillerNamespace: devspace-docs
useKubeConfig: true
110 changes: 89 additions & 21 deletions docs/docs/configuration/config.yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,108 @@ title: /.devspace/config.yaml
This is an example of a [.devspace/config.yaml](#)
```yaml
version: v1
portForwarding:
- resourceType: pod
labelSelector:
release: my-app
portMappings:
- localPort: 3000
remotePort: 3000
- localPort: 8080
remotePort: 80
syncPath:
- resourceType: pod
labelSelector:
release: my-app
localSubPath: ./
containerPath: /app
registry:
secrets:
htpasswd: ""
devSpace:
release:
name: devspace-cloud-com
namespace: dev-gentele
portForwarding:
- resourceType: pod
labelSelector:
release: my-app
portMappings:
- localPort: 3000
remotePort: 3000
- localPort: 8080
remotePort: 80
sync:
- resourceType: pod
labelSelector:
release: my-app
localSubPath: ./
containerPath: /app
image:
name: devspace
services:
registry:
internal:
release:
name: devspace-registry
namespace: dev-gentele
user:
username: user-XXXXX
password: XXXXXXXXXX
tiller:
release:
namespace: dev-gentele
cluster:
useKubeConfig: true

```
A [.devspace/config.yaml](#) contains any public/shared configuration for running a DevSpace for the respective project. It is highly recommended to put this file under version control (e.g. git add).

## Port Forwarding
**Note: You can easily re-configure your DevSpace by running `devspace init -r`.**

## devspace
Defines your DevSpace including everything related to portForwarding, sync, and the release config.

### devspace.release
Defines how the DevSpace is deployed to your cluster. See [Type: Release](#type-release) for details.

### devspace.portForwarding
To access applications running inside a DevSpace, the DevSpace CLI allows to configure port forwardings. A port forwarding consists of the following:
- `resourceType` (currently only `pod` is supported)
- `labelSelector` (usually the release/app name)
- a list of `portMappings` (each specifying a `localPort` on localhost and a `remotePort` within the DevSpace)

In the example above, you could open `localhost:8080` inside your browser to see the output of the application listening on port 80 within your DevSpace.

## Sync Paths
To comfortably sync code to a DevSpace, the DevSpace CLI allows to configure sync paths. A sync path consists of the following:
### devspace.sync
To comfortably sync code to a DevSpace, the DevSpace CLI allows to configure real-time code synchronizations. A sync config consists of the following:
- `resourceType` (currently only `pod` is supported)
- `labelSelector` (usually the release/app name)
- `localSubPath` (relative to your local project root)
- `containerPath` (absolute path within your DevSpace)
- `excludePaths` (for excluding files/folders from sync in .gitignore syntax)
- `DownloadExcludePaths` (for excluding files/folders from download in .gitignore syntax)
- `UploadExcludePaths` (for excluding files/folders from upload in .gitignore syntax)

In the example above, the entire code within the project would be synchronized with the folder `/app` inside the DevSpace.

## image
An image is defined by:
- `name` of the image that is being pushed to the registry
- `tag` stating the latest tag pushed to the registry
- `buildTime` (time of the latest image build process, i.e. docker build)

## services
Defines additional services for your DevSpace.

### services.registry
The `registry` field specifies:
- `external` tells the DevSpace CLI to push to an external registry (format: myregistry.com:port)
- `internal` defines a private cluster-internal registry by defining a `release` for it
- `user` credentials (`username`, `password`) for pushing to / pulling from the registry
- `insecure` flag to allow pushing to registries without HTTPS

### services.tiller
The `tiller` service is defined by:
- `release` definition for tiller (see [Type: Release](#type-release))
- `appNamespaces` defining a list of namespace that tiller may deploy applications to

## cluster
The `cluster` field specifies:
- `useKubeConfig` (yes to use the credentials defined in $HOME/.kube/config)

If `useKubeConfig: false` is used, the following fields need to be specified:
- `apiServer` (Kubernetes API-Server URL)
- `caCert` (CaCert for the Kubernetes API-Server in PEM format)
- `user` specifying the following:
- `username`
- `clientCert` (PEM format)
- `clientKey` (PEM format)

## Type: Release
A `release` is specified through:
- `name` of the release
- `namespace` to deploy the release to
- `values` that are set during the deployment (contents of the values.yaml in helm)
7 changes: 7 additions & 0 deletions docs/docs/configuration/overwrite.yaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: /.devspace/overwrite.yaml
---

The [.devspace/overwrite.yaml](#) allows you to define a config that overwrites the config values defined in [.devspace/config.yaml](config.yaml.html). It has the exact same format as the [.devspace/config.yaml](config.yaml.html).

**Note: This file should **never** be checked into a version control system. Therefore, the DevSpace CLI will automatically create a [.gitignore](#) file within [.devspace/](#) that tells git not to version this file.**
53 changes: 0 additions & 53 deletions docs/docs/configuration/private.yaml.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/website/sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"configuration/dockerfile",
"configuration/chart",
"configuration/config.yaml",
"configuration/private.yaml"
"configuration/overwrite.yaml"
],
"Advanced": [
"advanced/logs",
Expand Down
3 changes: 0 additions & 3 deletions pkg/devspace/clients/kubectl/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"sync"

"github.com/covexo/devspace/pkg/devspace/config/configutil"
"github.com/covexo/devspace/pkg/devspace/config/v1"
"github.com/covexo/devspace/pkg/util/log"
dockerterm "github.com/docker/docker/pkg/term"
k8sv1 "k8s.io/api/core/v1"
Expand All @@ -29,8 +28,6 @@ import (
"k8s.io/kubernetes/pkg/util/node"
)

var privateConfig = &v1.PrivateConfig{}

//NewClient creates a new kubernetes client
func NewClient() (*kubernetes.Clientset, error) {
config, err := GetClientConfig()
Expand Down
20 changes: 7 additions & 13 deletions pkg/devspace/config/v1/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,13 @@ type PortMapping struct {

//SyncConfig defines the paths for a SyncFolder
type SyncConfig struct {
ResourceType *string `yaml:"resourceType"`
LabelSelector map[string]*string `yaml:"labelSelector"`
LocalSubPath *string `yaml:"localSubPath"`
ContainerPath *string `yaml:"containerPath"`
ExcludeRegex []*string `yaml:"excludeRegex"`
}

//PrivateConfig defines the private config of the users' computer
type PrivateConfig struct {
Version *string `yaml:"version"`
Release *Release `yaml:"release"`
Tiller *TillerConfig `yaml:"tiller,omitempty"`
Registry *RegistryConfig `yaml:"registry"`
ResourceType *string `yaml:"resourceType"`
LabelSelector map[string]*string `yaml:"labelSelector"`
LocalSubPath *string `yaml:"localSubPath"`
ContainerPath *string `yaml:"containerPath"`
ExcludePaths []string `yaml:"excludePaths"`
DownloadExcludePaths []string `yaml:"downloadExcludePaths"`
UploadExcludePaths []string `yaml:"uploadExcludePaths"`
}

//Release defines running version of a project
Expand Down
2 changes: 0 additions & 2 deletions pkg/devspace/kaniko/kaniko.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (

// BuildDockerfile builds a dockerfile in a kaniko build pod
func BuildDockerfile(client *kubernetes.Clientset, buildNamespace, imageDestination, pullSecretName string, allowInsecureRegistry bool) error {
//registrySecretName := cmd.privateConfig.Registry.Release.Name + "-docker-registry-secret"
//registryHostname := cmd.privateConfig.Registry.Release.Name + "-docker-registry." + cmd.privateConfig.Registry.Release.Namespace + ".svc.cluster.local:5000"
workdir, err := os.Getwd()

if err != nil {
Expand Down