Skip to content

Commit 567e7aa

Browse files
authored
Merge pull request #2503 from 89luca89/main
docs: add documentation page for inline manifests. Fix ENG-652
2 parents 6d3d034 + 5d3a2f3 commit 567e7aa

6 files changed

Lines changed: 142 additions & 0 deletions

File tree

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
<details className="config-field" data-expandable="false" open>
3+
<summary>
4+
5+
#### `inlineManifest` <span className="config-field-type">string</span> <span className="config-field-default"></span> <span className="config-field-enum"></span> {#deployments-kubectl-inline-manifests}
6+
7+
InlineManifest is a block containing the yaml manifest that will be deployed by DevSpace using kubectl
8+
or kustomize
9+
10+
</summary>
11+
12+
13+
14+
</details>

docs/pages/configuration/_partials/v2beta1/deployments/kubectl_reference.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
import PartialManifests from "./kubectl/manifests.mdx"
3+
import PartialInlineManifests from "./kubectl/inline_manifests.mdx"
34
import PartialApplyArgs from "./kubectl/applyArgs.mdx"
45
import PartialCreateArgs from "./kubectl/createArgs.mdx"
56
import PartialKubectlBinaryPath from "./kubectl/kubectlBinaryPath.mdx"
@@ -8,6 +9,9 @@ import PartialGroupkustomize from "./kubectl/group_kustomize.mdx"
89
<PartialManifests />
910

1011

12+
<PartialInlineManifests />
13+
14+
1115
<PartialApplyArgs />
1216

1317

docs/pages/configuration/deployments/kubectl/README.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import ConfigPartial from '../../_partials/v2beta1/deployments/kubectl.mdx'
88

99
DevSpace supports two types of deployments aside from Helm charts:
1010
- [`Kubernetes manifests`](./manifests.mdx) (think `kubectl apply -f manifest.yaml`)
11+
- [`Kubernetes inline manifests`](./inline_manifests.mdx) (think `kubectl apply -f manifest.yaml`)
1112
- [`Kustomizations`](./kustomizations.mdx) (think `kubectl apply -k kustomization/`)
1213

1314

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
title: Deploy Kubernetes Inline Manifests
3+
sidebar_label: InlineManifests
4+
---
5+
6+
import FragmentKubectlApplyArgs from '../../../_partials/kubectl-options-applyArgs.mdx';
7+
import FragmentKubectlBinaryPath from '../../../_partials/kubectl-options-binaryPath.mdx';
8+
import FragmentKubectlKustomize from '../../../_partials/kubectl-kustomize.mdx';
9+
import FragmentKustomizeKustomizeArgs from '../../../_partials/kustomize-options-kustomizeArgs.mdx';
10+
import FragmentUpdateImageTags from '../../../_partials/kubectl-updateImageTags.mdx';
11+
12+
To deploy Kubernetes using inline manifests with `kubectl apply`, you need to configure them within the `deployments` section of the `devspace.yaml`.
13+
14+
15+
## Example
16+
```yaml title=devspace.yaml
17+
pipelines:
18+
dev:
19+
run: |
20+
create_deployments backend
21+
create_deployments frontend
22+
deployments:
23+
backend:
24+
kubectl:
25+
inlineManifest:
26+
apiVersion: v1
27+
kind: Pod
28+
metadata:
29+
name: busybox-sleep
30+
spec:
31+
containers:
32+
- name: busybox
33+
image: busybox:1.28
34+
args:
35+
- sleep
36+
- "1000000"
37+
frontend:
38+
kubectl:
39+
manifests:
40+
- frontend/manifest.yaml
41+
```
42+
43+
The above example will be executed during the deployment process as follows:
44+
```bash
45+
cat <<EOF | kubectl apply -f -
46+
apiVersion: v1
47+
kind: Pod
48+
metadata:
49+
name: busybox-sleep
50+
spec:
51+
containers:
52+
- name: busybox
53+
image: busybox:1.28
54+
args:
55+
- sleep
56+
- "1000000"
57+
EOF
58+
```
59+
60+
61+
## Update Image Tags
62+
63+
<FragmentUpdateImageTags/>
64+
65+
66+
## `kubectl` Binary
67+
Deployments with `kubectl` require `kubectl` to be installed. If the `kubectl` binary cannot be found within the `$PATH` variable and it is not specified by specifying the [`kubectlBinaryPath` option](./README.mdx#deployments-kubectl-kubectlBinaryPath), DevSpace will download the `kubectl` binary into the `$HOME/.devspace/bin` folder.
68+
69+
70+
71+
## Extra Arguments
72+
When deploying manifests via `kubectl`, DevSpace can pass additional arguments and flags to the `kubectl` commands used for the deployment process.
73+
74+
### Args For `kubectl create`
75+
The `createArgs` option expects an array of strings stating additional arguments (and flags) that should be used when calling `kubectl create`.
76+
77+
#### Example: Custom Kubectl Args & Flags
78+
```yaml
79+
deployments:
80+
backend:
81+
kubectl:
82+
inlineManifest:
83+
apiVersion: v1
84+
kind: Pod
85+
metadata:
86+
name: busybox-sleep
87+
spec:
88+
containers:
89+
- name: busybox
90+
image: busybox:1.28
91+
args:
92+
- sleep
93+
- "1000000"
94+
createArgs:
95+
- "--recursive"
96+
```
97+
**Explanation:**
98+
Deploying the above example would roughly be equivalent to this command:
99+
```bash
100+
cat <<EOF | kubectl create --dry-run --output yaml --validate=false --recursive -f -
101+
apiVersion: v1
102+
kind: Pod
103+
metadata:
104+
name: busybox-sleep
105+
spec:
106+
containers:
107+
- name: busybox
108+
image: busybox:1.28
109+
args:
110+
- sleep
111+
- "1000000"
112+
EOF
113+
```
114+
115+
116+
### Args For `kubectl apply`
117+
118+
<FragmentKubectlApplyArgs/>

docs/schemas/config-openapi.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,10 @@
11681168
"type": "array",
11691169
"description": "Manifests is a list of files or folders that will be deployed by DevSpace using kubectl\nor kustomize"
11701170
},
1171+
"inlineManifest": {
1172+
"type": "string",
1173+
"description": "InlineManifest is a block containing the yaml that will be deployed by DevSpace using kubectl"
1174+
},
11711175
"applyArgs": {
11721176
"items": {
11731177
"type": "string"

docs/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ module.exports = {
9090
link: { type: 'doc', id: 'configuration/deployments/kubectl/README' },
9191
items: [
9292
'configuration/deployments/kubectl/manifests',
93+
'configuration/deployments/kubectl/inline_manifests',
9394
'configuration/deployments/kubectl/kustomizations',
9495
],
9596
},

0 commit comments

Comments
 (0)