Skip to content

Commit 1cc8491

Browse files
committed
Apply suggestions from Wil
Signed-off-by: Jose Fuentes <[email protected]>
1 parent 81d8b12 commit 1cc8491

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

docs/how_to_write_packages.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ Preflight packages are made of two well distinguished parts, the _policy manifes
1010

1111
## Writing the _policy manifest_
1212

13-
The _policy manifest_ is a _YAML_ file that contains all the metadata about your policy. You can see [here](https://godoc.org/github.com/jetstack/preflight/pkg/packaging#policy manifest) the schema os this file.
13+
The _policy manifest_ is a _YAML_ file that contains information about your policy. You can see [here](https://godoc.org/github.com/jetstack/preflight/pkg/packaging#policy manifest) the schema of this file.
1414

15-
There is some general information about the package, as the name or the description.
15+
There is some metadata for the package, such as the name and the description.
1616

17-
The rules of your policy must be also declared here. They are organized in sections. Every section can have a name, a description and a list of rules.
17+
The rules of your policy must also be declared here. They are organized in sections. Every section can have a name, a description, and a list of rules.
1818

19-
Every rule has its own name, description, useful links and mitiation instructions. There is a dedicated section about how to add rules.
19+
Every rule has its own name, description, useful links, and remediation instructions. This guide has a dedicated section about how to add rules.
2020

2121
### Choose your _data-gatherers_
2222

2323
Preflight evaluates the policies against data that it fetches from different sources. These sources are the _data-gatherers_. You can see [here](./datagatherers) a list of the available _data-gatherers_ and their documentation. In the future, Preflight will support sourcing data from external _data-gatherers_ (#24).
2424

25-
The _policy manifest_ is the place where to declare which _data-gatherers_ does your package expect.
25+
The _data-gatherers_ your package requires should be declared in the _policy manifest_.
2626

2727
```yaml
2828
schema-version: "1.0.0"
@@ -37,7 +37,7 @@ data-gatherers:
3737

3838
### Versioning
3939

40-
Preflight packages are intented to evolve. Policies can be changed, new rules can be added or deleted, and all the metadata can mutate.
40+
Preflight packages are intended to evolve. Policies can be changed, new rules can be added or deleted, and all the metadata can mutate.
4141

4242
In order to ease keeping track of those changes, Preflight packages have a version tag. That version is specified with the `package-version` property in the _policy manifest_.
4343

@@ -51,11 +51,11 @@ Then create the `policy-manifest.yaml` file. The following fields are mandatory:
5151

5252
- `schema-version`: indicates which schema is being used for the _policy manifest_. For the moment, there is only version `1.0.0`.
5353

54-
- `namespace`, `id` and `package-version`: these properties identify the package. `namespace` must be a FQDN and it is encouraged that `package-version` uses semver.
54+
- `namespace`, `id`, and `package-version`: these properties identify the package. `namespace` must be a FQDN and it is encouraged that `package-version` uses semver.
5555

5656
Then, you should also declare the _data-gatherers_ that your rules are going to need. For this example, let's just use `k8s/pods`.
5757

58-
Finally, it's time to declare the rules for the policy. Rules are organized into sections. Every section has an ID, a name and a description. Also, every rule has its own ID, name and description. Additionally, rules can have additional metadata like a remediation or a set of related links.
58+
Finally, it's time to declare the rules for the policy. Rules are organized into sections. Every section has an ID, a name, and a description. Also, every rule has its own ID, name, and description. Additionally, rules can have other metadata like a remediation advice or a set of related links.
5959

6060
For simplicity's sake, this example contains just one section with one rule.
6161

@@ -92,9 +92,9 @@ In the previous section, we created the _policy manifest_, which contains a huma
9292

9393
Preflight relies on Open Policy Agent as the policy engine. REGO is OPA's language to define policies. You can find a comprenhensive [documentation](https://www.openpolicyagent.org/docs/latest/policy-language/).
9494

95-
You can have multiple REGO files inside the directory of a Preflight package. One important think to take into consideration is that all the final definition of the rules must be in the same REGO package, and that package must be indicated in the _policy manifest_ using the `root-query` property.
95+
You can have multiple REGO files inside the directory of a Preflight package. All the REGO rules corresponding to the _policy manifest_ rules must be in the same REGO package, and that package must be indicated in the _policy manifest_ using the `root-query` property.
9696

97-
For instance, these snippet shows an arbitrary REGO rule in a package named `podsbestpractices`:
97+
For instance, this snippet shows an arbitrary REGO rule in a package named `podsbestpractices`:
9898

9999
```
100100
package pods
@@ -110,9 +110,9 @@ As you can identify, the REGO package for that policy is `pods`. In this case, O
110110

111111
### Writing REGO rules
112112

113-
REGO can be challenging at the beginning because it does not behaves like a traditional programming language. It is strongly recommended to read ["The Basics"](https://www.openpolicyagent.org/docs/latest/policy-language/#the-basics). Also, it is useful to have the language refence](https://www.openpolicyagent.org/docs/latest/policy-reference/) at a hand.
113+
REGO can be challenging at the beginning because it does not behaves like a traditional programming language. It is strongly recommended to read ["The Basics"](https://www.openpolicyagent.org/docs/latest/policy-language/#the-basics). Also, it is useful to have the [language refence](https://www.openpolicyagent.org/docs/latest/policy-reference/) at hand.
114114

115-
You will get faster as you write more rules. In order to speed up this process, it usually works to write tests for your rules, even if you think it is not needed. It is just the best way of iterating fast while writing rules and making sure the rules are doing what you tried to write with REGO. It is a convention to name the test files for `policy.rego` as `policy_test.rego_`.
115+
You will get faster as you write more REGO rules. In order to speed up this process, it's best to write tests for your rules, even if you think they are not needed. It means you can iterate fast while writing rules and make sure the rules are doing what you intended. It is conventional to name the test files for `policy.rego` as `policy_test.rego`.
116116

117117

118118
This example contains the definition for the `tag_no_latest` rule. As you can see, there is the convention within Preflight to add `preflight_` as prefix to the rule ID when that is written in REGO (related issue #27).
@@ -232,10 +232,10 @@ opa test ./preflight-packages/examples.jetstack.io/podsbestpractices
232232

233233
The Preflight command line has a built-in linter. This helps to make sure that the package follows the best practices.
234234

235-
You can link your package by running:
235+
You can lint your package by running:
236236

237237
```
238-
preflight package link ./preflight-packages/examples.jetstack.io/podsbestpractices
238+
preflight package lint ./preflight-packages/examples.jetstack.io/podsbestpractices
239239
```
240240

241241
## Configure Preflight to use your package

0 commit comments

Comments
 (0)