Compare commits

...

3 Commits

Author SHA1 Message Date
deviantony
62ee03924d feat(podman): showcase alternative way of fetching processes 2022-05-25 22:06:29 +00:00
deviantony
31fbceaaf7 Merge branch 'develop' into podman-2022 2022-05-23 19:29:59 +00:00
deviantony
cb87d95262 feat(podman): add sample stats API response 2022-05-23 01:37:10 +00:00
5 changed files with 315 additions and 4 deletions

View File

@@ -85,8 +85,17 @@ func (transport *Transport) RoundTrip(request *http.Request) (*http.Response, er
// ProxyDockerRequest intercepts a Docker API request and apply logic based
// on the requested operation.
func (transport *Transport) ProxyDockerRequest(request *http.Request) (*http.Response, error) {
requestPath := apiVersionRe.ReplaceAllString(request.URL.Path, "")
request.URL.Path = requestPath
requestPath := request.URL.Path
token := request.Header.Get("X-Podman-API")
if token == "" {
// we're not dealing with a Podman API request - this is a Docker API request
// therefore we can keep the old behavior of stripping any version number from the URL path
// TODO: REVIEW
// I'm not sure whether this should be kept or not but for now it will keep the usual behavior without introducing potential breaking changes
requestPath := apiVersionRe.ReplaceAllString(request.URL.Path, "")
request.URL.Path = requestPath
}
if transport.endpoint.Type == portainer.AgentOnDockerEnvironment || transport.endpoint.Type == portainer.EdgeAgentOnDockerEnvironment {
signature, err := transport.signatureService.CreateSignature(portainer.PortainerAgentSignatureMessage)

View File

@@ -0,0 +1,22 @@
angular.module('portainer.docker').factory('PodmanContainer', [
'$resource',
'API_ENDPOINT_ENDPOINTS',
'EndpointProvider',
function PodmanContainerFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
'use strict';
return $resource(
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/v4.0.2/libpod/containers/:id/:action',
{
endpointId: EndpointProvider.endpointID,
},
{
top: {
method: 'GET',
params: { id: '@id', action: 'top' },
ignoreLoadingBar: true,
headers: { 'X-Podman-API': '1' },
},
}
);
},
]);

View File

@@ -14,7 +14,7 @@ import { ContainerDetailsViewModel, ContainerStatsViewModel, ContainerViewModel
angular.module('portainer.docker').factory('ContainerService', ContainerServiceFactory);
/* @ngInject */
function ContainerServiceFactory($q, Container, LogHelper, $timeout, EndpointProvider) {
function ContainerServiceFactory($q, Container, PodmanContainer, LogHelper, $timeout, EndpointProvider) {
const service = {
killContainer: withEndpointId(killContainer),
pauseContainer: withEndpointId(pauseContainer),
@@ -185,7 +185,7 @@ function ContainerServiceFactory($q, Container, LogHelper, $timeout, EndpointPro
};
service.containerTop = function (id) {
return Container.top({ id: id }).$promise;
return PodmanContainer.top({ id: id }).$promise;
};
service.inspect = function (id) {

View File

@@ -0,0 +1,176 @@
{
"read": "2022-05-22T21:48:08.399402957Z",
"preread": "2022-05-22T21:48:07.375507846Z",
"pids_stats": {
"current": 4
},
"blkio_stats": {
"io_service_bytes_recursive": [
{
"major": 252,
"minor": 0,
"op": "Read",
"value": 18489344
},
{
"major": 252,
"minor": 0,
"op": "Write",
"value": 851968
},
{
"major": 252,
"minor": 0,
"op": "Sync",
"value": 19341312
},
{
"major": 252,
"minor": 0,
"op": "Async",
"value": 0
},
{
"major": 252,
"minor": 0,
"op": "Discard",
"value": 0
},
{
"major": 252,
"minor": 0,
"op": "Total",
"value": 19341312
}
],
"io_serviced_recursive": [
{
"major": 252,
"minor": 0,
"op": "Read",
"value": 233
},
{
"major": 252,
"minor": 0,
"op": "Write",
"value": 45
},
{
"major": 252,
"minor": 0,
"op": "Sync",
"value": 278
},
{
"major": 252,
"minor": 0,
"op": "Async",
"value": 0
},
{
"major": 252,
"minor": 0,
"op": "Discard",
"value": 0
},
{
"major": 252,
"minor": 0,
"op": "Total",
"value": 278
}
],
"io_queue_recursive": [],
"io_service_time_recursive": [],
"io_wait_time_recursive": [],
"io_merged_recursive": [],
"io_time_recursive": [],
"sectors_recursive": []
},
"num_procs": 0,
"storage_stats": {},
"cpu_stats": {
"cpu_usage": {
"total_usage": 28453797088,
"percpu_usage": [28453797088],
"usage_in_kernelmode": 1160000000,
"usage_in_usermode": 1820000000
},
"system_cpu_usage": 354365630000000,
"online_cpus": 1,
"throttling_data": {
"periods": 0,
"throttled_periods": 0,
"throttled_time": 0
}
},
"precpu_stats": {
"cpu_usage": {
"total_usage": 28453389806,
"percpu_usage": [28453389806],
"usage_in_kernelmode": 1160000000,
"usage_in_usermode": 1820000000
},
"system_cpu_usage": 354364640000000,
"online_cpus": 1,
"throttling_data": {
"periods": 0,
"throttled_periods": 0,
"throttled_time": 0
}
},
"memory_stats": {
"usage": 14176256,
"max_usage": 27635712,
"stats": {
"active_anon": 5677056,
"active_file": 3854336,
"cache": 7593984,
"dirty": 0,
"hierarchical_memory_limit": 9223372036854772000,
"hierarchical_memsw_limit": 0,
"inactive_anon": 0,
"inactive_file": 3739648,
"mapped_file": 7163904,
"pgfault": 7095,
"pgmajfault": 132,
"pgpgin": 10428,
"pgpgout": 7167,
"rss": 5763072,
"rss_huge": 0,
"total_active_anon": 5677056,
"total_active_file": 3854336,
"total_cache": 7593984,
"total_dirty": 0,
"total_inactive_anon": 0,
"total_inactive_file": 3739648,
"total_mapped_file": 7163904,
"total_pgfault": 7095,
"total_pgmajfault": 132,
"total_pgpgin": 10428,
"total_pgpgout": 7167,
"total_rss": 5763072,
"total_rss_huge": 0,
"total_unevictable": 0,
"total_writeback": 0,
"unevictable": 0,
"writeback": 0
},
"limit": 1024348160
},
"name": "/anthony-sandboxportainerio-registry-1",
"id": "e62c2d8aab615216b6c9ae7b8e1551c38432684aff46aa008188c8af26fe6fc0",
"networks": {
"eth0": {
"rx_bytes": 852665,
"rx_packets": 353,
"rx_errors": 0,
"rx_dropped": 0,
"tx_bytes": 35249,
"tx_packets": 180,
"tx_errors": 0,
"tx_dropped": 0
}
}
}

View File

@@ -0,0 +1,104 @@
{
"read": "2022-05-22T21:46:37.52076633Z",
"preread": "0001-01-01T00:00:00Z",
"pids_stats": {
"current": 5
},
"blkio_stats": {
"io_service_bytes_recursive": [
{
"major": 0,
"minor": 252,
"op": "Read",
"value": 13041664
},
{
"major": 0,
"minor": 252,
"op": "Write",
"value": 18432
},
{
"major": 0,
"minor": 252,
"op": "Sync",
"value": 13060096
},
{
"major": 0,
"minor": 252,
"op": "Async",
"value": 0
},
{
"major": 0,
"minor": 252,
"op": "Discard",
"value": 0
},
{
"major": 0,
"minor": 252,
"op": "Total",
"value": 13060096
}
],
"io_serviced_recursive": null,
"io_queue_recursive": null,
"io_service_time_recursive": null,
"io_wait_time_recursive": null,
"io_merged_recursive": null,
"io_time_recursive": null,
"sectors_recursive": null
},
"num_procs": 0,
"storage_stats": {},
"cpu_stats": {
"cpu_usage": {
"total_usage": 5995172328,
"percpu_usage": [5995172328],
"usage_in_kernelmode": 626098415,
"usage_in_usermode": 5369073913
},
"system_cpu_usage": 6528044804688,
"online_cpus": 1,
"cpu": 0,
"throttling_data": {
"periods": 0,
"throttled_periods": 0,
"throttled_time": 0
}
},
"precpu_stats": {
"cpu_usage": {
"total_usage": 0,
"usage_in_kernelmode": 0,
"usage_in_usermode": 0
},
"cpu": 0,
"throttling_data": {
"periods": 0,
"throttled_periods": 0,
"throttled_time": 0
}
},
"memory_stats": {
"usage": 3829760,
"max_usage": 9223372036854771712,
"limit": 9223372036854771712
},
"name": "web2",
"Id": "79ea1ec9721412739bfc7ca4033b063f45e72ef6a63a782ceb456ee42325e9e2",
"networks": {
"network": {
"rx_bytes": 22172,
"rx_packets": 0,
"rx_errors": 0,
"rx_dropped": 0,
"tx_bytes": 122920,
"tx_packets": 0,
"tx_errors": 0,
"tx_dropped": 0
}
}
}