Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for top level configuration #79

Merged
merged 24 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/go/internal/spec/statik.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
group:
field1: {{var1}}
field2: {{var2}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It would be nice to put a real content in at least one file, so this template.yml.hbs won't be so mysterious.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jalvz Can you open a PR with this? Because it is exactly what I'm looking for to have an example.

@mtojek These test packages are great. Example and testing in one go.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, you could even put a short APM Example in here to make it more concrete.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruflin I added 7673874, is not that what you were looking for?
I don't think I can use this file as a real hbs example because it is referenced in the test (correct me if Im wrong)

Also didn't want to add an APM-like config because this can be anything, it has exactly the same structure as the stream templates.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. I missed that you added two template files. The part I stumble over is that you used group. This is just an example I assume. It can all be on the top level like foo: bar?

If we could use apm example here, @mtojek will know best. My preference is always to have a real example if possible.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: nothing
type: keyword
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
title: nothing, really
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
format_version: 1.0.4
name: integration
title: integration
description: integration, really
version: 0.1.2
release: beta
conditions:
kibana.version: '^7.9.0'
policy_templates:
- name: apm
title: APM
description: APM stuff
inputs:
- type: apm
title: Collect traces
description: Collect traces
template_path: ./agent/input/template.yml.hbs
owner:
github: elastic/foobar
1 change: 1 addition & 0 deletions code/go/pkg/validator/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func TestValidateFile(t *testing.T) {
"document dashes are required (start the document with '---')",
},
},
"input_template": {},
}

for pkgName, test := range tests {
Expand Down
13 changes: 13 additions & 0 deletions versions/1/agent/spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
spec:
additionalContents: false
contents:
- description: Folder containing input definitions
type: folder
name: input
required: true
additionalContents: false
contents:
- description: Config template file for inputs defined in the policy_templates section of the top level manifest
type: file
pattern: '^.+.yml.hbs$'
required: true
5 changes: 4 additions & 1 deletion versions/1/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
link: https://github.com/elastic/package-spec/pull/73
- description: Adding "traces" as a valid data stream type.
type: enhancement
link: https://github.com/elastic/package-spec/pull/78
link: https://github.com/elastic/package-spec/pull/78
- description: Add "agent/input" folder for top level configuration.
type: enhancement
link: https://github.com/elastic/package-spec/pull/79
5 changes: 5 additions & 0 deletions versions/1/manifest.spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ spec:
type: string
examples:
- Collecting Apache access and error logs
template_path:
description: Path of the config template for the input.
type: string
examples:
- ./agent/input/template.yml.hbs
vars:
$ref: "./data_stream/manifest.spec.yml#/definitions/vars"
required:
Expand Down
5 changes: 5 additions & 0 deletions versions/1/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ spec:
type: folder
name: docs
required: true
- description: Folder containing agent-related definitions
type: folder
name: agent
required: false
$ref: "./agent/spec.yml"
- description: Folder containing Kibana assets used by the package
type: folder
name: kibana
Expand Down