Skip to content

Commit 982dad4

Browse files
author
Lukas Gentele
authored
Merge pull request #158 from covexo/issue-101
resolves #101 and #146
2 parents 21a297e + 976a126 commit 982dad4

13 files changed

Lines changed: 146 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: 89 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,40 +5,108 @@ 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+
**Note: You can easily re-configure your DevSpace by running `devspace init -r`.**
48+
49+
## devspace
50+
Defines your DevSpace including everything related to portForwarding, sync, and the release config.
51+
52+
### devspace.release
53+
Defines how the DevSpace is deployed to your cluster. See [Type: Release](#type-release) for details.
54+
55+
### devspace.portForwarding
3056
To access applications running inside a DevSpace, the DevSpace CLI allows to configure port forwardings. A port forwarding consists of the following:
3157
- `resourceType` (currently only `pod` is supported)
3258
- `labelSelector` (usually the release/app name)
3359
- a list of `portMappings` (each specifying a `localPort` on localhost and a `remotePort` within the DevSpace)
3460

3561
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.
3662

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:
63+
### devspace.sync
64+
To comfortably sync code to a DevSpace, the DevSpace CLI allows to configure real-time code synchronizations. A sync config consists of the following:
3965
- `resourceType` (currently only `pod` is supported)
4066
- `labelSelector` (usually the release/app name)
4167
- `localSubPath` (relative to your local project root)
4268
- `containerPath` (absolute path within your DevSpace)
69+
- `excludePaths` (for excluding files/folders from sync in .gitignore syntax)
70+
- `DownloadExcludePaths` (for excluding files/folders from download in .gitignore syntax)
71+
- `UploadExcludePaths` (for excluding files/folders from upload in .gitignore syntax)
4372

4473
In the example above, the entire code within the project would be synchronized with the folder `/app` inside the DevSpace.
74+
75+
## image
76+
An image is defined by:
77+
- `name` of the image that is being pushed to the registry
78+
- `tag` stating the latest tag pushed to the registry
79+
- `buildTime` (time of the latest image build process, i.e. docker build)
80+
81+
## services
82+
Defines additional services for your DevSpace.
83+
84+
### services.registry
85+
The `registry` field specifies:
86+
- `external` tells the DevSpace CLI to push to an external registry (format: myregistry.com:port)
87+
- `internal` defines a private cluster-internal registry by defining a `release` for it
88+
- `user` credentials (`username`, `password`) for pushing to / pulling from the registry
89+
- `insecure` flag to allow pushing to registries without HTTPS
90+
91+
### services.tiller
92+
The `tiller` service is defined by:
93+
- `release` definition for tiller (see [Type: Release](#type-release))
94+
- `appNamespaces` defining a list of namespace that tiller may deploy applications to
95+
96+
## cluster
97+
The `cluster` field specifies:
98+
- `useKubeConfig` (yes to use the credentials defined in $HOME/.kube/config)
99+
100+
If `useKubeConfig: false` is used, the following fields need to be specified:
101+
- `apiServer` (Kubernetes API-Server URL)
102+
- `caCert` (CaCert for the Kubernetes API-Server in PEM format)
103+
- `user` specifying the following:
104+
- `username`
105+
- `clientCert` (PEM format)
106+
- `clientKey` (PEM format)
107+
108+
## Type: Release
109+
A `release` is specified through:
110+
- `name` of the release
111+
- `namespace` to deploy the release to
112+
- `values` that are set during the deployment (contents of the values.yaml in helm)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: /.devspace/overwrite.yaml
3+
---
4+
5+
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).
6+
7+
**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.**

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)