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] Hide many actions for hosted agent policies #96160

Merged
merged 10 commits into from
Apr 6, 2021

Conversation

jfsiii
Copy link
Contributor

@jfsiii jfsiii commented Apr 2, 2021

Summary

Fixes items 2a, 4a, 5c2, and 6 from #91906

2a - On the agents table, remove all actions except for "View agent"

code commit

Screen Shot 2021-04-02 at 2 00 34 PM

Screen Shot 2021-04-02 at 2 00 41 PM

4a & 5c2 On the agent policy list page, remove the "add agent" & "copy policy" actions which appears in the [...] actions menu

code commit
Screen Shot 2021-04-02 at 2 36 57 PM
Screen Shot 2021-04-02 at 2 37 02 PM

6 - Do not show the the "revoke token" trash icon

code commit
Screen Shot 2021-04-02 at 2 15 54 PM

@jfsiii jfsiii added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.13.0 labels Apr 2, 2021
@jfsiii jfsiii self-assigned this Apr 2, 2021
@jfsiii jfsiii requested a review from a team as a code owner April 2, 2021 19:29
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@jfsiii jfsiii requested a review from hbharding April 2, 2021 19:29
Copy link
Contributor

@hbharding hbharding left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @jfsiii appreciate the screenshots!

@jfsiii
Copy link
Contributor Author

jfsiii commented Apr 5, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💛 Build succeeded, but was flaky


Test Failures

Kibana Pipeline / general / Chrome UI Functional Tests.test/functional/apps/discover/_huge_fields·ts.discover app test large number of fields in sidebar "before all" hook for "test_huge data should have expected number of fields"

Link to Jenkins

Standard Out

Failed Tests Reporter:
  - Test has failed 4 times on tracked branches: https://github.com/elastic/kibana/issues/96113

[00:00:00]       │
[00:07:49]         └-: discover app
[00:07:49]           └-> "before all" hook in "discover app"
[00:07:49]           └-> "before all" hook in "discover app"
[00:28:12]           └-: test large number of fields in sidebar
[00:28:12]             └-> "before all" hook for "test_huge data should have expected number of fields"
[00:28:12]             └-> "before all" hook for "test_huge data should have expected number of fields"
[00:28:12]               │ info [large_fields] Loading "mappings.json"
[00:28:12]               │ info [large_fields] Loading "data.json.gz"
[00:28:12]               │ info [o.e.c.m.MetadataCreateIndexService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1617623483540513840] [testhuge] creating index, cause [api], templates [], shards [5]/[1]
[00:28:12]               │ info [large_fields] Created index "testhuge"
[00:28:12]               │ debg [large_fields] "testhuge" settings {"index":{"mapping":{"total_fields":{"limit":"50000"}},"number_of_replicas":"1","number_of_shards":"5"}}
[00:28:12]               │ info [o.e.c.m.MetadataMappingService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1617623483540513840] [testhuge/AywFaySrTvCYGdPUEt01-Q] update_mapping [_doc]
[00:28:13]               │ info [large_fields] Indexed 1 docs into "testhuge"
[00:28:13]               │ info [o.e.i.b.HierarchyCircuitBreakerService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1617623483540513840] attempting to trigger G1GC due to high heap usage [1026130752]
[00:28:13]               │ info [o.e.i.b.HierarchyCircuitBreakerService] [kibana-ci-immutable-ubuntu-18-tests-xxl-1617623483540513840] GC did not bring memory usage down, before [1026130752], after [1037086928], allocations [9], duration [16]
[00:28:13]               │ info Taking screenshot "/dev/shm/workspace/parallel/5/kibana/test/functional/screenshots/failure/discover app test large number of fields in sidebar _before all_ hook for _test_huge data should have expected number of fields_.png"
[00:28:13]               │ info Current URL is: http://localhost:6151/app/discover#/view/cd43f5c2-h761-13f6-9486-733b1ac9221a?_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:%272021-01-20T00:00:00.000Z%27,to:%272021-01-25T00:00:00.000Z%27))&_a=(columns:!(),filters:!(),index:test-index-unmapped-fields,interval:auto,query:(language:lucene,query:(query_string:(analyze_wildcard:!t,query:%27*%27))),sort:!(!(timestamp,desc)))
[00:28:13]               │ info Saving page source to: /dev/shm/workspace/parallel/5/kibana/test/functional/failure_debug/html/discover app test large number of fields in sidebar _before all_ hook for _test_huge data should have expected number of fields_.html
[00:28:13]               └- ✖ fail: discover app test large number of fields in sidebar "before all" hook for "test_huge data should have expected number of fields"
[00:28:13]               │      ResponseError: circuit_breaking_exception
[00:28:13]               │       at onBody (node_modules/@elastic/elasticsearch/lib/Transport.js:337:23)
[00:28:13]               │       at IncomingMessage.onEnd (node_modules/@elastic/elasticsearch/lib/Transport.js:264:11)
[00:28:13]               │       at endReadableNT (internal/streams/readable.js:1327:12)
[00:28:13]               │       at processTicksAndRejections (internal/process/task_queues.js:80:21)
[00:28:13]               │ 
[00:28:13]               │ 

Stack Trace

ResponseError: circuit_breaking_exception
    at onBody (node_modules/@elastic/elasticsearch/lib/Transport.js:337:23)
    at IncomingMessage.onEnd (node_modules/@elastic/elasticsearch/lib/Transport.js:264:11)
    at endReadableNT (internal/streams/readable.js:1327:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  meta: {
    body: { error: [Object], status: 429 },
    statusCode: 429,
    headers: {
      'content-type': 'application/json;charset=utf-8',
      'content-length': '921'
    },
    meta: {
      context: null,
      request: [Object],
      name: 'elasticsearch-js',
      connection: [Object],
      attempts: 0,
      aborted: false
    }
  }
}

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
fleet 707.7KB 710.0KB +2.2KB

History

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

cc @jfsiii

@jfsiii jfsiii added the auto-backport Deprecated - use backport:version if exact versions are needed label Apr 5, 2021
const isAgentSelectable = (agent: Agent) => {
if (!agent.active) return false;

const agentPolicy = agentPolicies.find((p) => p.id === agent.policy_id);
Copy link
Member

Choose a reason for hiding this comment

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

I am wondering if we should index policy per id at some point we are going to loop a lot of time over this policy list

Copy link
Member

Choose a reason for hiding this comment

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

actually looks like we do agentPoliciesIndexedById

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good eyes. Thanks! This replaced a few instances of .find with byId but looks likes it missed one (some?). I'll review and fix as a part of the next PR in this series.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 18fca79

Copy link
Member

@nchaulet nchaulet left a comment

Choose a reason for hiding this comment

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

a small comment but nothing blocking 🚀

@jfsiii jfsiii merged commit 2adc060 into elastic:master Apr 6, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Apr 6, 2021
## Summary

Fixes items 2a, 4a, 5c2, and 6 from elastic#91906

### 2a - On the agents table, remove all actions except for "View agent"

[code commit](elastic@a93dd8c) 

<img width="1090" alt="Screen Shot 2021-04-02 at 2 00 34 PM" src="https://user-images.githubusercontent.com/57655/113446102-1b40bd00-93c5-11eb-804b-2afec37a176b.png">
<img width="1100" alt="Screen Shot 2021-04-02 at 2 00 41 PM" src="https://user-images.githubusercontent.com/57655/113446103-1b40bd00-93c5-11eb-8aba-daa1aa539955.png">

### 4a & 5c2 On the agent policy list page, remove the "add agent" & "copy policy" actions which appears in the [...] actions menu
[code commit](elastic@f0c267f)
<img width="1067" alt="Screen Shot 2021-04-02 at 2 36 57 PM" src="https://user-images.githubusercontent.com/57655/113446281-7b376380-93c5-11eb-9f82-03e957e6656c.png">
<img width="1104" alt="Screen Shot 2021-04-02 at 2 37 02 PM" src="https://user-images.githubusercontent.com/57655/113446282-7bcffa00-93c5-11eb-942c-1a98ebbab385.png">


### 6 - Do not show the the "revoke token" trash icon

[code commit](elastic@cd05cd0)
<img width="1088" alt="Screen Shot 2021-04-02 at 2 15 54 PM" src="https://user-images.githubusercontent.com/57655/113446176-4a572e80-93c5-11eb-9740-9723c1cb9f50.png">

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

7.x / #96320

This backport PR will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Apr 6, 2021
## Summary

Fixes items 2a, 4a, 5c2, and 6 from #91906

### 2a - On the agents table, remove all actions except for "View agent"

[code commit](a93dd8c) 

<img width="1090" alt="Screen Shot 2021-04-02 at 2 00 34 PM" src="https://user-images.githubusercontent.com/57655/113446102-1b40bd00-93c5-11eb-804b-2afec37a176b.png">
<img width="1100" alt="Screen Shot 2021-04-02 at 2 00 41 PM" src="https://user-images.githubusercontent.com/57655/113446103-1b40bd00-93c5-11eb-8aba-daa1aa539955.png">

### 4a & 5c2 On the agent policy list page, remove the "add agent" & "copy policy" actions which appears in the [...] actions menu
[code commit](f0c267f)
<img width="1067" alt="Screen Shot 2021-04-02 at 2 36 57 PM" src="https://user-images.githubusercontent.com/57655/113446281-7b376380-93c5-11eb-9f82-03e957e6656c.png">
<img width="1104" alt="Screen Shot 2021-04-02 at 2 37 02 PM" src="https://user-images.githubusercontent.com/57655/113446282-7bcffa00-93c5-11eb-942c-1a98ebbab385.png">


### 6 - Do not show the the "revoke token" trash icon

[code commit](cd05cd0)
<img width="1088" alt="Screen Shot 2021-04-02 at 2 15 54 PM" src="https://user-images.githubusercontent.com/57655/113446176-4a572e80-93c5-11eb-9740-9723c1cb9f50.png">

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: John Schulz <john.schulz@elastic.co>
@jfsiii jfsiii deleted the managed-policy-hide-restricted-actions branch April 6, 2021 17:09
@dikshachauhan-qasource
Copy link

Hi @EricDavisX

We have validated above merges on latest 8.0 snapshot environment and found them working fine.

After converting a user created policy under which agent was installed to Managed policy using API, we have observed following changes working fine.

  1. Actions menu working fine on Agent List page.
  2. Actions menu working fine on Policy List page.
  3. Actions menu working fine on Policy detail page.
  4. Trash icon not present for managed policies on enrollment token page.

Build details:

BUILD 41814
COMMIT f1d662932133c49f3c2efe334b60201eeaa20a7d

Thanks
QAS

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.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants