Skip to content

Commit 0f2a736

Browse files
author
hadar-co
committed
Import docs
1 parent 3771dd7 commit 0f2a736

File tree

179 files changed

+28257
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+28257
-2
lines changed

Diff for: README.md

+41-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,41 @@
1-
# docs
2-
Datree documentation
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

Diff for: babel.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
3+
};

Diff for: docs/built-in-rules/Deprecation/_category_.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Deprecation",
3+
"className": "hide"
4+
}

Diff for: docs/built-in-rules/Deprecation/index.mdx

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: Deprecation
3+
slug: /built-in-rules/deprecation
4+
---
5+
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
9+
import { BuiltInRulesDeprecation } from '/src/components/built-in-rules/BuiltInRulesNav.js';
10+
11+
<nav>
12+
<BuiltInRulesDeprecation />
13+
</nav>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: ☑️ Prevent deprecated APIs in Kubernetes v1.16
3+
slug: /built-in-rules/prevent-deprecated-k8s-api-116
4+
---
5+
6+
The v1.16 release stopped serving some API versions for different resource types. When a user deploys a resource with a deprecated API version, the Kubernetes engine rejects it.
7+
8+
:::tip
9+
Kubernetes v1.16 is no longer (officially) supported since 2 September 2020, So if you are still running this version, consider upgrading it as soon as possible.
10+
:::
11+
12+
**Targeted resources by this rule (types of **`kind`**): **NetworkPolicy / Deployment / DaemonSet / StatefulSet
13+
14+
**Enabled by default?** True
15+
16+
**Policy as code identifier:** K8S_DEPRECATED_APIVERSION_1.16
17+
18+
---
19+
20+
## This rule will fail
21+
22+
If one of the following API versions is used
23+
24+
- _extensions/v1beta1_
25+
26+
- _apps/v1beta1_
27+
28+
- _apps/v1beta2_
29+
30+
```yaml
31+
apiVersion: apps/v1beta2
32+
kind: Deployment
33+
```
34+
35+
### Rule output in the CLI
36+
37+
```none
38+
$ datree test *.yaml
39+
40+
>> File: failExample.yaml
41+
❌ Prevent deprecated APIs in Kubernetes v1.16 [1 occurrence]
42+
💡 Incorrect value for key `apiVersion` - the version you are trying to use is not supported by the Kubernetes cluster version (>=1.16)
43+
```
44+
45+
---
46+
47+
## How to fix this failure
48+
49+
Use \*apps/v1**\* **instead of the deprecated version
50+
51+
```yaml
52+
apiVersion: apps/v1
53+
kind: Deployment
54+
```
55+
56+
---
57+
58+
## Read more
59+
60+
- [Kubernetes docs - v1.16 deprecation guide](https://kubernetes.io/docs/reference/using-api/deprecation-guide/#v1-16)
61+
62+
- [Kubernetes blog - API deprecation in v1.16](https://kubernetes.io/blog/2019/07/18/api-deprecations-in-1-16/)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: ☑️ Prevent deprecated APIs in Kubernetes v1.17
3+
slug: /built-in-rules/prevent-deprecated-k8s-api-117
4+
---
5+
6+
The v1.17 release stopped serving some API versions for different resource types. When a user deploys a resource with a deprecated API version, the Kubernetes engine rejects it.
7+
8+
:::tip
9+
Kubernetes v1.17 is no longer (officially) supported since 30 January 2021, So if you are still running this version, consider upgrading it as soon as possible.
10+
:::
11+
12+
**Targeted resources by this rule (types of **`kind`**): **NetworkPolicy / Deployment / DaemonSet / StatefulSet
13+
14+
**Enabled by default?** True
15+
16+
**Policy as code identifier:** K8S_DEPRECATED_APIVERSION_1.17
17+
18+
---
19+
20+
## This rule will fail
21+
22+
If one of the following API versions is used
23+
24+
- _kubeadm.k8s.io/v1beta1_
25+
26+
- _rbac.authorization.k8s.io/v1alpha1_
27+
28+
- _rbac.authorization.k8s.io/v1beta1_
29+
30+
```yaml
31+
apiVersion: rbac.authorization.k8s.io/v1alpha1
32+
kind: ClusterRoleBinding
33+
```
34+
35+
### Rule output in the CLI
36+
37+
```none
38+
$ datree test *.yaml
39+
40+
>> File: failExample.yaml
41+
❌ Prevent deprecated APIs in Kubernetes v1.17 [1 occurrence]
42+
💡 Incorrect value for key `apiVersion` - the version you are trying to use is not supported by the Kubernetes cluster version (>=1.17)
43+
```
44+
45+
---
46+
47+
## How to fix this failure
48+
49+
Use \*v1**\* **instead of the deprecated version
50+
51+
```yaml
52+
apiVersion: rbac.authorization.k8s.io/v1
53+
kind: ClusterRoleBinding
54+
```
55+
56+
---
57+
58+
## Read more
59+
60+
- [Kubernetes docs - v1.17 release notes](https://v1-17.docs.kubernetes.io/docs/setup/release/notes/#deprecations-and-removals)

Diff for: docs/built-in-rules/Workload/_category_.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"label": "Workload",
3+
"className": "hide"
4+
}
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
---
2+
title: ☑️ Ensure Deployment has a configured `env` label
3+
slug: /built-in-rules/ensure-env-label
4+
---
5+
6+
Having an bulk operations in specific environments or for filtering Deployments according to their stage. Recommended values for this key are: _prod / staging / qa / admin / testing_.
7+
8+
:::tip
9+
10+
## FYI
11+
12+
Labels' keys and values are case-sensitive!
13+
:::
14+
15+
**Targeted resources by this rule (types of **`kind`**): **Deployment
16+
17+
**Enabled by default?** False
18+
19+
**Policy as code identifier:** DEPLOYMENT_MISSING_LABEL_ENV_VALUE
20+
21+
---
22+
23+
## This rule will fail
24+
25+
If the `env` key is missing from the `labels` section
26+
27+
```yaml
28+
kind: Deployment
29+
metadata:
30+
labels:
31+
owner: yoda-at-datree.io
32+
```
33+
34+
### Rule output in the CLI
35+
36+
```none
37+
$ datree test *.yaml
38+
39+
>> File: failExample.yaml
40+
❌ Ensure Deployment has a configured `env` label [1 occurrence]
41+
💡 Missing label object `env` - add a proper environment description (e.g. `prod`, `testing`, etc.) to the Deployment config
42+
```
43+
44+
---
45+
46+
## How to fix this failure
47+
48+
```yaml
49+
kind: Deployment
50+
metadata:
51+
labels:
52+
env: prod
53+
owner: yoda-at-datree.io
54+
```
55+
56+
---
57+
58+
## Read more
59+
60+
- [A Kubernetes guide for labels and selectors - labels use cases](https://www.datree.io/resources/a-kubernetes-guide-for-labels-and-selectors#anchor5)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: ☑️ Ensure workload has valid label values
3+
slug: /built-in-rules/ensure-labels-value-valid
4+
---
5+
6+
Labels are nothing more than custom key-value pairs that are attached to objects and are used to describe and manage different Kubernetes resources. If the labels do not follow Kubernetes label syntax requirements (see links below), they will not be applied properly.
7+
8+
:::tip
9+
10+
## FYI
11+
12+
Labels' keys and values are case-sensitive!
13+
:::
14+
15+
**Targeted resources by this rule (types of **`kind`**): **Deployment / Pod / DaemonSet / StatefulSet / ReplicaSet / CronJob / Job
16+
17+
**Enabled by default?** True
18+
19+
**Policy as code identifier:** WORKLOAD_INVALID_LABELS_VALUE
20+
21+
---
22+
23+
## This rule will fail
24+
25+
If one of the keys under `labels` contains an invalid value
26+
27+
```yaml
28+
metadata:
29+
labels:
30+
31+
```
32+
33+
### Rule output in the CLI
34+
35+
```none
36+
$ datree test *.yaml
37+
38+
>> File: failExample.yaml
39+
❌ Ensure workload has valid label values [1 occurrence]
40+
💡 Incorrect value for key(s) under `labels` - the vales syntax is not valid so the Kubernetes engine will not accept it
41+
```
42+
43+
---
44+
45+
## How to fix this failure
46+
47+
```yaml
48+
metadata:
49+
labels:
50+
on-call: yoda-at-datree.io
51+
```
52+
53+
---
54+
55+
## Read more
56+
57+
- [Kubernetes docs - labels syntax](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set)
58+
59+
- [A Kubernetes guide for labels](https://datree-io.webflow.io/resources/a-kubernetes-guide-for-labels-and-selectors#anchor10)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: ☑️ Ensure Deployment has more than one replica configured
3+
slug: /built-in-rules/ensure-minimum-two-replicas
4+
---
5+
6+
When you run two or more replicas per service, you are increasing the availability of the containerized service because you are not relying on a single pod to do all of the work. Furthermore, scaling horizontally by adding pods allows your service to scale and handle larger loads.
7+
8+
**Targeted resources by this rule (types of **`kind`**): **Deployment
9+
10+
**Enabled by default?** True
11+
12+
**Policy as code identifier:** DEPLOYMENT_INCORRECT_REPLICAS_VALUE
13+
14+
---
15+
16+
## This rule will fail
17+
18+
If the number of `replicas` is set to 1
19+
20+
```yaml
21+
kind: Deployment
22+
spec:
23+
replicas: 1
24+
```
25+
26+
### Rule output in the CLI
27+
28+
```none
29+
$ datree test *.yaml
30+
31+
>> File: failExample.yaml
32+
❌ Ensure Deployment has more than one replica configured [1 occurrence]
33+
💡 Incorrect value for key `replicas` - running 2 or more replicas will increase the availability of the service
34+
```
35+
36+
---
37+
38+
## How to fix this failure
39+
40+
Set numbers of `replicas` to be greater than 1
41+
42+
```yaml
43+
kind: Deployment
44+
spec:
45+
replicas: 2
46+
```
47+
48+
---
49+
50+
## Read more
51+
52+
- [Node management - replicas](https://cloudmark.github.io/Node-Management-In-GKE/#replicas)

0 commit comments

Comments
 (0)