Skip to content

Commit b029d2d

Browse files
author
gentele
committed
resolves #101 and #146
1 parent efe6e6a commit b029d2d

13 files changed

Lines changed: 165 additions & 117 deletions

File tree

cmd/add.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@ import (
1313

1414
// AddCmd holds the information needed for the add command
1515
type AddCmd struct {
16-
flags *AddCmdFlags
17-
syncFlags *addSyncCmdFlags
18-
portFlags *addPortCmdFlags
19-
dsConfig *v1.DevSpaceConfig
20-
privateConfig *v1.PrivateConfig
21-
workdir string
16+
flags *AddCmdFlags
17+
syncFlags *addSyncCmdFlags
18+
portFlags *addPortCmdFlags
19+
dsConfig *v1.DevSpaceConfig
20+
workdir string
2221
}
2322

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

131-
excludedPaths := make([]*string, 0, 0)
130+
excludedPaths := make([]string, 0, 0)
132131

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

136135
for _, v := range excludedPathStrings {
137136
excludedPath := strings.TrimSpace(v)
138-
excludedPaths = append(excludedPaths, &excludedPath)
137+
excludedPaths = append(excludedPaths, excludedPath)
139138
}
140139
}
141140

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

150149
err = configutil.SaveConfig()

cmd/install.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ import (
1717

1818
// InstallCmd is a struct that defines a command call for "install"
1919
type InstallCmd struct {
20-
flags *InstallCmdFlags
21-
helm *helmClient.HelmClientWrapper
22-
kubectl *kubernetes.Clientset
23-
privateConfig *v1.PrivateConfig
24-
dsConfig *v1.DevSpaceConfig
25-
workdir string
20+
flags *InstallCmdFlags
21+
helm *helmClient.HelmClientWrapper
22+
kubectl *kubernetes.Clientset
23+
dsConfig *v1.DevSpaceConfig
24+
workdir string
2625
}
2726

2827
// InstallCmdFlags are the flags available for the install-command

cmd/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ func (cmd *ListCmd) RunListSync(cobraCmd *cobra.Command, args []string) {
107107

108108
excludedPaths := ""
109109

110-
for _, v := range value.ExcludeRegex {
110+
for _, v := range value.ExcludePaths {
111111
if len(excludedPaths) > 0 {
112112
excludedPaths += ", "
113113
}
114114

115-
excludedPaths += *v
115+
excludedPaths += v
116116
}
117117

118118
syncPaths = append(syncPaths, []string{

cmd/up.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,14 @@ func (cmd *UpCmd) startSync() []*synctool.SyncConfig {
368368
log.Panicf("Unable to list devspace pods: %s", err.Error())
369369
} else if pod != nil {
370370
syncConfig := &synctool.SyncConfig{
371-
Kubectl: cmd.kubectl,
372-
Pod: pod,
373-
Container: &pod.Spec.Containers[0],
374-
WatchPath: absLocalPath,
375-
DestPath: *syncPath.ContainerPath,
371+
Kubectl: cmd.kubectl,
372+
Pod: pod,
373+
Container: &pod.Spec.Containers[0],
374+
WatchPath: absLocalPath,
375+
DestPath: *syncPath.ContainerPath,
376+
ExcludePaths: syncPath.ExcludePaths,
377+
DownloadExcludePaths: syncPath.DownloadExcludePaths,
378+
UploadExcludePaths: syncPath.UploadExcludePaths,
376379
}
377380

378381
err = syncConfig.Start()

docs/.devspace/.gitignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
logs/
2-
private.yaml
3-
cache.yaml
2+
overwrite.yaml

docs/.devspace/private.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: v1
2+
release:
3+
name: devspace-docs
4+
namespace: devspace-docs
5+
latestBuild: "2018-08-27T17:32:42.5568625+02:00"
6+
latestImage: 10.99.117.105:5000/devspace-docs:vkY31ug8IQ
7+
registry:
8+
release:
9+
name: devspace-registry
10+
namespace: devspace-docs
11+
latestBuild: ""
12+
latestImage: ""
13+
user:
14+
username: user-xNAsk
15+
password: tY2XpapTMUjt
16+
cluster:
17+
tillerNamespace: devspace-docs
18+
useKubeConfig: true

docs/docs/configuration/config.yaml.md

Lines changed: 87 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,106 @@ title: /.devspace/config.yaml
55
This is an example of a [.devspace/config.yaml](#)
66
```yaml
77
version: v1
8-
portForwarding:
9-
- resourceType: pod
10-
labelSelector:
11-
release: my-app
12-
portMappings:
13-
- localPort: 3000
14-
remotePort: 3000
15-
- localPort: 8080
16-
remotePort: 80
17-
syncPath:
18-
- resourceType: pod
19-
labelSelector:
20-
release: my-app
21-
localSubPath: ./
22-
containerPath: /app
23-
registry:
24-
secrets:
25-
htpasswd: ""
8+
devSpace:
9+
release:
10+
name: devspace-cloud-com
11+
namespace: dev-gentele
12+
portForwarding:
13+
- resourceType: pod
14+
labelSelector:
15+
release: my-app
16+
portMappings:
17+
- localPort: 3000
18+
remotePort: 3000
19+
- localPort: 8080
20+
remotePort: 80
21+
sync:
22+
- resourceType: pod
23+
labelSelector:
24+
release: my-app
25+
localSubPath: ./
26+
containerPath: /app
27+
image:
28+
name: devspace
29+
services:
30+
registry:
31+
internal:
32+
release:
33+
name: devspace-registry
34+
namespace: dev-gentele
35+
user:
36+
username: user-XXXXX
37+
password: XXXXXXXXXX
38+
tiller:
39+
release:
40+
namespace: dev-gentele
41+
cluster:
42+
useKubeConfig: true
43+
2644
```
2745
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).
2846

29-
## Port Forwarding
47+
## devspace
48+
Defines your DevSpace including everything related to portForwarding, sync, and the release config.
49+
50+
### devspace.release
51+
Defines how the DevSpace is deployed to your cluster. See [Type: Release](#type-release) for details.
52+
53+
### devspace.portForwarding
3054
To access applications running inside a DevSpace, the DevSpace CLI allows to configure port forwardings. A port forwarding consists of the following:
3155
- `resourceType` (currently only `pod` is supported)
3256
- `labelSelector` (usually the release/app name)
3357
- a list of `portMappings` (each specifying a `localPort` on localhost and a `remotePort` within the DevSpace)
3458

3559
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.
3660

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

4471
In the example above, the entire code within the project would be synchronized with the folder `/app` inside the DevSpace.
72+
73+
## image
74+
An image is defined by:
75+
- `name` of the image that is being pushed to the registry
76+
- `tag` stating the latest tag pushed to the registry
77+
- `buildTime` (time of the latest image build process, i.e. docker build)
78+
79+
## services
80+
Defines additional services for your DevSpace.
81+
82+
### services.registry
83+
The `registry` field specifies:
84+
- `external` tells the DevSpace CLI to push to an external registry (format: myregistry.com:port)
85+
- `internal` defines a private cluster-internal registry by defining a `release` for it
86+
- `user` credentials (`username`, `password`) for pushing to / pulling from the registry
87+
- `insecure` flag to allow pushing to registries without HTTPS
88+
89+
### services.tiller
90+
The `tiller` service is defined by:
91+
- `release` definition for tiller (see [Type: Release](#type-release))
92+
- `appNamespaces` defining a list of namespace that tiller may deploy applications to
93+
94+
## cluster
95+
The `cluster` field specifies:
96+
- `useKubeConfig` (yes to use the credentials defined in $HOME/.kube/config)
97+
98+
If `useKubeConfig: false` is used, the following fields need to be specified:
99+
- `apiServer` (Kubernetes API-Server URL)
100+
- `caCert` (CaCert for the Kubernetes API-Server in PEM format)
101+
- `user` specifying the following:
102+
- `username`
103+
- `clientCert` (PEM format)
104+
- `clientKey` (PEM format)
105+
106+
## Type: Release
107+
A `release` is specified through:
108+
- `name` of the release
109+
- `namespace` to deploy the release to
110+
- `values` that are set during the deployment (contents of the values.yaml in helm)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: /.devspace/overwrite.yaml
3+
---
4+
5+
This is an example of the [.devspace/overwrite.yaml](#)
6+
7+
```yaml
8+
version: v1
9+
release:
10+
name: devspace-docs
11+
namespace: devspace-docs
12+
latestBuild: "2018-08-27T17:32:42.5568625+02:00"
13+
latestImage: 10.99.117.105:5000/devspace-docs:vkY31ug8IQ
14+
registry:
15+
release:
16+
name: devspace-registry
17+
namespace: devspace-docs
18+
user:
19+
username: user-xNAsk
20+
password: tY2XpapTMUjt
21+
cluster:
22+
tillerNamespace: devspace-docs
23+
useKubeConfig: true
24+
```
25+
26+
The [.devspace/overwrite.yaml](#) is defined for every developer who wants to use a DevSpace for working on the respective project. 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.
27+
28+
**Note: You can easily re-configure your DevSpace by running `devspace init -r`. Therefore, changing this file manually is highly discouraged.**

docs/docs/configuration/private.yaml.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

docs/website/sidebars.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"configuration/dockerfile",
2121
"configuration/chart",
2222
"configuration/config.yaml",
23-
"configuration/private.yaml"
23+
"configuration/overwrite.yaml"
2424
],
2525
"Advanced": [
2626
"advanced/logs",

0 commit comments

Comments
 (0)