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

[Fleet] revert package policy validation that caused issue with input groups #125657

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

juliaElastic
Copy link
Contributor

@juliaElastic juliaElastic commented Feb 15, 2022

Summary

Partially revert #124215 to unblock #125625

Improvement of validation is raised here #125655

To summarize:
Aws package policy generated by elastic-package is rejected with validation errors, however it should be accepted.
The reason is that policy vars present in package definition global vars, are listed under inputs/streams.
This should be accepted according to this: #125625 (comment)

Example package policy that should be valid, see below.

To verify, run this with a valid agent policy id in policy_id, and verify that it is successfully created.

POST /api/fleet/package_policies
{
  "name": "aws-ec2_metrics",
  "description": "",
  "namespace": "ep",
  "policy_id": "ad5e3840-8e4a-11ec-8b0a-59f6cbd7b323",
  "enabled": true,
  "output_id": "",
  "inputs": [
    {
      "type": "aws/metrics",
      "enabled": true,
      "streams": [
        {
          "id": "aws/metrics-aws.ec2_metrics",
          "enabled": true,
          "data_stream": {
            "type": "metrics",
            "dataset": "aws.ec2_metrics"
          },
          "vars": {
            "latency": {
              "value": "10m",
              "type": "text"
            },
            "period": {
              "value": "5m",
              "type": "text"
            },
            "regions": {
              "value": null,
              "type": "text"
            },
            "tags_filter": {
              "value": "- key: Name\n  value: \"elastic-package-test-33138\"",
              "type": "yaml"
            }
          }
        }
      ],
      "vars": {
         "access_key_id": {
           "value": "access_key_id",
           "type": "text"
         },
         "credential_profile_name": {
           "value": "credential_profile_name",
           "type": "text"
         },
         "endpoint": {
           "value": "amazonaws.com",
           "type": "text"
         },
         "proxy_url": {
           "value": "proxy_url",
           "type": "text"
         },
         "role_arn": {
           "value": "role_arn",
           "type": "text"
         },
         "secret_access_key": {
           "value": "secret_access_key",
           "type": "text"
         },
         "session_token": {
           "value": "session_token",
           "type": "text"
         },
         "shared_credential_file": {
           "value": "shared_credential_file",
           "type": "text"
         }
       }
    }
  ],
  "package": {
    "name": "aws",
    "title": "AWS",
    "version": "1.11.4"
  }
}


@juliaElastic juliaElastic added release_note:skip Skip the PR/issue when compiling release notes auto-backport Deprecated - use backport:version if exact versions are needed v8.1.0 v8.2.0 v8.0.1 v7.17.1 labels Feb 15, 2022
@juliaElastic juliaElastic requested a review from a team as a code owner February 15, 2022 13:29
@juliaElastic juliaElastic self-assigned this Feb 15, 2022
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Feb 15, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

Copy link
Contributor

@criamico criamico left a comment

Choose a reason for hiding this comment

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

LGTM

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
fleet 109.9KB 109.8KB -106.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
fleet 40 41 +1

Total ESLint disabled count

id before after diff
fleet 48 49 +1

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @juliaElastic

@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.1
8.0
7.17 Backport failed because of merge conflicts

You might need to backport the following PRs to 7.17:
- [Fleet] fixed undefined error when missing policy vars in template (#124215)

How to fix

Re-run the backport manually:

node scripts/backport --pr 125657

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

@juliaElastic juliaElastic deleted the revert-validation-change branch February 15, 2022 16:12
kibanamachine added a commit that referenced this pull request Feb 15, 2022
…125657) (#125679)

(cherry picked from commit 35f4ba5)

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Feb 15, 2022
…125657) (#125678)

(cherry picked from commit 35f4ba5)

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
kpollich pushed a commit to kpollich/kibana that referenced this pull request Jul 13, 2022
…lastic#125657)

(cherry picked from commit 35f4ba5)

# Conflicts:
#	x-pack/plugins/fleet/common/services/validate_package_policy.test.ts
kpollich added a commit that referenced this pull request Jul 14, 2022
…groups (#125657) (#136338)

* revert package policy validation that caused issue with input groups (#125657)

(cherry picked from commit 35f4ba5)

# Conflicts:
#	x-pack/plugins/fleet/common/services/validate_package_policy.test.ts

* Skip test

Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.17.1 v8.0.1 v8.1.0 v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants