From 52f9320952367f590c833a99863311e156f4e14c Mon Sep 17 00:00:00 2001 From: zees-dev <63374656+zees-dev@users.noreply.github.com> Date: Wed, 15 Sep 2021 17:54:44 +1200 Subject: [PATCH 01/25] fix webpack dev server (#5630) --- webpack/webpack.common.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webpack/webpack.common.js b/webpack/webpack.common.js index 3f5ef7106..f92df4043 100644 --- a/webpack/webpack.common.js +++ b/webpack/webpack.common.js @@ -70,7 +70,7 @@ module.exports = { compress: true, port: 8999, proxy: { - '/api': 'https://localhost:9443', + '/api': 'http://localhost:9000', }, open: true, writeToDisk: true, From 5d8c23e3a6eae7595b4a42cf9e69f305bf3ce00a Mon Sep 17 00:00:00 2001 From: zees-dev <63374656+zees-dev@users.noreply.github.com> Date: Thu, 16 Sep 2021 10:00:18 +1200 Subject: [PATCH 02/25] helm templates blog post link fix (#5625) --- .../components/helm/helm-templates/helm-templates.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/kubernetes/components/helm/helm-templates/helm-templates.html b/app/kubernetes/components/helm/helm-templates/helm-templates.html index 8ce43a579..1c1cda61f 100644 --- a/app/kubernetes/components/helm/helm-templates/helm-templates.html +++ b/app/kubernetes/components/helm/helm-templates/helm-templates.html @@ -11,7 +11,7 @@

- This is a first version for Helm charts, for more information see this blog post. + This is a first version for Helm charts, for more information see this blog post.

From a098e24cca9bdb19be28828132675edca98d832a Mon Sep 17 00:00:00 2001 From: zees-dev <63374656+zees-dev@users.noreply.github.com> Date: Thu, 16 Sep 2021 16:09:33 +1200 Subject: [PATCH 03/25] using new app metadata property to distinguish helm apps (#5624) --- app/kubernetes/converters/application.js | 1 + app/kubernetes/helpers/application/index.js | 39 +++++++++++++------ .../models/application/models/index.js | 1 + .../applications/applicationsController.js | 17 ++------ 4 files changed, 34 insertions(+), 24 deletions(-) diff --git a/app/kubernetes/converters/application.js b/app/kubernetes/converters/application.js index 0e0cd9dd5..d88feda09 100644 --- a/app/kubernetes/converters/application.js +++ b/app/kubernetes/converters/application.js @@ -56,6 +56,7 @@ class KubernetesApplicationConverter { const containers = data.spec.template ? _.without(_.concat(data.spec.template.spec.containers, data.spec.template.spec.initContainers), undefined) : data.spec.containers; res.Id = data.metadata.uid; res.Name = data.metadata.name; + res.Metadata = data.metadata; if (data.metadata.labels) { const { labels } = data.metadata; diff --git a/app/kubernetes/helpers/application/index.js b/app/kubernetes/helpers/application/index.js index d34529841..82fcd09ee 100644 --- a/app/kubernetes/helpers/application/index.js +++ b/app/kubernetes/helpers/application/index.js @@ -449,8 +449,8 @@ class KubernetesApplicationHelper { // filter out all the applications that are managed by helm // to identify the helm managed applications, we need to check if the applications pod labels include // `app.kubernetes.io/instance` and `app.kubernetes.io/managed-by` = `helm` - const helmManagedApps = applications.filter((app) => - app.Pods.flatMap((pod) => pod.Labels).some((label) => label && label[PodKubernetesInstanceLabel] && label[PodManagedByLabel] === 'Helm') + const helmManagedApps = applications.filter( + (app) => app.Metadata.labels && app.Metadata.labels[PodKubernetesInstanceLabel] && app.Metadata.labels[PodManagedByLabel] === 'Helm' ); // groups the helm managed applications by helm release name @@ -467,15 +467,12 @@ class KubernetesApplicationHelper { const namespacedHelmReleases = {}; helmManagedApps.forEach((app) => { const namespace = app.ResourcePool; - const labels = app.Pods.filter((p) => p.Labels).map((p) => p.Labels[PodKubernetesInstanceLabel]); - const uniqueLabels = [...new Set(labels)]; - uniqueLabels.forEach((instanceStr) => { - if (namespacedHelmReleases[namespace]) { - namespacedHelmReleases[namespace][instanceStr] = [...(namespacedHelmReleases[namespace][instanceStr] || []), app]; - } else { - namespacedHelmReleases[namespace] = { [instanceStr]: [app] }; - } - }); + const instanceLabel = app.Metadata.labels[PodKubernetesInstanceLabel]; + if (namespacedHelmReleases[namespace]) { + namespacedHelmReleases[namespace][instanceLabel] = [...(namespacedHelmReleases[namespace][instanceLabel] || []), app]; + } else { + namespacedHelmReleases[namespace] = { [instanceLabel]: [app] }; + } }); // `helmAppsEntriesList` object structure: @@ -511,5 +508,25 @@ class KubernetesApplicationHelper { return helmAppsList; } + + /** + * Get nested applications - + * @param {KubernetesApplication[]} applications Application list + * @returns {Object} { helmApplications: [app1, app2, ...], nonHelmApplications: [app3, app4, ...] } + */ + static getNestedApplications(applications) { + const helmApplications = KubernetesApplicationHelper.getHelmApplications(applications); + + // filter out helm managed applications + const helmAppNames = [...new Set(helmApplications.map((hma) => hma.Name))]; // distinct helm app names + const nonHelmApplications = applications.filter((app) => { + if (app.Metadata.labels) { + return !helmAppNames.includes(app.Metadata.labels[PodKubernetesInstanceLabel]); + } + return true; + }); + + return { helmApplications, nonHelmApplications }; + } } export default KubernetesApplicationHelper; diff --git a/app/kubernetes/models/application/models/index.js b/app/kubernetes/models/application/models/index.js index dff8b9112..0f280399e 100644 --- a/app/kubernetes/models/application/models/index.js +++ b/app/kubernetes/models/application/models/index.js @@ -16,6 +16,7 @@ const _KubernetesApplication = Object.freeze({ CreationDate: 0, Pods: [], Containers: [], + Metadata: {}, Limits: {}, ServiceType: '', ServiceId: '', diff --git a/app/kubernetes/views/applications/applicationsController.js b/app/kubernetes/views/applications/applicationsController.js index 53be7360c..36f91fc4f 100644 --- a/app/kubernetes/views/applications/applicationsController.js +++ b/app/kubernetes/views/applications/applicationsController.js @@ -1,7 +1,7 @@ import angular from 'angular'; import _ from 'lodash-es'; import KubernetesStackHelper from 'Kubernetes/helpers/stackHelper'; -import KubernetesApplicationHelper, { PodKubernetesInstanceLabel } from 'Kubernetes/helpers/application'; +import KubernetesApplicationHelper from 'Kubernetes/helpers/application'; import KubernetesConfigurationHelper from 'Kubernetes/helpers/configurationHelper'; import { KubernetesApplicationTypes } from 'Kubernetes/models/application/models'; @@ -109,18 +109,9 @@ class KubernetesApplicationsController { try { const [applications, configurations] = await Promise.all([this.KubernetesApplicationService.get(), this.KubernetesConfigurationService.get()]); const configuredApplications = KubernetesConfigurationHelper.getApplicationConfigurations(applications, configurations); - const helmApplications = KubernetesApplicationHelper.getHelmApplications(configuredApplications); - - // filter out multi-chart helm managed applications - const helmAppNames = [...new Set(helmApplications.map((hma) => hma.Name))]; // distinct helm app names - const nonHelmApps = configuredApplications.filter( - (app) => - !app.Pods.flatMap((pod) => pod.Labels) // flatten pod labels - .filter((label) => label) // filter out empty labels - .some((label) => helmAppNames.includes(label[PodKubernetesInstanceLabel])) // check if label key is in helmAppNames - ); - - this.state.applications = [...nonHelmApps, ...helmApplications]; + const { helmApplications, nonHelmApplications } = KubernetesApplicationHelper.getNestedApplications(configuredApplications); + + this.state.applications = [...helmApplications, ...nonHelmApplications]; this.state.stacks = KubernetesStackHelper.stacksFromApplications(applications); this.state.ports = KubernetesApplicationHelper.portMappingsFromApplications(applications); } catch (err) { From 53a2205f06d4ab88d22603de9db01ae2a46fdbb7 Mon Sep 17 00:00:00 2001 From: zees-dev <63374656+zees-dev@users.noreply.github.com> Date: Fri, 17 Sep 2021 14:48:37 +1200 Subject: [PATCH 04/25] docker image pull toast fix (#5644) --- app/docker/views/images/edit/imageController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/docker/views/images/edit/imageController.js b/app/docker/views/images/edit/imageController.js index e13f2e8d1..9080924b7 100644 --- a/app/docker/views/images/edit/imageController.js +++ b/app/docker/views/images/edit/imageController.js @@ -104,7 +104,7 @@ angular.module('portainer.docker').controller('ImageController', [ try { const registryModel = await RegistryService.retrievePorRegistryModelFromRepository(repository, endpoint.Id); await ImageService.pullImage(registryModel); - Notifications.success('Image successfully pushed', repository); + Notifications.success('Image successfully pulled', repository); } catch (err) { Notifications.error('Failure', err, 'Unable to push image to repository'); } finally { From 9121e8e69cbbc55e924986f3fd6730924e4d4445 Mon Sep 17 00:00:00 2001 From: cong meng Date: Fri, 17 Sep 2021 17:22:21 +1200 Subject: [PATCH 05/25] fix(UI) EE-1657 Fix the agent version number in the UI (#5619) Co-authored-by: Simon Meng --- app/portainer/views/endpoints/edit/endpointController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/portainer/views/endpoints/edit/endpointController.js b/app/portainer/views/endpoints/edit/endpointController.js index f28cb28c9..0e173188c 100644 --- a/app/portainer/views/endpoints/edit/endpointController.js +++ b/app/portainer/views/endpoints/edit/endpointController.js @@ -283,7 +283,7 @@ docker run -d \\ -e CAP_HOST_MANAGEMENT=1 \\ -e EDGE_INSECURE_POLL=${allowSelfSignedCerts ? 1 : 0} \\ --name portainer_edge_agent \\ - portainer/agent:2.4.0`; + portainer/agent`; } function buildWindowsStandaloneCommand(edgeId, edgeKey, allowSelfSignedCerts) { From 689c2193c0428bd3441e06a8680b37dac19ba10f Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Fri, 17 Sep 2021 09:24:01 +0300 Subject: [PATCH 06/25] fix(customtemplate): edit custom template [EE-1691] (#5632) --- .../components/custom-templates-list/customTemplatesList.html | 2 +- .../custom-templates-view/customTemplatesView.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/portainer/components/custom-templates-list/customTemplatesList.html b/app/portainer/components/custom-templates-list/customTemplatesList.html index 73b96911f..6c0dcbac4 100644 --- a/app/portainer/components/custom-templates-list/customTemplatesList.html +++ b/app/portainer/components/custom-templates-list/customTemplatesList.html @@ -30,7 +30,7 @@ >
- + Edit diff --git a/app/portainer/views/custom-templates/custom-templates-view/customTemplatesView.html b/app/portainer/views/custom-templates/custom-templates-view/customTemplatesView.html index 648bfeca6..d8328cfd5 100644 --- a/app/portainer/views/custom-templates/custom-templates-view/customTemplatesView.html +++ b/app/portainer/views/custom-templates/custom-templates-view/customTemplatesView.html @@ -65,6 +65,7 @@ templates="$ctrl.templates" table-key="customTemplates" create-path="docker.templates.custom.new" + edit-path="docker.templates.custom.edit" is-edit-allowed="$ctrl.isEditAllowed" on-select-click="($ctrl.selectTemplate)" on-delete-click="($ctrl.confirmDelete)" From 414f2c8c60418245c7c61c07ddb47320e120b841 Mon Sep 17 00:00:00 2001 From: zees-dev <63374656+zees-dev@users.noreply.github.com> Date: Mon, 20 Sep 2021 01:42:39 +1200 Subject: [PATCH 07/25] fixed docker image pull text on error scenario (#5655) --- app/docker/views/images/edit/imageController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/docker/views/images/edit/imageController.js b/app/docker/views/images/edit/imageController.js index 9080924b7..e4ae295d6 100644 --- a/app/docker/views/images/edit/imageController.js +++ b/app/docker/views/images/edit/imageController.js @@ -106,7 +106,7 @@ angular.module('portainer.docker').controller('ImageController', [ await ImageService.pullImage(registryModel); Notifications.success('Image successfully pulled', repository); } catch (err) { - Notifications.error('Failure', err, 'Unable to push image to repository'); + Notifications.error('Failure', err, 'Unable to pull image from repository'); } finally { $('#downloadResourceHint').hide(); } From 16dc58a5f1e308cda58236942c06aff54f16cbd6 Mon Sep 17 00:00:00 2001 From: zees-dev <63374656+zees-dev@users.noreply.github.com> Date: Mon, 20 Sep 2021 11:08:24 +1200 Subject: [PATCH 08/25] fixed k8s app edit config dropdown default (#5647) --- app/kubernetes/views/applications/create/createApplication.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html index 149b90152..ef6916c59 100644 --- a/app/kubernetes/views/applications/create/createApplication.html +++ b/app/kubernetes/views/applications/create/createApplication.html @@ -294,7 +294,7 @@ From 50393519ba1ddd1a935c4186b1adebe998eb26c0 Mon Sep 17 00:00:00 2001 From: Richard Wei <54336863+WaysonWei@users.noreply.github.com> Date: Mon, 20 Sep 2021 12:14:59 +1200 Subject: [PATCH 09/25] fix(swagger): fix swagger api docs endpoint(s) rename to environment(s) EE-1661 (#5628) * fix swagger api docs endpoint(s) rename to environment(s) --- api/api-description.md | 16 +- api/bolt/edgejob/edgejob.go | 2 +- api/bolt/edgestack/edgestack.go | 2 +- api/bolt/endpoint/endpoint.go | 18 +-- api/bolt/endpointgroup/endpointgroup.go | 12 +- api/bolt/endpointrelation/endpointrelation.go | 8 +- api/bolt/extension/extension.go | 2 +- .../helmuserrepository/helmuserrepository.go | 2 +- api/bolt/internal/json.go | 2 +- api/bolt/registry/registry.go | 2 +- api/bolt/resourcecontrol/resourcecontrol.go | 2 +- api/bolt/role/role.go | 2 +- api/bolt/services.go | 2 +- api/bolt/settings/settings.go | 2 +- api/bolt/stack/stack.go | 2 +- api/bolt/tag/tag.go | 2 +- api/bolt/team/team.go | 2 +- api/bolt/teammembership/teammembership.go | 2 +- api/bolt/tunnelserver/tunnelserver.go | 2 +- api/bolt/user/user.go | 2 +- api/chisel/schedules.go | 2 +- api/chisel/tunnel.go | 10 +- api/crypto/ecdsa.go | 2 +- api/docker/client.go | 4 +- api/docker/snapshot.go | 4 +- api/exec/kubernetes_deploy.go | 4 +- api/filesystem/filesystem.go | 2 +- api/http/client/client.go | 2 +- api/http/errors/errors.go | 2 +- api/http/handler/auth/authenticate.go | 2 +- api/http/handler/customtemplates/handler.go | 4 +- api/http/handler/edgegroups/handler.go | 4 +- .../handler/edgestacks/edgestack_create.go | 10 +- .../edgestacks/edgestack_status_update.go | 2 +- .../handler/edgestacks/edgestack_update.go | 4 +- api/http/handler/edgestacks/endpoints.go | 2 +- api/http/handler/edgestacks/handler.go | 6 +- api/http/handler/edgetemplates/handler.go | 4 +- .../endpointedge/endpoint_edgejob_logs.go | 2 +- .../endpoint_edgestack_inspect.go | 4 +- api/http/handler/endpointedge/handler.go | 4 +- .../endpointgroups/endpointgroup_create.go | 16 +- .../endpointgroups/endpointgroup_delete.go | 4 +- .../endpointgroup_endpoint_add.go | 6 +- .../endpointgroup_endpoint_delete.go | 4 +- .../endpointgroups/endpointgroup_inspect.go | 6 +- .../endpointgroups/endpointgroup_list.go | 10 +- .../endpointgroups/endpointgroup_update.go | 12 +- api/http/handler/endpointgroups/handler.go | 4 +- .../endpoints/endpoint_association_delete.go | 8 +- api/http/handler/endpoints/endpoint_create.go | 20 +-- api/http/handler/endpoints/endpoint_delete.go | 8 +- .../handler/endpoints/endpoint_inspect.go | 8 +- api/http/handler/endpoints/endpoint_list.go | 18 +-- .../endpoints/endpoint_settings_update.go | 10 +- .../handler/endpoints/endpoint_snapshot.go | 8 +- .../handler/endpoints/endpoint_snapshots.go | 4 +- .../endpoints/endpoint_status_inspect.go | 18 +-- api/http/handler/endpoints/endpoint_update.go | 20 +-- api/http/handler/endpoints/handler.go | 4 +- api/http/handler/handler.go | 6 +- api/http/handler/helm/handler.go | 8 +- api/http/handler/helm/helm_delete.go | 6 +- api/http/handler/helm/helm_delete_test.go | 2 +- api/http/handler/helm/helm_install.go | 4 +- api/http/handler/helm/helm_install_test.go | 2 +- api/http/handler/helm/helm_list.go | 6 +- api/http/handler/helm/helm_list_test.go | 2 +- api/http/handler/helm/helm_show.go | 2 +- api/http/handler/helm/user_helm_repos.go | 2 +- api/http/handler/kubernetes/handler.go | 2 +- .../handler/kubernetes/kubernetes_config.go | 4 +- .../kubernetes/kubernetes_nodes_limits.go | 4 +- .../kubernetes/namespaces_toggle_system.go | 6 +- api/http/handler/settings/settings_update.go | 2 +- .../handler/stacks/create_compose_stack.go | 4 +- api/http/handler/stacks/create_swarm_stack.go | 4 +- api/http/handler/stacks/stack_create.go | 6 +- api/http/handler/stacks/stack_delete.go | 2 +- api/http/handler/stacks/stack_migrate.go | 12 +- api/http/handler/stacks/stack_update.go | 10 +- api/http/handler/stacks/stack_update_git.go | 6 +- .../stacks/stack_update_git_redeploy.go | 6 +- api/http/handler/upload/upload_tls.go | 2 +- api/http/handler/websocket/attach.go | 6 +- api/http/handler/websocket/exec.go | 6 +- api/http/handler/websocket/pod.go | 4 +- api/http/handler/websocket/shell_pod.go | 4 +- api/http/proxy/factory/factory.go | 2 +- api/http/proxy/manager.go | 8 +- api/http/security/authorization.go | 8 +- api/http/security/bouncer.go | 28 ++-- api/http/security/filter.go | 8 +- api/internal/authorization/authorizations.go | 10 +- api/internal/edge/edgegroup.go | 4 +- api/internal/edge/edgejob.go | 2 +- api/internal/edge/edgestack.go | 2 +- api/internal/edge/endpoint.go | 2 +- api/internal/endpointutils/endpointutils.go | 6 +- api/internal/snapshot/snapshot.go | 16 +- api/internal/testhelpers/datastore.go | 2 +- api/kubernetes/cli/client.go | 2 +- api/kubernetes/cli/exec.go | 2 +- api/kubernetes/cli/kubeconfig.go | 2 +- api/kubernetes/cli/nodes_limits.go | 2 +- api/kubernetes/cli/secret.go | 2 +- api/kubernetes/kubeconfig_service.go | 2 +- api/kubernetes/kubeconfig_service_test.go | 4 +- api/kubernetes/snapshot.go | 2 +- api/oauth/oauth.go | 2 +- api/portainer.go | 150 +++++++++--------- 111 files changed, 376 insertions(+), 376 deletions(-) diff --git a/api/api-description.md b/api/api-description.md index bcdd8843d..8c2465333 100644 --- a/api/api-description.md +++ b/api/api-description.md @@ -4,7 +4,7 @@ You can find out more about Portainer at [http://portainer.io](http://portainer. # Authentication -Most of the API endpoints require to be authenticated as well as some level of authorization to be used. +Most of the API environments(endpoints) require to be authenticated as well as some level of authorization to be used. Portainer API uses JSON Web Token to manage authentication and thus requires you to provide a token in the **Authorization** header of each request with the **Bearer** authentication mechanism. @@ -16,7 +16,7 @@ Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJhZG1pbiIs # Security -Each API endpoint has an associated access policy, it is documented in the description of each endpoint. +Each API environment(endpoint) has an associated access policy, it is documented in the description of each environment(endpoint). Different access policies are available: @@ -27,27 +27,27 @@ Different access policies are available: ### Public access -No authentication is required to access the endpoints with this access policy. +No authentication is required to access the environments(endpoints) with this access policy. ### Authenticated access -Authentication is required to access the endpoints with this access policy. +Authentication is required to access the environments(endpoints) with this access policy. ### Restricted access -Authentication is required to access the endpoints with this access policy. +Authentication is required to access the environments(endpoints) with this access policy. Extra-checks might be added to ensure access to the resource is granted. Returned data might also be filtered. ### Administrator access -Authentication as well as an administrator role are required to access the endpoints with this access policy. +Authentication as well as an administrator role are required to access the environments(endpoints) with this access policy. # Execute Docker requests -Portainer **DO NOT** expose specific endpoints to manage your Docker resources (create a container, remove a volume, etc...). +Portainer **DO NOT** expose specific environments(endpoints) to manage your Docker resources (create a container, remove a volume, etc...). Instead, it acts as a reverse-proxy to the Docker HTTP API. This means that you can execute Docker requests **via** the Portainer HTTP API. -To do so, you can use the `/endpoints/{id}/docker` Portainer API endpoint (which is not documented below due to Swagger limitations). This endpoint has a restricted access policy so you still need to be authenticated to be able to query this endpoint. Any query on this endpoint will be proxied to the Docker API of the associated endpoint (requests and responses objects are the same as documented in the Docker API). +To do so, you can use the `/endpoints/{id}/docker` Portainer API environment(endpoint) (which is not documented below due to Swagger limitations). This environment(endpoint) has a restricted access policy so you still need to be authenticated to be able to query this environment(endpoint). Any query on this environment(endpoint) will be proxied to the Docker API of the associated environment(endpoint) (requests and responses objects are the same as documented in the Docker API). **NOTE**: You can find more information on how to query the Docker API in the [Docker official documentation](https://docs.docker.com/engine/api/v1.30/) as well as in [this Portainer example](https://documentation.portainer.io/api/api-examples/). diff --git a/api/bolt/edgejob/edgejob.go b/api/bolt/edgejob/edgejob.go index 216bdacec..ab94699bd 100644 --- a/api/bolt/edgejob/edgejob.go +++ b/api/bolt/edgejob/edgejob.go @@ -95,7 +95,7 @@ func (service *Service) DeleteEdgeJob(ID portainer.EdgeJobID) error { return internal.DeleteObject(service.connection, BucketName, identifier) } -// GetNextIdentifier returns the next identifier for an endpoint. +// GetNextIdentifier returns the next identifier for an environment(endpoint). func (service *Service) GetNextIdentifier() int { return internal.GetNextIdentifier(service.connection, BucketName) } diff --git a/api/bolt/edgestack/edgestack.go b/api/bolt/edgestack/edgestack.go index ff58c0dae..6136156fe 100644 --- a/api/bolt/edgestack/edgestack.go +++ b/api/bolt/edgestack/edgestack.go @@ -95,7 +95,7 @@ func (service *Service) DeleteEdgeStack(ID portainer.EdgeStackID) error { return internal.DeleteObject(service.connection, BucketName, identifier) } -// GetNextIdentifier returns the next identifier for an endpoint. +// GetNextIdentifier returns the next identifier for an environment(endpoint). func (service *Service) GetNextIdentifier() int { return internal.GetNextIdentifier(service.connection, BucketName) } diff --git a/api/bolt/endpoint/endpoint.go b/api/bolt/endpoint/endpoint.go index ebd162985..a136058ce 100644 --- a/api/bolt/endpoint/endpoint.go +++ b/api/bolt/endpoint/endpoint.go @@ -11,7 +11,7 @@ const ( BucketName = "endpoints" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } @@ -28,7 +28,7 @@ func NewService(connection *internal.DbConnection) (*Service, error) { }, nil } -// Endpoint returns an endpoint by ID. +// Endpoint returns an environment(endpoint) by ID. func (service *Service) Endpoint(ID portainer.EndpointID) (*portainer.Endpoint, error) { var endpoint portainer.Endpoint identifier := internal.Itob(int(ID)) @@ -41,19 +41,19 @@ func (service *Service) Endpoint(ID portainer.EndpointID) (*portainer.Endpoint, return &endpoint, nil } -// UpdateEndpoint updates an endpoint. +// UpdateEndpoint updates an environment(endpoint). func (service *Service) UpdateEndpoint(ID portainer.EndpointID, endpoint *portainer.Endpoint) error { identifier := internal.Itob(int(ID)) return internal.UpdateObject(service.connection, BucketName, identifier, endpoint) } -// DeleteEndpoint deletes an endpoint. +// DeleteEndpoint deletes an environment(endpoint). func (service *Service) DeleteEndpoint(ID portainer.EndpointID) error { identifier := internal.Itob(int(ID)) return internal.DeleteObject(service.connection, BucketName, identifier) } -// Endpoints return an array containing all the endpoints. +// Endpoints return an array containing all the environments(endpoints). func (service *Service) Endpoints() ([]portainer.Endpoint, error) { var endpoints = make([]portainer.Endpoint, 0) @@ -76,12 +76,12 @@ func (service *Service) Endpoints() ([]portainer.Endpoint, error) { return endpoints, err } -// CreateEndpoint assign an ID to a new endpoint and saves it. +// CreateEndpoint assign an ID to a new environment(endpoint) and saves it. func (service *Service) CreateEndpoint(endpoint *portainer.Endpoint) error { return service.connection.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket([]byte(BucketName)) - // We manually manage sequences for endpoints + // We manually manage sequences for environments(endpoints) err := bucket.SetSequence(uint64(endpoint.ID)) if err != nil { return err @@ -96,12 +96,12 @@ func (service *Service) CreateEndpoint(endpoint *portainer.Endpoint) error { }) } -// GetNextIdentifier returns the next identifier for an endpoint. +// GetNextIdentifier returns the next identifier for an environment(endpoint). func (service *Service) GetNextIdentifier() int { return internal.GetNextIdentifier(service.connection, BucketName) } -// Synchronize creates, updates and deletes endpoints inside a single transaction. +// Synchronize creates, updates and deletes environments(endpoints) inside a single transaction. func (service *Service) Synchronize(toCreate, toUpdate, toDelete []*portainer.Endpoint) error { return service.connection.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket([]byte(BucketName)) diff --git a/api/bolt/endpointgroup/endpointgroup.go b/api/bolt/endpointgroup/endpointgroup.go index 02c0e3382..4ab9bb556 100644 --- a/api/bolt/endpointgroup/endpointgroup.go +++ b/api/bolt/endpointgroup/endpointgroup.go @@ -12,7 +12,7 @@ const ( BucketName = "endpoint_groups" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } @@ -29,7 +29,7 @@ func NewService(connection *internal.DbConnection) (*Service, error) { }, nil } -// EndpointGroup returns an endpoint group by ID. +// EndpointGroup returns an environment(endpoint) group by ID. func (service *Service) EndpointGroup(ID portainer.EndpointGroupID) (*portainer.EndpointGroup, error) { var endpointGroup portainer.EndpointGroup identifier := internal.Itob(int(ID)) @@ -42,19 +42,19 @@ func (service *Service) EndpointGroup(ID portainer.EndpointGroupID) (*portainer. return &endpointGroup, nil } -// UpdateEndpointGroup updates an endpoint group. +// UpdateEndpointGroup updates an environment(endpoint) group. func (service *Service) UpdateEndpointGroup(ID portainer.EndpointGroupID, endpointGroup *portainer.EndpointGroup) error { identifier := internal.Itob(int(ID)) return internal.UpdateObject(service.connection, BucketName, identifier, endpointGroup) } -// DeleteEndpointGroup deletes an endpoint group. +// DeleteEndpointGroup deletes an environment(endpoint) group. func (service *Service) DeleteEndpointGroup(ID portainer.EndpointGroupID) error { identifier := internal.Itob(int(ID)) return internal.DeleteObject(service.connection, BucketName, identifier) } -// EndpointGroups return an array containing all the endpoint groups. +// EndpointGroups return an array containing all the environment(endpoint) groups. func (service *Service) EndpointGroups() ([]portainer.EndpointGroup, error) { var endpointGroups = make([]portainer.EndpointGroup, 0) @@ -77,7 +77,7 @@ func (service *Service) EndpointGroups() ([]portainer.EndpointGroup, error) { return endpointGroups, err } -// CreateEndpointGroup assign an ID to a new endpoint group and saves it. +// CreateEndpointGroup assign an ID to a new environment(endpoint) group and saves it. func (service *Service) CreateEndpointGroup(endpointGroup *portainer.EndpointGroup) error { return service.connection.Update(func(tx *bolt.Tx) error { bucket := tx.Bucket([]byte(BucketName)) diff --git a/api/bolt/endpointrelation/endpointrelation.go b/api/bolt/endpointrelation/endpointrelation.go index 974913531..ecd192d42 100644 --- a/api/bolt/endpointrelation/endpointrelation.go +++ b/api/bolt/endpointrelation/endpointrelation.go @@ -11,7 +11,7 @@ const ( BucketName = "endpoint_relations" ) -// Service represents a service for managing endpoint relation data. +// Service represents a service for managing environment(endpoint) relation data. type Service struct { connection *internal.DbConnection } @@ -28,7 +28,7 @@ func NewService(connection *internal.DbConnection) (*Service, error) { }, nil } -// EndpointRelation returns a Endpoint relation object by EndpointID +// EndpointRelation returns a Environment(Endpoint) relation object by EndpointID func (service *Service) EndpointRelation(endpointID portainer.EndpointID) (*portainer.EndpointRelation, error) { var endpointRelation portainer.EndpointRelation identifier := internal.Itob(int(endpointID)) @@ -55,13 +55,13 @@ func (service *Service) CreateEndpointRelation(endpointRelation *portainer.Endpo }) } -// UpdateEndpointRelation updates an Endpoint relation object +// UpdateEndpointRelation updates an Environment(Endpoint) relation object func (service *Service) UpdateEndpointRelation(EndpointID portainer.EndpointID, endpointRelation *portainer.EndpointRelation) error { identifier := internal.Itob(int(EndpointID)) return internal.UpdateObject(service.connection, BucketName, identifier, endpointRelation) } -// DeleteEndpointRelation deletes an Endpoint relation object +// DeleteEndpointRelation deletes an Environment(Endpoint) relation object func (service *Service) DeleteEndpointRelation(EndpointID portainer.EndpointID) error { identifier := internal.Itob(int(EndpointID)) return internal.DeleteObject(service.connection, BucketName, identifier) diff --git a/api/bolt/extension/extension.go b/api/bolt/extension/extension.go index 15104af8f..2d45b0eed 100644 --- a/api/bolt/extension/extension.go +++ b/api/bolt/extension/extension.go @@ -12,7 +12,7 @@ const ( BucketName = "extension" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/helmuserrepository/helmuserrepository.go b/api/bolt/helmuserrepository/helmuserrepository.go index 9d5aadb95..2605d54a0 100644 --- a/api/bolt/helmuserrepository/helmuserrepository.go +++ b/api/bolt/helmuserrepository/helmuserrepository.go @@ -12,7 +12,7 @@ const ( BucketName = "helm_user_repository" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/internal/json.go b/api/bolt/internal/json.go index f0636a599..5d117d104 100644 --- a/api/bolt/internal/json.go +++ b/api/bolt/internal/json.go @@ -17,7 +17,7 @@ func UnmarshalObject(data []byte, object interface{}) error { } // UnmarshalObjectWithJsoniter decodes an object from binary data -// using the jsoniter library. It is mainly used to accelerate endpoint +// using the jsoniter library. It is mainly used to accelerate environment(endpoint) // decoding at the moment. func UnmarshalObjectWithJsoniter(data []byte, object interface{}) error { var jsoni = jsoniter.ConfigCompatibleWithStandardLibrary diff --git a/api/bolt/registry/registry.go b/api/bolt/registry/registry.go index dc741ae7b..f1f530fd7 100644 --- a/api/bolt/registry/registry.go +++ b/api/bolt/registry/registry.go @@ -12,7 +12,7 @@ const ( BucketName = "registries" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/resourcecontrol/resourcecontrol.go b/api/bolt/resourcecontrol/resourcecontrol.go index d0d1559fb..0421ccbdb 100644 --- a/api/bolt/resourcecontrol/resourcecontrol.go +++ b/api/bolt/resourcecontrol/resourcecontrol.go @@ -12,7 +12,7 @@ const ( BucketName = "resource_control" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/role/role.go b/api/bolt/role/role.go index eff9d56f1..7849b32e9 100644 --- a/api/bolt/role/role.go +++ b/api/bolt/role/role.go @@ -12,7 +12,7 @@ const ( BucketName = "roles" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/services.go b/api/bolt/services.go index 2ee5264bc..849efa496 100644 --- a/api/bolt/services.go +++ b/api/bolt/services.go @@ -196,7 +196,7 @@ func (store *Store) EdgeStack() portainer.EdgeStackService { return store.EdgeStackService } -// Endpoint gives access to the Endpoint data management layer +// Environment(Endpoint) gives access to the Environment(Endpoint) data management layer func (store *Store) Endpoint() portainer.EndpointService { return store.EndpointService } diff --git a/api/bolt/settings/settings.go b/api/bolt/settings/settings.go index 001bd6142..60f8735c1 100644 --- a/api/bolt/settings/settings.go +++ b/api/bolt/settings/settings.go @@ -11,7 +11,7 @@ const ( settingsKey = "SETTINGS" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/stack/stack.go b/api/bolt/stack/stack.go index 094a52b2e..b6839493f 100644 --- a/api/bolt/stack/stack.go +++ b/api/bolt/stack/stack.go @@ -16,7 +16,7 @@ const ( BucketName = "stacks" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/tag/tag.go b/api/bolt/tag/tag.go index f10c64d35..00bd15f0a 100644 --- a/api/bolt/tag/tag.go +++ b/api/bolt/tag/tag.go @@ -12,7 +12,7 @@ const ( BucketName = "tags" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/team/team.go b/api/bolt/team/team.go index d710f05c1..681b6bd8a 100644 --- a/api/bolt/team/team.go +++ b/api/bolt/team/team.go @@ -15,7 +15,7 @@ const ( BucketName = "teams" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/teammembership/teammembership.go b/api/bolt/teammembership/teammembership.go index 752120ea1..f6a0d94b5 100644 --- a/api/bolt/teammembership/teammembership.go +++ b/api/bolt/teammembership/teammembership.go @@ -12,7 +12,7 @@ const ( BucketName = "team_membership" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/tunnelserver/tunnelserver.go b/api/bolt/tunnelserver/tunnelserver.go index a85b098df..2b88a848f 100644 --- a/api/bolt/tunnelserver/tunnelserver.go +++ b/api/bolt/tunnelserver/tunnelserver.go @@ -11,7 +11,7 @@ const ( infoKey = "INFO" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/bolt/user/user.go b/api/bolt/user/user.go index 700d2f419..e91598c4d 100644 --- a/api/bolt/user/user.go +++ b/api/bolt/user/user.go @@ -15,7 +15,7 @@ const ( BucketName = "users" ) -// Service represents a service for managing endpoint data. +// Service represents a service for managing environment(endpoint) data. type Service struct { connection *internal.DbConnection } diff --git a/api/chisel/schedules.go b/api/chisel/schedules.go index bac424fcb..6bcba574d 100644 --- a/api/chisel/schedules.go +++ b/api/chisel/schedules.go @@ -6,7 +6,7 @@ import ( portainer "github.com/portainer/portainer/api" ) -// AddEdgeJob register an EdgeJob inside the tunnel details associated to an endpoint. +// AddEdgeJob register an EdgeJob inside the tunnel details associated to an environment(endpoint). func (service *Service) AddEdgeJob(endpointID portainer.EndpointID, edgeJob *portainer.EdgeJob) { tunnel := service.GetTunnelDetails(endpointID) diff --git a/api/chisel/tunnel.go b/api/chisel/tunnel.go index 1306df48c..8f48461f6 100644 --- a/api/chisel/tunnel.go +++ b/api/chisel/tunnel.go @@ -38,7 +38,7 @@ func randomInt(min, max int) int { return min + rand.Intn(max-min) } -// GetTunnelDetails returns information about the tunnel associated to an endpoint. +// GetTunnelDetails returns information about the tunnel associated to an environment(endpoint). func (service *Service) GetTunnelDetails(endpointID portainer.EndpointID) *portainer.TunnelDetails { key := strconv.Itoa(int(endpointID)) @@ -56,7 +56,7 @@ func (service *Service) GetTunnelDetails(endpointID portainer.EndpointID) *porta } } -// SetTunnelStatusToActive update the status of the tunnel associated to the specified endpoint. +// SetTunnelStatusToActive update the status of the tunnel associated to the specified environment(endpoint). // It sets the status to ACTIVE. func (service *Service) SetTunnelStatusToActive(endpointID portainer.EndpointID) { tunnel := service.GetTunnelDetails(endpointID) @@ -68,7 +68,7 @@ func (service *Service) SetTunnelStatusToActive(endpointID portainer.EndpointID) service.tunnelDetailsMap.Set(key, tunnel) } -// SetTunnelStatusToIdle update the status of the tunnel associated to the specified endpoint. +// SetTunnelStatusToIdle update the status of the tunnel associated to the specified environment(endpoint). // It sets the status to IDLE. // It removes any existing credentials associated to the tunnel. func (service *Service) SetTunnelStatusToIdle(endpointID portainer.EndpointID) { @@ -88,11 +88,11 @@ func (service *Service) SetTunnelStatusToIdle(endpointID portainer.EndpointID) { service.tunnelDetailsMap.Set(key, tunnel) } -// SetTunnelStatusToRequired update the status of the tunnel associated to the specified endpoint. +// SetTunnelStatusToRequired update the status of the tunnel associated to the specified environment(endpoint). // It sets the status to REQUIRED. // If no port is currently associated to the tunnel, it will associate a random unused port to the tunnel // and generate temporary credentials that can be used to establish a reverse tunnel on that port. -// Credentials are encrypted using the Edge ID associated to the endpoint. +// Credentials are encrypted using the Edge ID associated to the environment(endpoint). func (service *Service) SetTunnelStatusToRequired(endpointID portainer.EndpointID) error { tunnel := service.GetTunnelDetails(endpointID) diff --git a/api/crypto/ecdsa.go b/api/crypto/ecdsa.go index 9148eb68d..1cd119fce 100644 --- a/api/crypto/ecdsa.go +++ b/api/crypto/ecdsa.go @@ -22,7 +22,7 @@ const ( ) // ECDSAService is a service used to create digital signatures when communicating with -// an agent based environment. It will automatically generates a key pair using ECDSA or +// an agent based environment(endpoint). It will automatically generates a key pair using ECDSA or // can also reuse an existing ECDSA key pair. type ECDSAService struct { privateKey *ecdsa.PrivateKey diff --git a/api/docker/client.go b/api/docker/client.go index 2fdb21842..8aa82051b 100644 --- a/api/docker/client.go +++ b/api/docker/client.go @@ -34,8 +34,8 @@ func NewClientFactory(signatureService portainer.DigitalSignatureService, revers } // createClient is a generic function to create a Docker client based on -// a specific endpoint configuration. The nodeName parameter can be used -// with an agent enabled endpoint to target a specific node in an agent cluster. +// a specific environment(endpoint) configuration. The nodeName parameter can be used +// with an agent enabled environment(endpoint) to target a specific node in an agent cluster. func (factory *ClientFactory) CreateClient(endpoint *portainer.Endpoint, nodeName string) (*client.Client, error) { if endpoint.Type == portainer.AzureEnvironment { return nil, errUnsupportedEnvironmentType diff --git a/api/docker/snapshot.go b/api/docker/snapshot.go index 5283acf1b..553a94847 100644 --- a/api/docker/snapshot.go +++ b/api/docker/snapshot.go @@ -12,7 +12,7 @@ import ( "github.com/portainer/portainer/api" ) -// Snapshotter represents a service used to create endpoint snapshots +// Snapshotter represents a service used to create environment(endpoint) snapshots type Snapshotter struct { clientFactory *ClientFactory } @@ -24,7 +24,7 @@ func NewSnapshotter(clientFactory *ClientFactory) *Snapshotter { } } -// CreateSnapshot creates a snapshot of a specific Docker endpoint +// CreateSnapshot creates a snapshot of a specific Docker environment(endpoint) func (snapshotter *Snapshotter) CreateSnapshot(endpoint *portainer.Endpoint) (*portainer.DockerSnapshot, error) { cli, err := snapshotter.clientFactory.CreateClient(endpoint, "") if err != nil { diff --git a/api/exec/kubernetes_deploy.go b/api/exec/kubernetes_deploy.go index 46a2622d0..4de78586f 100644 --- a/api/exec/kubernetes_deploy.go +++ b/api/exec/kubernetes_deploy.go @@ -22,7 +22,7 @@ import ( "github.com/portainer/portainer/api/crypto" ) -// KubernetesDeployer represents a service to deploy resources inside a Kubernetes environment. +// KubernetesDeployer represents a service to deploy resources inside a Kubernetes environment(endpoint). type KubernetesDeployer struct { binaryPath string dataStore portainer.DataStore @@ -77,7 +77,7 @@ func (deployer *KubernetesDeployer) getToken(request *http.Request, endpoint *po return token, nil } -// Deploy will deploy a Kubernetes manifest inside a specific namespace in a Kubernetes endpoint. +// Deploy will deploy a Kubernetes manifest inside a specific namespace in a Kubernetes environment(endpoint). // Otherwise it will use kubectl to deploy the manifest. func (deployer *KubernetesDeployer) Deploy(request *http.Request, endpoint *portainer.Endpoint, stackConfig string, namespace string) (string, error) { if endpoint.Type == portainer.KubernetesLocalEnvironment { diff --git a/api/filesystem/filesystem.go b/api/filesystem/filesystem.go index 9063c22f6..3f68bcf53 100644 --- a/api/filesystem/filesystem.go +++ b/api/filesystem/filesystem.go @@ -288,7 +288,7 @@ func (service *Service) StoreTLSFileFromBytes(folder string, fileType portainer. return path.Join(service.fileStorePath, tlsFilePath), nil } -// GetPathForTLSFile returns the absolute path to a specific TLS file for an endpoint. +// GetPathForTLSFile returns the absolute path to a specific TLS file for an environment(endpoint). func (service *Service) GetPathForTLSFile(folder string, fileType portainer.TLSFileType) (string, error) { var fileName string switch fileType { diff --git a/api/http/client/client.go b/api/http/client/client.go index ba185950a..c789854a4 100644 --- a/api/http/client/client.go +++ b/api/http/client/client.go @@ -102,7 +102,7 @@ func Get(url string, timeout int) ([]byte, error) { return body, nil } -// ExecutePingOperation will send a SystemPing operation HTTP request to a Docker environment +// ExecutePingOperation will send a SystemPing operation HTTP request to a Docker environment(endpoint) // using the specified host and optional TLS configuration. // It uses a new Http.Client for each operation. func ExecutePingOperation(host string, tlsConfig *tls.Config) (bool, error) { diff --git a/api/http/errors/errors.go b/api/http/errors/errors.go index ef0abcfee..df896fde0 100644 --- a/api/http/errors/errors.go +++ b/api/http/errors/errors.go @@ -3,7 +3,7 @@ package errors import "errors" var ( - // ErrEndpointAccessDenied Access denied to endpoint error + // ErrEndpointAccessDenied Access denied to environment(endpoint) error ErrEndpointAccessDenied = errors.New("Access denied to environment") // ErrUnauthorized Unauthorized error ErrUnauthorized = errors.New("Unauthorized") diff --git a/api/http/handler/auth/authenticate.go b/api/http/handler/auth/authenticate.go index ae2201855..500854a0f 100644 --- a/api/http/handler/auth/authenticate.go +++ b/api/http/handler/auth/authenticate.go @@ -39,7 +39,7 @@ func (payload *authenticatePayload) Validate(r *http.Request) error { // @id AuthenticateUser // @summary Authenticate -// @description Use this endpoint to authenticate against Portainer using a username and password. +// @description Use this environment(endpoint) to authenticate against Portainer using a username and password. // @tags auth // @accept json // @produce json diff --git a/api/http/handler/customtemplates/handler.go b/api/http/handler/customtemplates/handler.go index ff8fce4a5..e62dcb575 100644 --- a/api/http/handler/customtemplates/handler.go +++ b/api/http/handler/customtemplates/handler.go @@ -10,7 +10,7 @@ import ( "github.com/portainer/portainer/api/internal/authorization" ) -// Handler is the HTTP handler used to handle endpoint group operations. +// Handler is the HTTP handler used to handle environment(endpoint) group operations. type Handler struct { *mux.Router DataStore portainer.DataStore @@ -18,7 +18,7 @@ type Handler struct { GitService portainer.GitService } -// NewHandler creates a handler to manage endpoint group operations. +// NewHandler creates a handler to manage environment(endpoint) group operations. func NewHandler(bouncer *security.RequestBouncer) *Handler { h := &Handler{ Router: mux.NewRouter(), diff --git a/api/http/handler/edgegroups/handler.go b/api/http/handler/edgegroups/handler.go index 374ca4ab2..b9a5989f3 100644 --- a/api/http/handler/edgegroups/handler.go +++ b/api/http/handler/edgegroups/handler.go @@ -9,13 +9,13 @@ import ( "github.com/portainer/portainer/api/http/security" ) -// Handler is the HTTP handler used to handle endpoint group operations. +// Handler is the HTTP handler used to handle environment(endpoint) group operations. type Handler struct { *mux.Router DataStore portainer.DataStore } -// NewHandler creates a handler to manage endpoint group operations. +// NewHandler creates a handler to manage environment(endpoint) group operations. func NewHandler(bouncer *security.RequestBouncer) *Handler { h := &Handler{ Router: mux.NewRouter(), diff --git a/api/http/handler/edgestacks/edgestack_create.go b/api/http/handler/edgestacks/edgestack_create.go index dfc952f92..5c12ad392 100644 --- a/api/http/handler/edgestacks/edgestack_create.go +++ b/api/http/handler/edgestacks/edgestack_create.go @@ -67,8 +67,8 @@ type swarmStackFromFileContentPayload struct { EdgeGroups []portainer.EdgeGroupID `example:"1"` // Deployment type to deploy this stack // Valid values are: 0 - 'compose', 1 - 'kubernetes' - // for compose stacks will use kompose to convert to kubernetes manifest for kubernetes endpoints - // kubernetes deploytype is enabled only for kubernetes endpoints + // for compose stacks will use kompose to convert to kubernetes manifest for kubernetes environments(endpoints) + // kubernetes deploytype is enabled only for kubernetes environments(endpoints) DeploymentType portainer.EdgeStackDeploymentType `example:"0" enums:"0,1"` } @@ -185,8 +185,8 @@ type swarmStackFromGitRepositoryPayload struct { EdgeGroups []portainer.EdgeGroupID `example:"1"` // Deployment type to deploy this stack // Valid values are: 0 - 'compose', 1 - 'kubernetes' - // for compose stacks will use kompose to convert to kubernetes manifest for kubernetes endpoints - // kubernetes deploytype is enabled only for kubernetes endpoints + // for compose stacks will use kompose to convert to kubernetes manifest for kubernetes environments(endpoints) + // kubernetes deploytype is enabled only for kubernetes environments(endpoints) DeploymentType portainer.EdgeStackDeploymentType `example:"0" enums:"0,1"` } @@ -402,7 +402,7 @@ func (handler *Handler) validateUniqueName(name string) error { return nil } -// updateEndpointRelations adds a relation between the Edge Stack to the related endpoints +// updateEndpointRelations adds a relation between the Edge Stack to the related environments(endpoints) func updateEndpointRelations(endpointRelationService portainer.EndpointRelationService, edgeStackID portainer.EdgeStackID, relatedEndpointIds []portainer.EndpointID) error { for _, endpointID := range relatedEndpointIds { relation, err := endpointRelationService.EndpointRelation(endpointID) diff --git a/api/http/handler/edgestacks/edgestack_status_update.go b/api/http/handler/edgestacks/edgestack_status_update.go index 0ac60b981..2f3c57dc3 100644 --- a/api/http/handler/edgestacks/edgestack_status_update.go +++ b/api/http/handler/edgestacks/edgestack_status_update.go @@ -33,7 +33,7 @@ func (payload *updateStatusPayload) Validate(r *http.Request) error { // @id EdgeStackStatusUpdate // @summary Update an EdgeStack status -// @description Authorized only if the request is done by an Edge Endpoint +// @description Authorized only if the request is done by an Edge Environment(Endpoint) // @tags edge_stacks // @accept json // @produce json diff --git a/api/http/handler/edgestacks/edgestack_update.go b/api/http/handler/edgestacks/edgestack_update.go index 7245c1b8e..80c148e58 100644 --- a/api/http/handler/edgestacks/edgestack_update.go +++ b/api/http/handler/edgestacks/edgestack_update.go @@ -164,11 +164,11 @@ func (handler *Handler) edgeStackUpdate(w http.ResponseWriter, r *http.Request) hasDockerEndpoint, err := hasDockerEndpoint(handler.DataStore.Endpoint(), relatedEndpointIds) if err != nil { - return &httperror.HandlerError{http.StatusInternalServerError, "Unable to check for existence of docker endpoint", err} + return &httperror.HandlerError{http.StatusInternalServerError, "Unable to check for existence of docker environment", err} } if hasDockerEndpoint { - return &httperror.HandlerError{http.StatusBadRequest, "Edge stack with docker endpoint cannot be deployed with kubernetes config", err} + return &httperror.HandlerError{http.StatusBadRequest, "Edge stack with docker environment cannot be deployed with kubernetes config", err} } _, err = handler.FileService.StoreEdgeStackFileFromBytes(stackFolder, stack.ManifestPath, []byte(payload.StackFileContent)) diff --git a/api/http/handler/edgestacks/endpoints.go b/api/http/handler/edgestacks/endpoints.go index de494f9f0..c90dcc29a 100644 --- a/api/http/handler/edgestacks/endpoints.go +++ b/api/http/handler/edgestacks/endpoints.go @@ -19,7 +19,7 @@ func hasEndpointPredicate(endpointService portainer.EndpointService, endpointIDs for _, endpointID := range endpointIDs { endpoint, err := endpointService.Endpoint(endpointID) if err != nil { - return false, fmt.Errorf("failed to retrieve endpoint from database: %w", err) + return false, fmt.Errorf("failed to retrieve environment from database: %w", err) } if predicate(endpoint) { diff --git a/api/http/handler/edgestacks/handler.go b/api/http/handler/edgestacks/handler.go index 5e14719db..d9bf0e39e 100644 --- a/api/http/handler/edgestacks/handler.go +++ b/api/http/handler/edgestacks/handler.go @@ -13,7 +13,7 @@ import ( "github.com/portainer/portainer/api/http/security" ) -// Handler is the HTTP handler used to handle endpoint group operations. +// Handler is the HTTP handler used to handle environment(endpoint) group operations. type Handler struct { *mux.Router requestBouncer *security.RequestBouncer @@ -23,7 +23,7 @@ type Handler struct { KubernetesDeployer portainer.KubernetesDeployer } -// NewHandler creates a handler to manage endpoint group operations. +// NewHandler creates a handler to manage environment(endpoint) group operations. func NewHandler(bouncer *security.RequestBouncer) *Handler { h := &Handler{ Router: mux.NewRouter(), @@ -49,7 +49,7 @@ func NewHandler(bouncer *security.RequestBouncer) *Handler { func (handler *Handler) convertAndStoreKubeManifestIfNeeded(edgeStack *portainer.EdgeStack, relatedEndpointIds []portainer.EndpointID) error { hasKubeEndpoint, err := hasKubeEndpoint(handler.DataStore.Endpoint(), relatedEndpointIds) if err != nil { - return fmt.Errorf("unable to check if edge stack has kube endpoints: %w", err) + return fmt.Errorf("unable to check if edge stack has kube environments: %w", err) } if !hasKubeEndpoint { diff --git a/api/http/handler/edgetemplates/handler.go b/api/http/handler/edgetemplates/handler.go index 963ddb931..21a344aed 100644 --- a/api/http/handler/edgetemplates/handler.go +++ b/api/http/handler/edgetemplates/handler.go @@ -10,14 +10,14 @@ import ( "github.com/portainer/portainer/api/http/security" ) -// Handler is the HTTP handler used to handle edge endpoint operations. +// Handler is the HTTP handler used to handle edge environment(endpoint) operations. type Handler struct { *mux.Router requestBouncer *security.RequestBouncer DataStore portainer.DataStore } -// NewHandler creates a handler to manage endpoint operations. +// NewHandler creates a handler to manage environment(endpoint) operations. func NewHandler(bouncer *security.RequestBouncer) *Handler { h := &Handler{ Router: mux.NewRouter(), diff --git a/api/http/handler/endpointedge/endpoint_edgejob_logs.go b/api/http/handler/endpointedge/endpoint_edgejob_logs.go index 9626a7a3e..629783bf9 100644 --- a/api/http/handler/endpointedge/endpoint_edgejob_logs.go +++ b/api/http/handler/endpointedge/endpoint_edgejob_logs.go @@ -25,7 +25,7 @@ func (payload *logsPayload) Validate(r *http.Request) error { // @tags edge, endpoints // @accept json // @produce json -// @param id path string true "Endpoint Id" +// @param id path string true "environment(endpoint) Id" // @param jobID path string true "Job Id" // @success 200 // @failure 500 diff --git a/api/http/handler/endpointedge/endpoint_edgestack_inspect.go b/api/http/handler/endpointedge/endpoint_edgestack_inspect.go index b9d7bb452..11b85ff9b 100644 --- a/api/http/handler/endpointedge/endpoint_edgestack_inspect.go +++ b/api/http/handler/endpointedge/endpoint_edgestack_inspect.go @@ -18,12 +18,12 @@ type configResponse struct { Name string } -// @summary Inspect an Edge Stack for an Endpoint +// @summary Inspect an Edge Stack for an Environment(Endpoint) // @description // @tags edge, endpoints, edge_stacks // @accept json // @produce json -// @param id path string true "Endpoint Id" +// @param id path string true "environment(endpoint) Id" // @param stackId path string true "EdgeStack Id" // @success 200 {object} configResponse // @failure 500 diff --git a/api/http/handler/endpointedge/handler.go b/api/http/handler/endpointedge/handler.go index 6ca96d3fa..e8a9c8dee 100644 --- a/api/http/handler/endpointedge/handler.go +++ b/api/http/handler/endpointedge/handler.go @@ -10,7 +10,7 @@ import ( "github.com/portainer/portainer/api/http/security" ) -// Handler is the HTTP handler used to handle edge endpoint operations. +// Handler is the HTTP handler used to handle edge environment(endpoint) operations. type Handler struct { *mux.Router requestBouncer *security.RequestBouncer @@ -19,7 +19,7 @@ type Handler struct { ReverseTunnelService portainer.ReverseTunnelService } -// NewHandler creates a handler to manage endpoint operations. +// NewHandler creates a handler to manage environment(endpoint) operations. func NewHandler(bouncer *security.RequestBouncer) *Handler { h := &Handler{ Router: mux.NewRouter(), diff --git a/api/http/handler/endpointgroups/endpointgroup_create.go b/api/http/handler/endpointgroups/endpointgroup_create.go index 46879b694..093163cc9 100644 --- a/api/http/handler/endpointgroups/endpointgroup_create.go +++ b/api/http/handler/endpointgroups/endpointgroup_create.go @@ -12,13 +12,13 @@ import ( ) type endpointGroupCreatePayload struct { - // Endpoint group name - Name string `validate:"required" example:"my-endpoint-group"` - // Endpoint group description + // Environment(Endpoint) group name + Name string `validate:"required" example:"my-environment-group"` + // Environment(Endpoint) group description Description string `example:"description"` - // List of endpoint identifiers that will be part of this group + // List of environment(endpoint) identifiers that will be part of this group AssociatedEndpoints []portainer.EndpointID `example:"1,3"` - // List of tag identifiers to which this endpoint group is associated + // List of tag identifiers to which this environment(endpoint) group is associated TagIDs []portainer.TagID `example:"1,2"` } @@ -32,14 +32,14 @@ func (payload *endpointGroupCreatePayload) Validate(r *http.Request) error { return nil } -// @summary Create an Endpoint Group -// @description Create a new endpoint group. +// @summary Create an Environment(Endpoint) Group +// @description Create a new environment(endpoint) group. // @description **Access policy**: administrator // @tags endpoint_groups // @security jwt // @accept json // @produce json -// @param body body endpointGroupCreatePayload true "Endpoint Group details" +// @param body body endpointGroupCreatePayload true "Environment(Endpoint) Group details" // @success 200 {object} portainer.EndpointGroup "Success" // @failure 400 "Invalid request" // @failure 500 "Server error" diff --git a/api/http/handler/endpointgroups/endpointgroup_delete.go b/api/http/handler/endpointgroups/endpointgroup_delete.go index baa58f307..f2375d0a6 100644 --- a/api/http/handler/endpointgroups/endpointgroup_delete.go +++ b/api/http/handler/endpointgroups/endpointgroup_delete.go @@ -12,8 +12,8 @@ import ( ) // @id EndpointGroupDelete -// @summary Remove an endpoint group -// @description Remove an endpoint group. +// @summary Remove an environment(endpoint) group +// @description Remove an environment(endpoint) group. // @description **Access policy**: administrator // @tags endpoint_groups // @security jwt diff --git a/api/http/handler/endpointgroups/endpointgroup_endpoint_add.go b/api/http/handler/endpointgroups/endpointgroup_endpoint_add.go index fb0759e7e..204bf9a19 100644 --- a/api/http/handler/endpointgroups/endpointgroup_endpoint_add.go +++ b/api/http/handler/endpointgroups/endpointgroup_endpoint_add.go @@ -11,13 +11,13 @@ import ( ) // @id EndpointGroupAddEndpoint -// @summary Add an endpoint to an endpoint group -// @description Add an endpoint to an endpoint group +// @summary Add an environment(endpoint) to an environment(endpoint) group +// @description Add an environment(endpoint) to an environment(endpoint) group // @description **Access policy**: administrator // @tags endpoint_groups // @security jwt // @param id path int true "EndpointGroup identifier" -// @param endpointId path int true "Endpoint identifier" +// @param endpointId path int true "Environment(Endpoint) identifier" // @success 204 "Success" // @failure 400 "Invalid request" // @failure 404 "EndpointGroup not found" diff --git a/api/http/handler/endpointgroups/endpointgroup_endpoint_delete.go b/api/http/handler/endpointgroups/endpointgroup_endpoint_delete.go index 4963af012..ef563d0ae 100644 --- a/api/http/handler/endpointgroups/endpointgroup_endpoint_delete.go +++ b/api/http/handler/endpointgroups/endpointgroup_endpoint_delete.go @@ -11,12 +11,12 @@ import ( ) // @id EndpointGroupDeleteEndpoint -// @summary Removes endpoint from an endpoint group +// @summary Removes environment(endpoint) from an environment(endpoint) group // @description **Access policy**: administrator // @tags endpoint_groups // @security jwt // @param id path int true "EndpointGroup identifier" -// @param endpointId path int true "Endpoint identifier" +// @param endpointId path int true "Environment(Endpoint) identifier" // @success 204 "Success" // @failure 400 "Invalid request" // @failure 404 "EndpointGroup not found" diff --git a/api/http/handler/endpointgroups/endpointgroup_inspect.go b/api/http/handler/endpointgroups/endpointgroup_inspect.go index 2cec65bd9..e689b4ecc 100644 --- a/api/http/handler/endpointgroups/endpointgroup_inspect.go +++ b/api/http/handler/endpointgroups/endpointgroup_inspect.go @@ -10,14 +10,14 @@ import ( "github.com/portainer/portainer/api/bolt/errors" ) -// @summary Inspect an Endpoint group -// @description Retrieve details abont an endpoint group. +// @summary Inspect an Environment(Endpoint) group +// @description Retrieve details abont an environment(endpoint) group. // @description **Access policy**: administrator // @tags endpoint_groups // @security jwt // @accept json // @produce json -// @param id path int true "Endpoint group identifier" +// @param id path int true "Environment(Endpoint) group identifier" // @success 200 {object} portainer.EndpointGroup "Success" // @failure 400 "Invalid request" // @failure 404 "EndpointGroup not found" diff --git a/api/http/handler/endpointgroups/endpointgroup_list.go b/api/http/handler/endpointgroups/endpointgroup_list.go index 6cb0cfabe..acfbbe792 100644 --- a/api/http/handler/endpointgroups/endpointgroup_list.go +++ b/api/http/handler/endpointgroups/endpointgroup_list.go @@ -9,15 +9,15 @@ import ( ) // @id EndpointGroupList -// @summary List Endpoint groups -// @description List all endpoint groups based on the current user authorizations. Will -// @description return all endpoint groups if using an administrator account otherwise it will -// @description only return authorized endpoint groups. +// @summary List Environment(Endpoint) groups +// @description List all environment(endpoint) groups based on the current user authorizations. Will +// @description return all environment(endpoint) groups if using an administrator account otherwise it will +// @description only return authorized environment(endpoint) groups. // @description **Access policy**: restricted // @tags endpoint_groups // @security jwt // @produce json -// @success 200 {array} portainer.EndpointGroup "Endpoint group" +// @success 200 {array} portainer.EndpointGroup "Environment(Endpoint) group" // @failure 500 "Server error" // @router /endpoint_groups [get] func (handler *Handler) endpointGroupList(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/endpointgroups/endpointgroup_update.go b/api/http/handler/endpointgroups/endpointgroup_update.go index bf7708847..04cb05edd 100644 --- a/api/http/handler/endpointgroups/endpointgroup_update.go +++ b/api/http/handler/endpointgroups/endpointgroup_update.go @@ -13,11 +13,11 @@ import ( ) type endpointGroupUpdatePayload struct { - // Endpoint group name - Name string `example:"my-endpoint-group"` - // Endpoint group description + // Environment(Endpoint) group name + Name string `example:"my-environment-group"` + // Environment(Endpoint) group description Description string `example:"description"` - // List of tag identifiers associated to the endpoint group + // List of tag identifiers associated to the environment(endpoint) group TagIDs []portainer.TagID `example:"3,4"` UserAccessPolicies portainer.UserAccessPolicies TeamAccessPolicies portainer.TeamAccessPolicies @@ -28,8 +28,8 @@ func (payload *endpointGroupUpdatePayload) Validate(r *http.Request) error { } // @id EndpointGroupUpdate -// @summary Update an endpoint group -// @description Update an endpoint group. +// @summary Update an environment(endpoint) group +// @description Update an environment(endpoint) group. // @description **Access policy**: administrator // @tags endpoint_groups // @security jwt diff --git a/api/http/handler/endpointgroups/handler.go b/api/http/handler/endpointgroups/handler.go index 08760bd66..69731e586 100644 --- a/api/http/handler/endpointgroups/handler.go +++ b/api/http/handler/endpointgroups/handler.go @@ -10,14 +10,14 @@ import ( "github.com/portainer/portainer/api/http/security" ) -// Handler is the HTTP handler used to handle endpoint group operations. +// Handler is the HTTP handler used to handle environment(endpoint) group operations. type Handler struct { *mux.Router AuthorizationService *authorization.Service DataStore portainer.DataStore } -// NewHandler creates a handler to manage endpoint group operations. +// NewHandler creates a handler to manage environment(endpoint) group operations. func NewHandler(bouncer *security.RequestBouncer) *Handler { h := &Handler{ Router: mux.NewRouter(), diff --git a/api/http/handler/endpoints/endpoint_association_delete.go b/api/http/handler/endpoints/endpoint_association_delete.go index cc339d159..092f9bd30 100644 --- a/api/http/handler/endpoints/endpoint_association_delete.go +++ b/api/http/handler/endpoints/endpoint_association_delete.go @@ -16,16 +16,16 @@ import ( ) // @id EndpointAssociationDelete -// @summary De-association an edge endpoint -// @description De-association an edge endpoint. +// @summary De-association an edge environment(endpoint) +// @description De-association an edge environment(endpoint). // @description **Access policy**: administrator // @security jwt // @tags endpoints // @produce json -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @success 200 {object} portainer.Endpoint "Success" // @failure 400 "Invalid request" -// @failure 404 "Endpoint not found" +// @failure 404 "Environment(Endpoint) not found" // @failure 500 "Server error" // @router /api/endpoints/{id}/association [put] func (handler *Handler) endpointAssociationDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/endpoints/endpoint_create.go b/api/http/handler/endpoints/endpoint_create.go index 67f6086d1..54d3ca6f0 100644 --- a/api/http/handler/endpoints/endpoint_create.go +++ b/api/http/handler/endpoints/endpoint_create.go @@ -148,28 +148,28 @@ func (payload *endpointCreatePayload) Validate(r *http.Request) error { } // @id EndpointCreate -// @summary Create a new endpoint -// @description Create a new endpoint that will be used to manage an environment. +// @summary Create a new environment(endpoint) +// @description Create a new environment(endpoint) that will be used to manage an environment(endpoint). // @description **Access policy**: administrator // @tags endpoints // @security jwt // @accept multipart/form-data // @produce json -// @param Name formData string true "Name that will be used to identify this endpoint (example: my-endpoint)" -// @param EndpointCreationType formData integer true "Environment type. Value must be one of: 1 (Local Docker environment), 2 (Agent environment), 3 (Azure environment), 4 (Edge agent environment) or 5 (Local Kubernetes Environment" Enum(1,2,3,4,5) +// @param Name formData string true "Name that will be used to identify this environment(endpoint) (example: my-environment)" +// @param EndpointCreationType formData integer true "Environment(Endpoint) type. Value must be one of: 1 (Local Docker environment), 2 (Agent environment), 3 (Azure environment), 4 (Edge agent environment) or 5 (Local Kubernetes Environment" Enum(1,2,3,4,5) // @param URL formData string false "URL or IP address of a Docker host (example: docker.mydomain.tld:2375). Defaults to local if not specified (Linux: /var/run/docker.sock, Windows: //./pipe/docker_engine)" // @param PublicURL formData string false "URL or IP address where exposed containers will be reachable. Defaults to URL if not specified (example: docker.mydomain.tld:2375)" -// @param GroupID formData int false "Endpoint group identifier. If not specified will default to 1 (unassigned)." -// @param TLS formData bool false "Require TLS to connect against this endpoint" +// @param GroupID formData int false "Environment(Endpoint) group identifier. If not specified will default to 1 (unassigned)." +// @param TLS formData bool false "Require TLS to connect against this environment(endpoint)" // @param TLSSkipVerify formData bool false "Skip server verification when using TLS" // @param TLSSkipClientVerify formData bool false "Skip client verification when using TLS" // @param TLSCACertFile formData file false "TLS CA certificate file" // @param TLSCertFile formData file false "TLS client certificate file" // @param TLSKeyFile formData file false "TLS client key file" -// @param AzureApplicationID formData string false "Azure application ID. Required if endpoint type is set to 3" -// @param AzureTenantID formData string false "Azure tenant ID. Required if endpoint type is set to 3" -// @param AzureAuthenticationKey formData string false "Azure authentication key. Required if endpoint type is set to 3" -// @param TagIDs formData []int false "List of tag identifiers to which this endpoint is associated" +// @param AzureApplicationID formData string false "Azure application ID. Required if environment(endpoint) type is set to 3" +// @param AzureTenantID formData string false "Azure tenant ID. Required if environment(endpoint) type is set to 3" +// @param AzureAuthenticationKey formData string false "Azure authentication key. Required if environment(endpoint) type is set to 3" +// @param TagIDs formData []int false "List of tag identifiers to which this environment(endpoint) is associated" // @param EdgeCheckinInterval formData int false "The check in interval for edge agent (in seconds)" // @success 200 {object} portainer.Endpoint "Success" // @failure 400 "Invalid request" diff --git a/api/http/handler/endpoints/endpoint_delete.go b/api/http/handler/endpoints/endpoint_delete.go index 43032f881..13624237e 100644 --- a/api/http/handler/endpoints/endpoint_delete.go +++ b/api/http/handler/endpoints/endpoint_delete.go @@ -12,15 +12,15 @@ import ( ) // @id EndpointDelete -// @summary Remove an endpoint -// @description Remove an endpoint. +// @summary Remove an environment(endpoint) +// @description Remove an environment(endpoint). // @description **Access policy**: administrator // @tags endpoints // @security jwt -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @success 204 "Success" // @failure 400 "Invalid request" -// @failure 404 "Endpoint not found" +// @failure 404 "Environment(Endpoint) not found" // @failure 500 "Server error" // @router /endpoints/{id} [delete] func (handler *Handler) endpointDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/endpoints/endpoint_inspect.go b/api/http/handler/endpoints/endpoint_inspect.go index b538be794..61a6c0b91 100644 --- a/api/http/handler/endpoints/endpoint_inspect.go +++ b/api/http/handler/endpoints/endpoint_inspect.go @@ -11,16 +11,16 @@ import ( ) // @id EndpointInspect -// @summary Inspect an endpoint -// @description Retrieve details about an endpoint. +// @summary Inspect an environment(endpoint) +// @description Retrieve details about an environment(endpoint). // @description **Access policy**: restricted // @tags endpoints // @security jwt // @produce json -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @success 200 {object} portainer.Endpoint "Success" // @failure 400 "Invalid request" -// @failure 404 "Endpoint not found" +// @failure 404 "Environment(Endpoint) not found" // @failure 500 "Server error" // @router /endpoints/{id} [get] func (handler *Handler) endpointInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/endpoints/endpoint_list.go b/api/http/handler/endpoints/endpoint_list.go index 6fd549a2d..d87c278bd 100644 --- a/api/http/handler/endpoints/endpoint_list.go +++ b/api/http/handler/endpoints/endpoint_list.go @@ -14,22 +14,22 @@ import ( ) // @id EndpointList -// @summary List endpoints -// @description List all endpoints based on the current user authorizations. Will -// @description return all endpoints if using an administrator account otherwise it will -// @description only return authorized endpoints. +// @summary List environments(endpoints) +// @description List all environments(endpoints) based on the current user authorizations. Will +// @description return all environments(endpoints) if using an administrator account otherwise it will +// @description only return authorized environments(endpoints). // @description **Access policy**: restricted // @tags endpoints // @security jwt // @produce json // @param start query int false "Start searching from" // @param search query string false "Search query" -// @param groupId query int false "List endpoints of this group" +// @param groupId query int false "List environments(endpoints) of this group" // @param limit query int false "Limit results to this value" -// @param types query []int false "List endpoints of this type" -// @param tagIds query []int false "search endpoints with these tags (depends on tagsPartialMatch)" -// @param tagsPartialMatch query bool false "If true, will return endpoint which has one of tagIds, if false (or missing) will return only endpoints that has all the tags" -// @param endpointIds query []int false "will return only these endpoints" +// @param types query []int false "List environments(endpoints) of this type" +// @param tagIds query []int false "search environments(endpoints) with these tags (depends on tagsPartialMatch)" +// @param tagsPartialMatch query bool false "If true, will return environment(endpoint) which has one of tagIds, if false (or missing) will return only environments(endpoints) that has all the tags" +// @param endpointIds query []int false "will return only these environments(endpoints)" // @success 200 {array} portainer.Endpoint "Endpoints" // @failure 500 "Server error" // @router /endpoints [get] diff --git a/api/http/handler/endpoints/endpoint_settings_update.go b/api/http/handler/endpoints/endpoint_settings_update.go index 1770f5d68..0950f2d24 100644 --- a/api/http/handler/endpoints/endpoint_settings_update.go +++ b/api/http/handler/endpoints/endpoint_settings_update.go @@ -36,18 +36,18 @@ func (payload *endpointSettingsUpdatePayload) Validate(r *http.Request) error { } // @id EndpointSettingsUpdate -// @summary Update settings for an endpoint -// @description Update settings for an endpoint. +// @summary Update settings for an environments(endpoints) +// @description Update settings for an environments(endpoints). // @description **Access policy**: administrator // @security jwt // @tags endpoints // @accept json // @produce json -// @param id path int true "Endpoint identifier" -// @param body body endpointSettingsUpdatePayload true "Endpoint details" +// @param id path int true "Environment(Endpoint) identifier" +// @param body body endpointSettingsUpdatePayload true "Environment(Endpoint) details" // @success 200 {object} portainer.Endpoint "Success" // @failure 400 "Invalid request" -// @failure 404 "Endpoint not found" +// @failure 404 "Environment(Endpoint) not found" // @failure 500 "Server error" // @router /api/endpoints/{id}/settings [put] func (handler *Handler) endpointSettingsUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/endpoints/endpoint_snapshot.go b/api/http/handler/endpoints/endpoint_snapshot.go index 67930cfe3..8d9ed811c 100644 --- a/api/http/handler/endpoints/endpoint_snapshot.go +++ b/api/http/handler/endpoints/endpoint_snapshot.go @@ -12,15 +12,15 @@ import ( ) // @id EndpointSnapshot -// @summary Snapshots an endpoint -// @description Snapshots an endpoint +// @summary Snapshots an environments(endpoints) +// @description Snapshots an environments(endpoints) // @description **Access policy**: restricted // @tags endpoints // @security jwt -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @success 204 "Success" // @failure 400 "Invalid request" -// @failure 404 "Endpoint not found" +// @failure 404 "Environment(Endpoint) not found" // @failure 500 "Server error" // @router /endpoints/{id}/snapshot [post] func (handler *Handler) endpointSnapshot(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/endpoints/endpoint_snapshots.go b/api/http/handler/endpoints/endpoint_snapshots.go index 7ccf379ff..67aea973e 100644 --- a/api/http/handler/endpoints/endpoint_snapshots.go +++ b/api/http/handler/endpoints/endpoint_snapshots.go @@ -11,8 +11,8 @@ import ( ) // @id EndpointSnapshots -// @summary Snapshot all endpoints -// @description Snapshot all endpoints +// @summary Snapshot all environments(endpoints) +// @description Snapshot all environments(endpoints) // @description **Access policy**: administrator // @tags endpoints // @security jwt diff --git a/api/http/handler/endpoints/endpoint_status_inspect.go b/api/http/handler/endpoints/endpoint_status_inspect.go index 390517251..9aa9bc4aa 100644 --- a/api/http/handler/endpoints/endpoint_status_inspect.go +++ b/api/http/handler/endpoints/endpoint_status_inspect.go @@ -35,31 +35,31 @@ type edgeJobResponse struct { } type endpointStatusInspectResponse struct { - // Status represents the endpoint status + // Status represents the environment(endpoint) status Status string `json:"status" example:"REQUIRED"` // The tunnel port Port int `json:"port" example:"8732"` - // List of requests for jobs to run on the endpoint + // List of requests for jobs to run on the environment(endpoint) Schedules []edgeJobResponse `json:"schedules"` // The current value of CheckinInterval CheckinInterval int `json:"checkin" example:"5"` // Credentials string `json:"credentials" example:""` - // List of stacks to be deployed on the endpoints + // List of stacks to be deployed on the environments(endpoints) Stacks []stackStatusResponse `json:"stacks"` } // @id EndpointStatusInspect -// @summary Get endpoint status -// @description Endpoint for edge agent to check status of environment -// @description **Access policy**: restricted only to Edge endpoints +// @summary Get environment(endpoint) status +// @description Environment(Endpoint) for edge agent to check status of environment(endpoint) +// @description **Access policy**: restricted only to Edge environments(endpoints) // @tags endpoints // @security jwt -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @success 200 {object} endpointStatusInspectResponse "Success" // @failure 400 "Invalid request" -// @failure 403 "Permission denied to access endpoint" -// @failure 404 "Endpoint not found" +// @failure 403 "Permission denied to access environment(endpoint)" +// @failure 404 "Environment(Endpoint) not found" // @failure 500 "Server error" // @router /endpoints/{id}/status [get] func (handler *Handler) endpointStatusInspect(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/endpoints/endpoint_update.go b/api/http/handler/endpoints/endpoint_update.go index 91edd1d2c..dfef69542 100644 --- a/api/http/handler/endpoints/endpoint_update.go +++ b/api/http/handler/endpoints/endpoint_update.go @@ -16,8 +16,8 @@ import ( ) type endpointUpdatePayload struct { - // Name that will be used to identify this endpoint - Name *string `example:"my-endpoint"` + // Name that will be used to identify this environment(endpoint) + Name *string `example:"my-environment"` // URL or IP address of a Docker host URL *string `example:"docker.mydomain.tld:2375"` // URL or IP address where exposed containers will be reachable.\ @@ -25,13 +25,13 @@ type endpointUpdatePayload struct { PublicURL *string `example:"docker.mydomain.tld:2375"` // Group identifier GroupID *int `example:"1"` - // Require TLS to connect against this endpoint + // Require TLS to connect against this environment(endpoint) TLS *bool `example:"true"` // Skip server verification when using TLS TLSSkipVerify *bool `example:"false"` // Skip client verification when using TLS TLSSkipClientVerify *bool `example:"false"` - // The status of the endpoint (1 - up, 2 - down) + // The status of the environment(endpoint) (1 - up, 2 - down) Status *int `example:"1"` // Azure application ID AzureApplicationID *string `example:"eag7cdo9-o09l-9i83-9dO9-f0b23oe78db4"` @@ -39,7 +39,7 @@ type endpointUpdatePayload struct { AzureTenantID *string `example:"34ddc78d-4fel-2358-8cc1-df84c8o839f5"` // Azure authentication key AzureAuthenticationKey *string `example:"cOrXoK/1D35w8YQ8nH1/8ZGwzz45JIYD5jxHKXEQknk="` - // List of tag identifiers to which this endpoint is associated + // List of tag identifiers to which this environment(endpoint) is associated TagIDs []portainer.TagID `example:"1,2"` UserAccessPolicies portainer.UserAccessPolicies TeamAccessPolicies portainer.TeamAccessPolicies @@ -54,18 +54,18 @@ func (payload *endpointUpdatePayload) Validate(r *http.Request) error { } // @id EndpointUpdate -// @summary Update an endpoint -// @description Update an endpoint. +// @summary Update an environment(endpoint) +// @description Update an environment(endpoint). // @description **Access policy**: administrator // @security jwt // @tags endpoints // @accept json // @produce json -// @param id path int true "Endpoint identifier" -// @param body body endpointUpdatePayload true "Endpoint details" +// @param id path int true "Environment(Endpoint) identifier" +// @param body body endpointUpdatePayload true "Environment(Endpoint) details" // @success 200 {object} portainer.Endpoint "Success" // @failure 400 "Invalid request" -// @failure 404 "Endpoint not found" +// @failure 404 "Environment(Endpoint) not found" // @failure 500 "Server error" // @router /endpoints/{id} [put] func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/endpoints/handler.go b/api/http/handler/endpoints/handler.go index 592134d1f..ee2a94794 100644 --- a/api/http/handler/endpoints/handler.go +++ b/api/http/handler/endpoints/handler.go @@ -20,7 +20,7 @@ func hideFields(endpoint *portainer.Endpoint) { } } -// Handler is the HTTP handler used to handle endpoint operations. +// Handler is the HTTP handler used to handle environment(endpoint) operations. type Handler struct { *mux.Router requestBouncer *security.RequestBouncer @@ -36,7 +36,7 @@ type Handler struct { BindAddressHTTPS string } -// NewHandler creates a handler to manage endpoint operations. +// NewHandler creates a handler to manage environment(endpoint) operations. func NewHandler(bouncer *security.RequestBouncer) *Handler { h := &Handler{ Router: mux.NewRouter(), diff --git a/api/http/handler/handler.go b/api/http/handler/handler.go index 764a83830..e2d6bcc77 100644 --- a/api/http/handler/handler.go +++ b/api/http/handler/handler.go @@ -102,11 +102,11 @@ type Handler struct { // @tag.name edge_templates // @tag.description Manage Edge Templates // @tag.name edge -// @tag.description Manage Edge related endpoint settings +// @tag.description Manage Edge related environment(endpoint) settings // @tag.name endpoints -// @tag.description Manage Docker environments +// @tag.description Manage Docker environments(endpoints) // @tag.name endpoint_groups -// @tag.description Manage endpoint groups +// @tag.description Manage environment(endpoint) groups // @tag.name kubernetes // @tag.description Manage Kubernetes cluster // @tag.name motd diff --git a/api/http/handler/helm/handler.go b/api/http/handler/helm/handler.go index 106992e20..ed72fe7ec 100644 --- a/api/http/handler/helm/handler.go +++ b/api/http/handler/helm/handler.go @@ -21,7 +21,7 @@ type requestBouncer interface { AuthenticatedAccess(h http.Handler) http.Handler } -// Handler is the HTTP handler used to handle endpoint group operations. +// Handler is the HTTP handler used to handle environment(endpoint) group operations. type Handler struct { *mux.Router requestBouncer requestBouncer @@ -30,7 +30,7 @@ type Handler struct { helmPackageManager libhelm.HelmPackageManager } -// NewHandler creates a handler to manage endpoint group operations. +// NewHandler creates a handler to manage environment(endpoint) group operations. func NewHandler(bouncer requestBouncer, dataStore portainer.DataStore, helmPackageManager libhelm.HelmPackageManager, kubeConfigService kubernetes.KubeConfigService) *Handler { h := &Handler{ Router: mux.NewRouter(), @@ -62,7 +62,7 @@ func NewHandler(bouncer requestBouncer, dataStore portainer.DataStore, helmPacka return h } -// NewTemplateHandler creates a template handler to manage endpoint group operations. +// NewTemplateHandler creates a template handler to manage environment(endpoint) group operations. func NewTemplateHandler(bouncer requestBouncer, helmPackageManager libhelm.HelmPackageManager) *Handler { h := &Handler{ Router: mux.NewRouter(), @@ -86,7 +86,7 @@ func NewTemplateHandler(bouncer requestBouncer, helmPackageManager libhelm.HelmP func (handler *Handler) getHelmClusterAccess(r *http.Request) (*options.KubernetesClusterAccess, *httperror.HandlerError) { endpoint, err := middlewares.FetchEndpoint(r) if err != nil { - return nil, &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint on request context", err} + return nil, &httperror.HandlerError{http.StatusNotFound, "Unable to find an environment on request context", err} } bearerToken, err := security.ExtractBearerToken(r) diff --git a/api/http/handler/helm/helm_delete.go b/api/http/handler/helm/helm_delete.go index c4a9234fe..e3bfe6a4e 100644 --- a/api/http/handler/helm/helm_delete.go +++ b/api/http/handler/helm/helm_delete.go @@ -17,13 +17,13 @@ import ( // @security jwt // @accept json // @produce json -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @param release path string true "The name of the release/application to uninstall" // @param namespace query string true "An optional namespace" // @success 204 "Success" -// @failure 400 "Invalid endpoint id or bad request" +// @failure 400 "Invalid environment(endpoint) id or bad request" // @failure 401 "Unauthorized" -// @failure 404 "Endpoint or ServiceAccount not found" +// @failure 404 "Environment(Endpoint) or ServiceAccount not found" // @failure 500 "Server error or helm error" // @router /endpoints/{id}/kubernetes/helm/{release} [delete] func (handler *Handler) helmDelete(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/helm/helm_delete_test.go b/api/http/handler/helm/helm_delete_test.go index 5b7babc61..6c83b788c 100644 --- a/api/http/handler/helm/helm_delete_test.go +++ b/api/http/handler/helm/helm_delete_test.go @@ -24,7 +24,7 @@ func Test_helmDelete(t *testing.T) { defer teardown() err := store.Endpoint().CreateEndpoint(&portainer.Endpoint{ID: 1}) - is.NoError(err, "Error creating endpoint") + is.NoError(err, "Error creating environment") err = store.User().CreateUser(&portainer.User{Username: "admin", Role: portainer.AdministratorRole}) is.NoError(err, "Error creating a user") diff --git a/api/http/handler/helm/helm_install.go b/api/http/handler/helm/helm_install.go index bf89e99f2..3985a39f8 100644 --- a/api/http/handler/helm/helm_install.go +++ b/api/http/handler/helm/helm_install.go @@ -36,11 +36,11 @@ var errChartNameInvalid = errors.New("invalid chart name. " + // @security jwt // @accept json // @produce json -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @param payload body installChartPayload true "Chart details" // @success 201 {object} release.Release "Created" // @failure 401 "Unauthorized" -// @failure 404 "Endpoint or ServiceAccount not found" +// @failure 404 "Environment(Endpoint) or ServiceAccount not found" // @failure 500 "Server error" // @router /endpoints/{id}/kubernetes/helm [post] func (handler *Handler) helmInstall(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/helm/helm_install_test.go b/api/http/handler/helm/helm_install_test.go index f671a067f..b98ecd32f 100644 --- a/api/http/handler/helm/helm_install_test.go +++ b/api/http/handler/helm/helm_install_test.go @@ -26,7 +26,7 @@ func Test_helmInstall(t *testing.T) { defer teardown() err := store.Endpoint().CreateEndpoint(&portainer.Endpoint{ID: 1}) - is.NoError(err, "error creating endpoint") + is.NoError(err, "error creating environment") err = store.User().CreateUser(&portainer.User{Username: "admin", Role: portainer.AdministratorRole}) is.NoError(err, "error creating a user") diff --git a/api/http/handler/helm/helm_list.go b/api/http/handler/helm/helm_list.go index 26246920a..d559af9c6 100644 --- a/api/http/handler/helm/helm_list.go +++ b/api/http/handler/helm/helm_list.go @@ -17,14 +17,14 @@ import ( // @security jwt // @accept json // @produce json -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @param namespace query string true "specify an optional namespace" // @param filter query string true "specify an optional filter" // @param selector query string true "specify an optional selector" // @success 200 {array} release.ReleaseElement "Success" -// @failure 400 "Invalid endpoint identifier" +// @failure 400 "Invalid environment(endpoint) identifier" // @failure 401 "Unauthorized" -// @failure 404 "Endpoint or ServiceAccount not found" +// @failure 404 "Environment(Endpoint) or ServiceAccount not found" // @failure 500 "Server error" // @router /endpoints/{id}/kubernetes/helm [get] func (handler *Handler) helmList(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/helm/helm_list_test.go b/api/http/handler/helm/helm_list_test.go index 9aa7d29d3..cc50a24aa 100644 --- a/api/http/handler/helm/helm_list_test.go +++ b/api/http/handler/helm/helm_list_test.go @@ -23,7 +23,7 @@ func Test_helmList(t *testing.T) { defer teardown() err := store.Endpoint().CreateEndpoint(&portainer.Endpoint{ID: 1}) - assert.NoError(t, err, "error creating endpoint") + assert.NoError(t, err, "error creating environment") err = store.User().CreateUser(&portainer.User{Username: "admin", Role: portainer.AdministratorRole}) assert.NoError(t, err, "error creating a user") diff --git a/api/http/handler/helm/helm_show.go b/api/http/handler/helm/helm_show.go index 5ae2017ab..5ecfcffae 100644 --- a/api/http/handler/helm/helm_show.go +++ b/api/http/handler/helm/helm_show.go @@ -25,7 +25,7 @@ import ( // @produce text/plain // @success 200 {object} string "Success" // @failure 401 "Unauthorized" -// @failure 404 "Endpoint or ServiceAccount not found" +// @failure 404 "Environment(Endpoint) or ServiceAccount not found" // @failure 500 "Server error" // @router /templates/helm/{command} [get] func (handler *Handler) helmShow(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/helm/user_helm_repos.go b/api/http/handler/helm/user_helm_repos.go index 46eb65db7..d21584468 100644 --- a/api/http/handler/helm/user_helm_repos.go +++ b/api/http/handler/helm/user_helm_repos.go @@ -36,7 +36,7 @@ func (p *addHelmRepoUrlPayload) Validate(_ *http.Request) error { // @security jwt // @accept json // @produce json -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @param payload body addHelmRepoUrlPayload true "Helm Repository" // @success 200 {object} portainer.HelmUserRepository "Success" // @failure 400 "Invalid request" diff --git a/api/http/handler/kubernetes/handler.go b/api/http/handler/kubernetes/handler.go index f0a83ae6c..31cd0a5e2 100644 --- a/api/http/handler/kubernetes/handler.go +++ b/api/http/handler/kubernetes/handler.go @@ -14,7 +14,7 @@ import ( "github.com/portainer/portainer/api/kubernetes/cli" ) -// Handler is the HTTP handler which will natively deal with to external endpoints. +// Handler is the HTTP handler which will natively deal with to external environments(endpoints). type Handler struct { *mux.Router dataStore portainer.DataStore diff --git a/api/http/handler/kubernetes/kubernetes_config.go b/api/http/handler/kubernetes/kubernetes_config.go index a3a545753..df62601ed 100644 --- a/api/http/handler/kubernetes/kubernetes_config.go +++ b/api/http/handler/kubernetes/kubernetes_config.go @@ -22,12 +22,12 @@ import ( // @security jwt // @accept json // @produce json -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @success 200 "Success" // @failure 400 "Invalid request" // @failure 401 "Unauthorized" // @failure 403 "Permission denied" -// @failure 404 "Endpoint or ServiceAccount not found" +// @failure 404 "Environment(Endpoint) or ServiceAccount not found" // @failure 500 "Server error" // @router /kubernetes/{id}/config [get] func (handler *Handler) getKubernetesConfig(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/kubernetes/kubernetes_nodes_limits.go b/api/http/handler/kubernetes/kubernetes_nodes_limits.go index 09a64b116..7bcaed27b 100644 --- a/api/http/handler/kubernetes/kubernetes_nodes_limits.go +++ b/api/http/handler/kubernetes/kubernetes_nodes_limits.go @@ -18,12 +18,12 @@ import ( // @security jwt // @accept json // @produce json -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @success 200 {object} portainer.K8sNodesLimits "Success" // @failure 400 "Invalid request" // @failure 401 "Unauthorized" // @failure 403 "Permission denied" -// @failure 404 "Endpoint not found" +// @failure 404 "Environment(Endpoint) not found" // @failure 500 "Server error" // @router /kubernetes/{id}/nodes_limits [get] func (handler *Handler) getKubernetesNodesLimits(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/kubernetes/namespaces_toggle_system.go b/api/http/handler/kubernetes/namespaces_toggle_system.go index 8caad850f..52948a08f 100644 --- a/api/http/handler/kubernetes/namespaces_toggle_system.go +++ b/api/http/handler/kubernetes/namespaces_toggle_system.go @@ -21,16 +21,16 @@ func (payload *namespacesToggleSystemPayload) Validate(r *http.Request) error { // @id KubernetesNamespacesToggleSystem // @summary Toggle the system state for a namespace // @description Toggle the system state for a namespace -// @description **Access policy**: administrator or endpoint admin +// @description **Access policy**: administrator or environment(endpoint) admin // @security jwt // @tags kubernetes // @accept json -// @param id path int true "Endpoint identifier" +// @param id path int true "Environment(Endpoint) identifier" // @param namespace path string true "Namespace name" // @param body body namespacesToggleSystemPayload true "Update details" // @success 200 "Success" // @failure 400 "Invalid request" -// @failure 404 "Endpoint not found" +// @failure 404 "Environment(Endpoint) not found" // @failure 500 "Server error" // @router /kubernetes/{id}/namespaces/{namespace}/system [put] func (handler *Handler) namespacesToggleSystem(rw http.ResponseWriter, r *http.Request) *httperror.HandlerError { diff --git a/api/http/handler/settings/settings_update.go b/api/http/handler/settings/settings_update.go index aa02524ab..7d8fde4fc 100644 --- a/api/http/handler/settings/settings_update.go +++ b/api/http/handler/settings/settings_update.go @@ -24,7 +24,7 @@ type settingsUpdatePayload struct { AuthenticationMethod *int `example:"1"` LDAPSettings *portainer.LDAPSettings `example:""` OAuthSettings *portainer.OAuthSettings `example:""` - // The interval in which endpoint snapshots are created + // The interval in which environment(endpoint) snapshots are created SnapshotInterval *string `example:"5m"` // URL to the templates that will be displayed in the UI when navigating to App Templates TemplatesURL *string `example:"https://raw.githubusercontent.com/portainer/templates/master/templates.json"` diff --git a/api/http/handler/stacks/create_compose_stack.go b/api/http/handler/stacks/create_compose_stack.go index df78ca965..fe6d30c97 100644 --- a/api/http/handler/stacks/create_compose_stack.go +++ b/api/http/handler/stacks/create_compose_stack.go @@ -22,7 +22,7 @@ type composeStackFromFileContentPayload struct { Name string `example:"myStack" validate:"required"` // Content of the Stack file StackFileContent string `example:"version: 3\n services:\n web:\n image:nginx" validate:"required"` - // A list of environment variables used during stack deployment + // A list of environment(endpoint) variables used during stack deployment Env []portainer.Pair `example:""` } @@ -117,7 +117,7 @@ type composeStackFromGitRepositoryPayload struct { AdditionalFiles []string `example:"[nz.compose.yml, uat.compose.yml]"` // Optional auto update configuration AutoUpdate *portainer.StackAutoUpdate - // A list of environment variables used during stack deployment + // A list of environment(endpoint) variables used during stack deployment Env []portainer.Pair } diff --git a/api/http/handler/stacks/create_swarm_stack.go b/api/http/handler/stacks/create_swarm_stack.go index b2252b9af..7e615acc3 100644 --- a/api/http/handler/stacks/create_swarm_stack.go +++ b/api/http/handler/stacks/create_swarm_stack.go @@ -25,7 +25,7 @@ type swarmStackFromFileContentPayload struct { SwarmID string `example:"jpofkc0i9uo9wtx1zesuk649w" validate:"required"` // Content of the Stack file StackFileContent string `example:"version: 3\n services:\n web:\n image:nginx" validate:"required"` - // A list of environment variables used during stack deployment + // A list of environment(endpoint) variables used during stack deployment Env []portainer.Pair } @@ -109,7 +109,7 @@ type swarmStackFromGitRepositoryPayload struct { Name string `example:"myStack" validate:"required"` // Swarm cluster identifier SwarmID string `example:"jpofkc0i9uo9wtx1zesuk649w" validate:"required"` - // A list of environment variables used during stack deployment + // A list of environment(endpoint) variables used during stack deployment Env []portainer.Pair // URL of a Git repository hosting the Stack file diff --git a/api/http/handler/stacks/stack_create.go b/api/http/handler/stacks/stack_create.go index a4f96f89c..225dcb42d 100644 --- a/api/http/handler/stacks/stack_create.go +++ b/api/http/handler/stacks/stack_create.go @@ -32,7 +32,7 @@ func (handler *Handler) cleanUp(stack *portainer.Stack, doCleanUp *bool) error { // @id StackCreate // @summary Deploy a new stack -// @description Deploy a new stack into a Docker environment specified via the endpoint identifier. +// @description Deploy a new stack into a Docker environment(endpoint) specified via the environment(endpoint) identifier. // @description **Access policy**: restricted // @tags stacks // @security jwt @@ -40,14 +40,14 @@ func (handler *Handler) cleanUp(stack *portainer.Stack, doCleanUp *bool) error { // @produce json // @param type query int true "Stack deployment type. Possible values: 1 (Swarm stack) or 2 (Compose stack)." Enums(1,2) // @param method query string true "Stack deployment method. Possible values: file, string or repository." Enums(string, file, repository) -// @param endpointId query int true "Identifier of the endpoint that will be used to deploy the stack" +// @param endpointId query int true "Identifier of the environment(endpoint) that will be used to deploy the stack" // @param body_swarm_string body swarmStackFromFileContentPayload false "Required when using method=string and type=1" // @param body_swarm_repository body swarmStackFromGitRepositoryPayload false "Required when using method=repository and type=1" // @param body_compose_string body composeStackFromFileContentPayload false "Required when using method=string and type=2" // @param body_compose_repository body composeStackFromGitRepositoryPayload false "Required when using method=repository and type=2" // @param Name formData string false "Name of the stack. required when method is file" // @param SwarmID formData string false "Swarm cluster identifier. Required when method equals file and type equals 1. required when method is file" -// @param Env formData string false "Environment variables passed during deployment, represented as a JSON array [{'name': 'name', 'value': 'value'}]. Optional, used when method equals file and type equals 1." +// @param Env formData string false "Environment(Endpoint) variables passed during deployment, represented as a JSON array [{'name': 'name', 'value': 'value'}]. Optional, used when method equals file and type equals 1." // @param file formData file false "Stack file. required when method is file" // @success 200 {object} portainer.CustomTemplate // @failure 400 "Invalid request" diff --git a/api/http/handler/stacks/stack_delete.go b/api/http/handler/stacks/stack_delete.go index d2038459d..cd5e2cd26 100644 --- a/api/http/handler/stacks/stack_delete.go +++ b/api/http/handler/stacks/stack_delete.go @@ -24,7 +24,7 @@ import ( // @security jwt // @param id path int true "Stack identifier" // @param external query boolean false "Set to true to delete an external stack. Only external Swarm stacks are supported" -// @param endpointId query int false "Endpoint identifier used to remove an external stack (required when external is set to true)" +// @param endpointId query int false "Environment(Endpoint) identifier used to remove an external stack (required when external is set to true)" // @success 204 "Success" // @failure 400 "Invalid request" // @failure 403 "Permission denied" diff --git a/api/http/handler/stacks/stack_migrate.go b/api/http/handler/stacks/stack_migrate.go index cfca05944..c631f8fe3 100644 --- a/api/http/handler/stacks/stack_migrate.go +++ b/api/http/handler/stacks/stack_migrate.go @@ -16,7 +16,7 @@ import ( ) type stackMigratePayload struct { - // Endpoint identifier of the target endpoint where the stack will be relocated + // Environment(Endpoint) identifier of the target environment(endpoint) where the stack will be relocated EndpointID int `example:"2" validate:"required"` // Swarm cluster identifier, must match the identifier of the cluster where the stack will be relocated SwarmID string `example:"jpofkc0i9uo9wtx1zesuk649w"` @@ -32,14 +32,14 @@ func (payload *stackMigratePayload) Validate(r *http.Request) error { } // @id StackMigrate -// @summary Migrate a stack to another endpoint -// @description Migrate a stack from an endpoint to another endpoint. It will re-create the stack inside the target endpoint before removing the original stack. +// @summary Migrate a stack to another environment(endpoint) +// @description Migrate a stack from an environment(endpoint) to another environment(endpoint). It will re-create the stack inside the target environment(endpoint) before removing the original stack. // @description **Access policy**: restricted // @tags stacks // @security jwt // @produce json // @param id path int true "Stack identifier" -// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack." +// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack." // @param body body stackMigratePayload true "Stack migration details" // @success 200 {object} portainer.Stack "Success" // @failure 400 "Invalid request" @@ -99,8 +99,8 @@ func (handler *Handler) stackMigrate(w http.ResponseWriter, r *http.Request) *ht } // TODO: this is a work-around for stacks created with Portainer version >= 1.17.1 - // The EndpointID property is not available for these stacks, this API endpoint - // can use the optional EndpointID query parameter to associate a valid endpoint identifier to the stack. + // The EndpointID property is not available for these stacks, this API environment(endpoint) + // can use the optional EndpointID query parameter to associate a valid environment(endpoint) identifier to the stack. endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", true) if err != nil { return &httperror.HandlerError{http.StatusBadRequest, "Invalid query parameter: endpointId", err} diff --git a/api/http/handler/stacks/stack_update.go b/api/http/handler/stacks/stack_update.go index 49476fe7a..02147b546 100644 --- a/api/http/handler/stacks/stack_update.go +++ b/api/http/handler/stacks/stack_update.go @@ -21,7 +21,7 @@ import ( type updateComposeStackPayload struct { // New content of the Stack file StackFileContent string `example:"version: 3\n services:\n web:\n image:nginx"` - // A list of environment variables used during stack deployment + // A list of environment(endpoint) variables used during stack deployment Env []portainer.Pair } @@ -35,7 +35,7 @@ func (payload *updateComposeStackPayload) Validate(r *http.Request) error { type updateSwarmStackPayload struct { // New content of the Stack file StackFileContent string `example:"version: 3\n services:\n web:\n image:nginx"` - // A list of environment variables used during stack deployment + // A list of environment(endpoint) variables used during stack deployment Env []portainer.Pair // Prune services that are no longer referenced (only available for Swarm stacks) Prune bool `example:"true"` @@ -57,7 +57,7 @@ func (payload *updateSwarmStackPayload) Validate(r *http.Request) error { // @accept json // @produce json // @param id path int true "Stack identifier" -// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack." +// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack." // @param body body updateSwarmStackPayload true "Stack details" // @success 200 {object} portainer.Stack "Success" // @failure 400 "Invalid request" @@ -79,8 +79,8 @@ func (handler *Handler) stackUpdate(w http.ResponseWriter, r *http.Request) *htt } // TODO: this is a work-around for stacks created with Portainer version >= 1.17.1 - // The EndpointID property is not available for these stacks, this API endpoint - // can use the optional EndpointID query parameter to associate a valid endpoint identifier to the stack. + // The EndpointID property is not available for these stacks, this API environment(endpoint) + // can use the optional EndpointID query parameter to associate a valid environment(endpoint) identifier to the stack. endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", true) if err != nil { return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid query parameter: endpointId", Err: err} diff --git a/api/http/handler/stacks/stack_update_git.go b/api/http/handler/stacks/stack_update_git.go index 48b3b14d2..45576fe61 100644 --- a/api/http/handler/stacks/stack_update_git.go +++ b/api/http/handler/stacks/stack_update_git.go @@ -45,7 +45,7 @@ func (payload *stackGitUpdatePayload) Validate(r *http.Request) error { // @accept json // @produce json // @param id path int true "Stack identifier" -// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack." +// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack." // @param body body stackGitUpdatePayload true "Git configs for pull and redeploy a stack" // @success 200 {object} portainer.Stack "Success" // @failure 400 "Invalid request" @@ -76,8 +76,8 @@ func (handler *Handler) stackUpdateGit(w http.ResponseWriter, r *http.Request) * } // TODO: this is a work-around for stacks created with Portainer version >= 1.17.1 - // The EndpointID property is not available for these stacks, this API endpoint - // can use the optional EndpointID query parameter to associate a valid endpoint identifier to the stack. + // The EndpointID property is not available for these stacks, this API environment(endpoint) + // can use the optional EndpointID query parameter to associate a valid environment(endpoint) identifier to the stack. endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", true) if err != nil { return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid query parameter: endpointId", Err: err} diff --git a/api/http/handler/stacks/stack_update_git_redeploy.go b/api/http/handler/stacks/stack_update_git_redeploy.go index cebba9cdc..d5d87c4f0 100644 --- a/api/http/handler/stacks/stack_update_git_redeploy.go +++ b/api/http/handler/stacks/stack_update_git_redeploy.go @@ -46,7 +46,7 @@ func (payload *stackGitRedployPayload) Validate(r *http.Request) error { // @accept json // @produce json // @param id path int true "Stack identifier" -// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated endpoint identifier. Use this optional parameter to set the endpoint identifier used by the stack." +// @param endpointId query int false "Stacks created before version 1.18.0 might not have an associated environment(endpoint) identifier. Use this optional parameter to set the environment(endpoint) identifier used by the stack." // @param body body stackGitRedployPayload true "Git configs for pull and redeploy a stack" // @success 200 {object} portainer.Stack "Success" // @failure 400 "Invalid request" @@ -72,8 +72,8 @@ func (handler *Handler) stackGitRedeploy(w http.ResponseWriter, r *http.Request) } // TODO: this is a work-around for stacks created with Portainer version >= 1.17.1 - // The EndpointID property is not available for these stacks, this API endpoint - // can use the optional EndpointID query parameter to associate a valid endpoint identifier to the stack. + // The EndpointID property is not available for these stacks, this API environment(endpoint) + // can use the optional EndpointID query parameter to associate a valid environment(endpoint) identifier to the stack. endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", true) if err != nil { return &httperror.HandlerError{StatusCode: http.StatusBadRequest, Message: "Invalid query parameter: endpointId", Err: err} diff --git a/api/http/handler/upload/upload_tls.go b/api/http/handler/upload/upload_tls.go index a82d357db..f95942eb5 100644 --- a/api/http/handler/upload/upload_tls.go +++ b/api/http/handler/upload/upload_tls.go @@ -12,7 +12,7 @@ import ( // @id UploadTLS // @summary Upload TLS files -// @description Use this endpoint to upload TLS files. +// @description Use this environment(endpoint) to upload TLS files. // @description **Access policy**: administrator // @tags upload // @security jwt diff --git a/api/http/handler/websocket/attach.go b/api/http/handler/websocket/attach.go index ef7b13a8d..102cb35dc 100644 --- a/api/http/handler/websocket/attach.go +++ b/api/http/handler/websocket/attach.go @@ -15,7 +15,7 @@ import ( ) // @summary Attach a websocket -// @description If the nodeName query parameter is present, the request will be proxied to the underlying agent endpoint. +// @description If the nodeName query parameter is present, the request will be proxied to the underlying agent environment(endpoint). // @description If the nodeName query parameter is not specified, the request will be upgraded to the websocket protocol and // @description an AttachStart operation HTTP request will be created and hijacked. // @description Authentication and access is controlled via the mandatory token query parameter. @@ -23,9 +23,9 @@ import ( // @tags websocket // @accept json // @produce json -// @param endpointId query int true "endpoint ID of the endpoint where the resource is located" +// @param endpointId query int true "environment(endpoint) ID of the environment(endpoint) where the resource is located" // @param nodeName query string false "node name" -// @param token query string true "JWT token used for authentication against this endpoint" +// @param token query string true "JWT token used for authentication against this environment(endpoint)" // @success 200 // @failure 400 // @failure 403 diff --git a/api/http/handler/websocket/exec.go b/api/http/handler/websocket/exec.go index 149a15a15..023af618e 100644 --- a/api/http/handler/websocket/exec.go +++ b/api/http/handler/websocket/exec.go @@ -23,7 +23,7 @@ type execStartOperationPayload struct { } // @summary Execute a websocket -// @description If the nodeName query parameter is present, the request will be proxied to the underlying agent endpoint. +// @description If the nodeName query parameter is present, the request will be proxied to the underlying agent environment(endpoint). // @description If the nodeName query parameter is not specified, the request will be upgraded to the websocket protocol and // @description an ExecStart operation HTTP request will be created and hijacked. // @description Authentication and access is controlled via the mandatory token query parameter. @@ -31,9 +31,9 @@ type execStartOperationPayload struct { // @tags websocket // @accept json // @produce json -// @param endpointId query int true "endpoint ID of the endpoint where the resource is located" +// @param endpointId query int true "environment(endpoint) ID of the environment(endpoint) where the resource is located" // @param nodeName query string false "node name" -// @param token query string true "JWT token used for authentication against this endpoint" +// @param token query string true "JWT token used for authentication against this environment(endpoint)" // @success 200 // @failure 400 // @failure 409 diff --git a/api/http/handler/websocket/pod.go b/api/http/handler/websocket/pod.go index bd3dd0871..5b0022773 100644 --- a/api/http/handler/websocket/pod.go +++ b/api/http/handler/websocket/pod.go @@ -24,12 +24,12 @@ import ( // @tags websocket // @accept json // @produce json -// @param endpointId query int true "endpoint ID of the endpoint where the resource is located" +// @param endpointId query int true "environment(endpoint) ID of the environment(endpoint) where the resource is located" // @param namespace query string true "namespace where the container is located" // @param podName query string true "name of the pod containing the container" // @param containerName query string true "name of the container" // @param command query string true "command to execute in the container" -// @param token query string true "JWT token used for authentication against this endpoint" +// @param token query string true "JWT token used for authentication against this environment(endpoint)" // @success 200 // @failure 400 // @failure 403 diff --git a/api/http/handler/websocket/shell_pod.go b/api/http/handler/websocket/shell_pod.go index a2bb727a0..f736a7dc7 100644 --- a/api/http/handler/websocket/shell_pod.go +++ b/api/http/handler/websocket/shell_pod.go @@ -15,8 +15,8 @@ import ( // Authentication and access is controlled via the mandatory token query parameter. // The request will proxy input from the client to the pod via long-lived websocket connection. // The following query parameters are mandatory: -// * token: JWT token used for authentication against this endpoint -// * endpointId: endpoint ID of the endpoint where the resource is located +// * token: JWT token used for authentication against this environment(endpoint) +// * endpointId: environment(endpoint) ID of the environment(endpoint) where the resource is located func (handler *Handler) websocketShellPodExec(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { endpointID, err := request.RetrieveNumericQueryParameter(r, "endpointId", false) if err != nil { diff --git a/api/http/proxy/factory/factory.go b/api/http/proxy/factory/factory.go index 1e6f83d40..dc0e9e0c4 100644 --- a/api/http/proxy/factory/factory.go +++ b/api/http/proxy/factory/factory.go @@ -51,7 +51,7 @@ func (factory *ProxyFactory) NewLegacyExtensionProxy(extensionAPIURL string) (ht return proxy, nil } -// NewEndpointProxy returns a new reverse proxy (filesystem based or HTTP) to an endpoint API server +// NewEndpointProxy returns a new reverse proxy (filesystem based or HTTP) to an environment(endpoint) API server func (factory *ProxyFactory) NewEndpointProxy(endpoint *portainer.Endpoint) (http.Handler, error) { switch endpoint.Type { case portainer.AzureEnvironment: diff --git a/api/http/proxy/manager.go b/api/http/proxy/manager.go index 2013647d8..36951ccd7 100644 --- a/api/http/proxy/manager.go +++ b/api/http/proxy/manager.go @@ -17,7 +17,7 @@ import ( // TODO: contain code related to legacy extension management type ( - // Manager represents a service used to manage proxies to endpoints and extensions. + // Manager represents a service used to manage proxies to environments(endpoints) and extensions. Manager struct { proxyFactory *factory.ProxyFactory endpointProxies cmap.ConcurrentMap @@ -36,7 +36,7 @@ func NewManager(dataStore portainer.DataStore, signatureService portainer.Digita } } -// CreateAndRegisterEndpointProxy creates a new HTTP reverse proxy based on endpoint properties and and adds it to the registered proxies. +// CreateAndRegisterEndpointProxy creates a new HTTP reverse proxy based on environment(endpoint) properties and and adds it to the registered proxies. // It can also be used to create a new HTTP reverse proxy and replace an already registered proxy. func (manager *Manager) CreateAndRegisterEndpointProxy(endpoint *portainer.Endpoint) (http.Handler, error) { proxy, err := manager.proxyFactory.NewEndpointProxy(endpoint) @@ -48,7 +48,7 @@ func (manager *Manager) CreateAndRegisterEndpointProxy(endpoint *portainer.Endpo return proxy, nil } -// CreateComposeProxyServer creates a new HTTP reverse proxy based on endpoint properties and and adds it to the registered proxies. +// CreateComposeProxyServer creates a new HTTP reverse proxy based on environment(endpoint) properties and and adds it to the registered proxies. // It can also be used to create a new HTTP reverse proxy and replace an already registered proxy. func (manager *Manager) CreateComposeProxyServer(endpoint *portainer.Endpoint) (*factory.ProxyServer, error) { return manager.proxyFactory.NewDockerComposeAgentProxy(endpoint) @@ -65,7 +65,7 @@ func (manager *Manager) GetEndpointProxy(endpoint *portainer.Endpoint) http.Hand } // DeleteEndpointProxy deletes the proxy associated to a key -// and cleans the k8s endpoint client cache. DeleteEndpointProxy +// and cleans the k8s environment(endpoint) client cache. DeleteEndpointProxy // is currently only called for edge connection clean up. func (manager *Manager) DeleteEndpointProxy(endpoint *portainer.Endpoint) { manager.endpointProxies.Remove(fmt.Sprint(endpoint.ID)) diff --git a/api/http/security/authorization.go b/api/http/security/authorization.go index f205a6493..5be89aad3 100644 --- a/api/http/security/authorization.go +++ b/api/http/security/authorization.go @@ -103,9 +103,9 @@ func AuthorizedTeamManagement(teamID portainer.TeamID, context *RestrictedReques return false } -// authorizedEndpointAccess ensure that the user can access the specified endpoint. +// authorizedEndpointAccess ensure that the user can access the specified environment(endpoint). // It will check if the user is part of the authorized users or part of a team that is -// listed in the authorized teams of the endpoint and the associated group. +// listed in the authorized teams of the environment(endpoint) and the associated group. func authorizedEndpointAccess(endpoint *portainer.Endpoint, endpointGroup *portainer.EndpointGroup, userID portainer.UserID, memberships []portainer.TeamMembership) bool { groupAccess := AuthorizedAccess(userID, memberships, endpointGroup.UserAccessPolicies, endpointGroup.TeamAccessPolicies) if !groupAccess { @@ -114,7 +114,7 @@ func authorizedEndpointAccess(endpoint *portainer.Endpoint, endpointGroup *porta return true } -// authorizedEndpointGroupAccess ensure that the user can access the specified endpoint group. +// authorizedEndpointGroupAccess ensure that the user can access the specified environment(endpoint) group. // It will check if the user is part of the authorized users or part of a team that is // listed in the authorized teams. func authorizedEndpointGroupAccess(endpointGroup *portainer.EndpointGroup, userID portainer.UserID, memberships []portainer.TeamMembership) bool { @@ -123,7 +123,7 @@ func authorizedEndpointGroupAccess(endpointGroup *portainer.EndpointGroup, userI // AuthorizedRegistryAccess ensure that the user can access the specified registry. // It will check if the user is part of the authorized users or part of a team that is -// listed in the authorized teams for a specified endpoint, +// listed in the authorized teams for a specified environment(endpoint), func AuthorizedRegistryAccess(registry *portainer.Registry, user *portainer.User, teamMemberships []portainer.TeamMembership, endpointID portainer.EndpointID) bool { if user.Role == portainer.AdministratorRole { return true diff --git a/api/http/security/bouncer.go b/api/http/security/bouncer.go index ace0197f8..d4c772284 100644 --- a/api/http/security/bouncer.go +++ b/api/http/security/bouncer.go @@ -36,16 +36,16 @@ func NewRequestBouncer(dataStore portainer.DataStore, jwtService portainer.JWTSe } } -// PublicAccess defines a security check for public API endpoints. -// No authentication is required to access these endpoints. +// PublicAccess defines a security check for public API environments(endpoints). +// No authentication is required to access these environments(endpoints). func (bouncer *RequestBouncer) PublicAccess(h http.Handler) http.Handler { h = mwSecureHeaders(h) return h } -// AdminAccess defines a security check for API endpoints that require an authorization check. -// Authentication is required to access these endpoints. -// The administrator role is required to use these endpoints. +// AdminAccess defines a security check for API environments(endpoints) that require an authorization check. +// Authentication is required to access these environments(endpoints). +// The administrator role is required to use these environments(endpoints). // The request context will be enhanced with a RestrictedRequestContext object // that might be used later to inside the API operation for extra authorization validation // and resource filtering. @@ -56,8 +56,8 @@ func (bouncer *RequestBouncer) AdminAccess(h http.Handler) http.Handler { return h } -// RestrictedAccess defines a security check for restricted API endpoints. -// Authentication is required to access these endpoints. +// RestrictedAccess defines a security check for restricted API environments(endpoints). +// Authentication is required to access these environments(endpoints). // The request context will be enhanced with a RestrictedRequestContext object // that might be used later to inside the API operation for extra authorization validation // and resource filtering. @@ -68,8 +68,8 @@ func (bouncer *RequestBouncer) RestrictedAccess(h http.Handler) http.Handler { return h } -// AuthenticatedAccess defines a security check for restricted API endpoints. -// Authentication is required to access these endpoints. +// AuthenticatedAccess defines a security check for restricted API environments(endpoints). +// Authentication is required to access these environments(endpoints). // The request context will be enhanced with a RestrictedRequestContext object // that might be used later to inside the API operation for extra authorization validation // and resource filtering. @@ -80,8 +80,8 @@ func (bouncer *RequestBouncer) AuthenticatedAccess(h http.Handler) http.Handler } // AuthorizedEndpointOperation retrieves the JWT token from the request context and verifies -// that the user can access the specified endpoint. -// An error is returned when access to the endpoint is denied or if the user do not have the required +// that the user can access the specified environment(endpoint). +// An error is returned when access to the environments(endpoints) is denied or if the user do not have the required // authorization to execute the operation. func (bouncer *RequestBouncer) AuthorizedEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error { tokenData, err := RetrieveTokenData(r) @@ -110,7 +110,7 @@ func (bouncer *RequestBouncer) AuthorizedEndpointOperation(r *http.Request, endp return nil } -// AuthorizedEdgeEndpointOperation verifies that the request was received from a valid Edge endpoint +// AuthorizedEdgeEndpointOperation verifies that the request was received from a valid Edge environment(endpoint) func (bouncer *RequestBouncer) AuthorizedEdgeEndpointOperation(r *http.Request, endpoint *portainer.Endpoint) error { if endpoint.Type != portainer.EdgeAgentOnKubernetesEnvironment && endpoint.Type != portainer.EdgeAgentOnDockerEnvironment { return errors.New("Invalid environment type") @@ -138,9 +138,9 @@ func (bouncer *RequestBouncer) mwAuthenticatedUser(h http.Handler) http.Handler } // mwCheckPortainerAuthorizations will verify that the user has the required authorization to access -// a specific API endpoint. +// a specific API environment(endpoint). // If the administratorOnly flag is specified, this will prevent non-admin -// users from accessing the endpoint. +// users from accessing the environment(endpoint). func (bouncer *RequestBouncer) mwCheckPortainerAuthorizations(next http.Handler, administratorOnly bool) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { tokenData, err := RetrieveTokenData(r) diff --git a/api/http/security/filter.go b/api/http/security/filter.go index be0106447..f784827dd 100644 --- a/api/http/security/filter.go +++ b/api/http/security/filter.go @@ -80,8 +80,8 @@ func FilterRegistries(registries []portainer.Registry, user *portainer.User, tea return filteredRegistries } -// FilterEndpoints filters endpoints based on user role and team memberships. -// Non administrator users only have access to authorized endpoints (can be inherited via endoint groups). +// FilterEndpoints filters environments(endpoints) based on user role and team memberships. +// Non administrator users only have access to authorized environments(endpoints) (can be inherited via endoint groups). func FilterEndpoints(endpoints []portainer.Endpoint, groups []portainer.EndpointGroup, context *RestrictedRequestContext) []portainer.Endpoint { filteredEndpoints := endpoints @@ -100,8 +100,8 @@ func FilterEndpoints(endpoints []portainer.Endpoint, groups []portainer.Endpoint return filteredEndpoints } -// FilterEndpointGroups filters endpoint groups based on user role and team memberships. -// Non administrator users only have access to authorized endpoint groups. +// FilterEndpointGroups filters environment(endpoint) groups based on user role and team memberships. +// Non administrator users only have access to authorized environment(endpoint) groups. func FilterEndpointGroups(endpointGroups []portainer.EndpointGroup, context *RestrictedRequestContext) []portainer.EndpointGroup { filteredEndpointGroups := endpointGroups diff --git a/api/internal/authorization/authorizations.go b/api/internal/authorization/authorizations.go index 92eae802d..c2bfbe21a 100644 --- a/api/internal/authorization/authorizations.go +++ b/api/internal/authorization/authorizations.go @@ -19,8 +19,8 @@ func NewService(dataStore portainer.DataStore) *Service { } } -// DefaultEndpointAuthorizationsForEndpointAdministratorRole returns the default endpoint authorizations -// associated to the endpoint administrator role. +// DefaultEndpointAuthorizationsForEndpointAdministratorRole returns the default environment(endpoint) authorizations +// associated to the environment(endpoint) administrator role. func DefaultEndpointAuthorizationsForEndpointAdministratorRole() portainer.Authorizations { return map[portainer.Authorization]bool{ portainer.OperationDockerContainerArchiveInfo: true, @@ -157,7 +157,7 @@ func DefaultEndpointAuthorizationsForEndpointAdministratorRole() portainer.Autho } } -// DefaultEndpointAuthorizationsForHelpDeskRole returns the default endpoint authorizations +// DefaultEndpointAuthorizationsForHelpDeskRole returns the default environment(endpoint) authorizations // associated to the helpdesk role. func DefaultEndpointAuthorizationsForHelpDeskRole(volumeBrowsingAuthorizations bool) portainer.Authorizations { authorizations := map[portainer.Authorization]bool{ @@ -216,7 +216,7 @@ func DefaultEndpointAuthorizationsForHelpDeskRole(volumeBrowsingAuthorizations b return authorizations } -// DefaultEndpointAuthorizationsForStandardUserRole returns the default endpoint authorizations +// DefaultEndpointAuthorizationsForStandardUserRole returns the default environment(endpoint) authorizations // associated to the standard user role. func DefaultEndpointAuthorizationsForStandardUserRole(volumeBrowsingAuthorizations bool) portainer.Authorizations { authorizations := map[portainer.Authorization]bool{ @@ -350,7 +350,7 @@ func DefaultEndpointAuthorizationsForStandardUserRole(volumeBrowsingAuthorizatio return authorizations } -// DefaultEndpointAuthorizationsForReadOnlyUserRole returns the default endpoint authorizations +// DefaultEndpointAuthorizationsForReadOnlyUserRole returns the default environment(endpoint) authorizations // associated to the readonly user role. func DefaultEndpointAuthorizationsForReadOnlyUserRole(volumeBrowsingAuthorizations bool) portainer.Authorizations { authorizations := map[portainer.Authorization]bool{ diff --git a/api/internal/edge/edgegroup.go b/api/internal/edge/edgegroup.go index 0b0140acb..745f480ce 100644 --- a/api/internal/edge/edgegroup.go +++ b/api/internal/edge/edgegroup.go @@ -5,7 +5,7 @@ import ( "github.com/portainer/portainer/api/internal/tag" ) -// EdgeGroupRelatedEndpoints returns a list of endpoints related to this Edge group +// EdgeGroupRelatedEndpoints returns a list of environments(endpoints) related to this Edge group func EdgeGroupRelatedEndpoints(edgeGroup *portainer.EdgeGroup, endpoints []portainer.Endpoint, endpointGroups []portainer.EndpointGroup) []portainer.EndpointID { if !edgeGroup.Dynamic { return edgeGroup.Endpoints @@ -33,7 +33,7 @@ func EdgeGroupRelatedEndpoints(edgeGroup *portainer.EdgeGroup, endpoints []porta return endpointIDs } -// edgeGroupRelatedToEndpoint returns true is edgeGroup is associated with endpoint +// edgeGroupRelatedToEndpoint returns true is edgeGroup is associated with environment(endpoint) func edgeGroupRelatedToEndpoint(edgeGroup *portainer.EdgeGroup, endpoint *portainer.Endpoint, endpointGroup *portainer.EndpointGroup) bool { if !edgeGroup.Dynamic { for _, endpointID := range edgeGroup.Endpoints { diff --git a/api/internal/edge/edgejob.go b/api/internal/edge/edgejob.go index bbd55b8e1..5d2633158 100644 --- a/api/internal/edge/edgejob.go +++ b/api/internal/edge/edgejob.go @@ -2,7 +2,7 @@ package edge import portainer "github.com/portainer/portainer/api" -// LoadEdgeJobs registers all edge jobs inside corresponding endpoint tunnel +// LoadEdgeJobs registers all edge jobs inside corresponding environment(endpoint) tunnel func LoadEdgeJobs(dataStore portainer.DataStore, reverseTunnelService portainer.ReverseTunnelService) error { edgeJobs, err := dataStore.EdgeJob().EdgeJobs() if err != nil { diff --git a/api/internal/edge/edgestack.go b/api/internal/edge/edgestack.go index 6f4094e9d..10633598a 100644 --- a/api/internal/edge/edgestack.go +++ b/api/internal/edge/edgestack.go @@ -5,7 +5,7 @@ import ( "github.com/portainer/portainer/api" ) -// EdgeStackRelatedEndpoints returns a list of endpoints related to this Edge stack +// EdgeStackRelatedEndpoints returns a list of environments(endpoints) related to this Edge stack func EdgeStackRelatedEndpoints(edgeGroupIDs []portainer.EdgeGroupID, endpoints []portainer.Endpoint, endpointGroups []portainer.EndpointGroup, edgeGroups []portainer.EdgeGroup) ([]portainer.EndpointID, error) { edgeStackEndpoints := []portainer.EndpointID{} diff --git a/api/internal/edge/endpoint.go b/api/internal/edge/endpoint.go index 99d12bf60..b09fa5cca 100644 --- a/api/internal/edge/endpoint.go +++ b/api/internal/edge/endpoint.go @@ -2,7 +2,7 @@ package edge import "github.com/portainer/portainer/api" -// EndpointRelatedEdgeStacks returns a list of Edge stacks related to this Endpoint +// EndpointRelatedEdgeStacks returns a list of Edge stacks related to this Environment(Endpoint) func EndpointRelatedEdgeStacks(endpoint *portainer.Endpoint, endpointGroup *portainer.EndpointGroup, edgeGroups []portainer.EdgeGroup, edgeStacks []portainer.EdgeStack) []portainer.EdgeStackID { relatedEdgeGroupsSet := map[portainer.EdgeGroupID]bool{} diff --git a/api/internal/endpointutils/endpointutils.go b/api/internal/endpointutils/endpointutils.go index 3929ce4b3..2d6629f30 100644 --- a/api/internal/endpointutils/endpointutils.go +++ b/api/internal/endpointutils/endpointutils.go @@ -6,19 +6,19 @@ import ( portainer "github.com/portainer/portainer/api" ) -// IsLocalEndpoint returns true if this is a local endpoint +// IsLocalEndpoint returns true if this is a local environment(endpoint) func IsLocalEndpoint(endpoint *portainer.Endpoint) bool { return strings.HasPrefix(endpoint.URL, "unix://") || strings.HasPrefix(endpoint.URL, "npipe://") || endpoint.Type == 5 } -// IsKubernetesEndpoint returns true if this is a kubernetes endpoint +// IsKubernetesEndpoint returns true if this is a kubernetes environment(endpoint) func IsKubernetesEndpoint(endpoint *portainer.Endpoint) bool { return endpoint.Type == portainer.KubernetesLocalEnvironment || endpoint.Type == portainer.AgentOnKubernetesEnvironment || endpoint.Type == portainer.EdgeAgentOnKubernetesEnvironment } -// IsDockerEndpoint returns true if this is a docker endpoint +// IsDockerEndpoint returns true if this is a docker environment(endpoint) func IsDockerEndpoint(endpoint *portainer.Endpoint) bool { return endpoint.Type == portainer.DockerEnvironment || endpoint.Type == portainer.AgentOnDockerEnvironment || diff --git a/api/internal/snapshot/snapshot.go b/api/internal/snapshot/snapshot.go index 2640958bb..dcfc197fd 100644 --- a/api/internal/snapshot/snapshot.go +++ b/api/internal/snapshot/snapshot.go @@ -9,9 +9,9 @@ import ( portainer "github.com/portainer/portainer/api" ) -// Service repesents a service to manage endpoint snapshots. +// Service repesents a service to manage environment(endpoint) snapshots. // It provides an interface to start background snapshots as well as -// specific Docker/Kubernetes endpoint snapshot methods. +// specific Docker/Kubernetes environment(endpoint) snapshot methods. type Service struct { dataStore portainer.DataStore refreshSignal chan struct{} @@ -37,7 +37,7 @@ func NewService(snapshotInterval string, dataStore portainer.DataStore, dockerSn }, nil } -// Start will start a background routine to execute periodic snapshots of endpoints +// Start will start a background routine to execute periodic snapshots of environments(endpoints) func (service *Service) Start() { if service.refreshSignal != nil { return @@ -72,8 +72,8 @@ func (service *Service) SetSnapshotInterval(snapshotInterval string) error { return nil } -// SupportDirectSnapshot checks whether an endpoint can be used to trigger a direct a snapshot. -// It is mostly true for all endpoints except Edge and Azure endpoints. +// SupportDirectSnapshot checks whether an environment(endpoint) can be used to trigger a direct a snapshot. +// It is mostly true for all environments(endpoints) except Edge and Azure environments(endpoints). func SupportDirectSnapshot(endpoint *portainer.Endpoint) bool { switch endpoint.Type { case portainer.EdgeAgentOnDockerEnvironment, portainer.EdgeAgentOnKubernetesEnvironment, portainer.AzureEnvironment: @@ -82,8 +82,8 @@ func SupportDirectSnapshot(endpoint *portainer.Endpoint) bool { return true } -// SnapshotEndpoint will create a snapshot of the endpoint based on the endpoint type. -// If the snapshot is a success, it will be associated to the endpoint. +// SnapshotEndpoint will create a snapshot of the environment(endpoint) based on the environment(endpoint) type. +// If the snapshot is a success, it will be associated to the environment(endpoint). func (service *Service) SnapshotEndpoint(endpoint *portainer.Endpoint) error { switch endpoint.Type { case portainer.AzureEnvironment: @@ -189,7 +189,7 @@ func (service *Service) snapshotEndpoints() error { return nil } -// FetchDockerID fetches info.Swarm.Cluster.ID if endpoint is swarm and info.ID otherwise +// FetchDockerID fetches info.Swarm.Cluster.ID if environment(endpoint) is swarm and info.ID otherwise func FetchDockerID(snapshot portainer.DockerSnapshot) (string, error) { info, done := snapshot.SnapshotRaw.Info.(map[string]interface{}) if !done { diff --git a/api/internal/testhelpers/datastore.go b/api/internal/testhelpers/datastore.go index c934691c2..f6d5786b1 100644 --- a/api/internal/testhelpers/datastore.go +++ b/api/internal/testhelpers/datastore.go @@ -233,7 +233,7 @@ func (s *stubEndpointService) GetNextIdentifier() int { return len(s.endpoints) } -// WithEndpoints option will instruct datastore to return provided endpoints +// WithEndpoints option will instruct datastore to return provided environments(endpoints) func WithEndpoints(endpoints []portainer.Endpoint) datastoreOption { return func(d *datastore) { d.endpoint = &stubEndpointService{endpoints: endpoints} diff --git a/api/kubernetes/cli/client.go b/api/kubernetes/cli/client.go index 85344ca36..9dafe3e5a 100644 --- a/api/kubernetes/cli/client.go +++ b/api/kubernetes/cli/client.go @@ -50,7 +50,7 @@ func (factory *ClientFactory) RemoveKubeClient(endpoint *portainer.Endpoint) { factory.endpointClients.Remove(strconv.Itoa(int(endpoint.ID))) } -// GetKubeClient checks if an existing client is already registered for the endpoint and returns it if one is found. +// GetKubeClient checks if an existing client is already registered for the environment(endpoint) and returns it if one is found. // If no client is registered, it will create a new client, register it, and returns it. func (factory *ClientFactory) GetKubeClient(endpoint *portainer.Endpoint) (portainer.KubeClient, error) { key := strconv.Itoa(int(endpoint.ID)) diff --git a/api/kubernetes/cli/exec.go b/api/kubernetes/cli/exec.go index f15e43c91..d8fdd4401 100644 --- a/api/kubernetes/cli/exec.go +++ b/api/kubernetes/cli/exec.go @@ -14,7 +14,7 @@ import ( // StartExecProcess will start an exec process inside a container located inside a pod inside a specific namespace // using the specified command. The stdin parameter will be bound to the stdin process and the stdout process will write // to the stdout parameter. -// This function only works against a local endpoint using an in-cluster config with the user's SA token. +// This function only works against a local environment(endpoint) using an in-cluster config with the user's SA token. // This is a blocking operation. func (kcl *KubeClient) StartExecProcess(token string, useAdminToken bool, namespace, podName, containerName string, command []string, stdin io.Reader, stdout io.Writer, errChan chan error) { config, err := rest.InClusterConfig() diff --git a/api/kubernetes/cli/kubeconfig.go b/api/kubernetes/cli/kubeconfig.go index 2f9c37fa0..c4ca71e28 100644 --- a/api/kubernetes/cli/kubeconfig.go +++ b/api/kubernetes/cli/kubeconfig.go @@ -25,7 +25,7 @@ func (kcl *KubeClient) GetKubeConfig(ctx context.Context, apiServerURL string, b } // generateKubeconfig will generate and return kubeconfig resource - usable by `kubectl` cli -// which will allow the client to connect directly to k8s server endpoint via portainer (proxy) +// which will allow the client to connect directly to k8s server environment(endpoint) via portainer (proxy) func generateKubeconfig(apiServerURL, bearerToken, serviceAccountName string) *clientV1.Config { const ( KubeConfigPortainerContext = "portainer-ctx" diff --git a/api/kubernetes/cli/nodes_limits.go b/api/kubernetes/cli/nodes_limits.go index 9e0c044eb..ab66f6a37 100644 --- a/api/kubernetes/cli/nodes_limits.go +++ b/api/kubernetes/cli/nodes_limits.go @@ -5,7 +5,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) -// GetNodesLimits gets the CPU and Memory limits(unused resources) of all nodes in the current k8s endpoint connection +// GetNodesLimits gets the CPU and Memory limits(unused resources) of all nodes in the current k8s environment(endpoint) connection func (kcl *KubeClient) GetNodesLimits() (portainer.K8sNodesLimits, error) { nodesLimits := make(portainer.K8sNodesLimits) diff --git a/api/kubernetes/cli/secret.go b/api/kubernetes/cli/secret.go index 3235cb304..eda7b05d6 100644 --- a/api/kubernetes/cli/secret.go +++ b/api/kubernetes/cli/secret.go @@ -41,7 +41,7 @@ func (kcl *KubeClient) getServiceAccountToken(serviceAccountName string) (string } // API token secret is populated asynchronously. - // Is it created by the controller and will depend on the environment/secret-store: + // Is it created by the controller and will depend on the environment(endpoint)/secret-store: // https://github.com/kubernetes/kubernetes/issues/67882#issuecomment-422026204 // as a work-around, we wait for up to 5 seconds for the secret to be populated. timeout := time.After(5 * time.Second) diff --git a/api/kubernetes/kubeconfig_service.go b/api/kubernetes/kubeconfig_service.go index 49547b274..84ac6834a 100644 --- a/api/kubernetes/kubeconfig_service.go +++ b/api/kubernetes/kubeconfig_service.go @@ -86,7 +86,7 @@ func (kccas *kubeConfigCAService) IsSecure() bool { return kccas.certificateAuthorityData != "" } -// GetKubeConfigInternal returns K8s cluster access details for the specified endpoint. +// GetKubeConfigInternal returns K8s cluster access details for the specified environment(endpoint). // On startup, portainer generates a certificate against localhost at specified `httpsBindAddr` port, hence // the kubeconfig generated should only be utilised by internal portainer binaries as the `ClusterServerURL` // points to the internally accessible `https` based `localhost` address. diff --git a/api/kubernetes/kubeconfig_service_test.go b/api/kubernetes/kubeconfig_service_test.go index 9b143f349..402b4f082 100644 --- a/api/kubernetes/kubeconfig_service_test.go +++ b/api/kubernetes/kubeconfig_service_test.go @@ -110,10 +110,10 @@ func TestKubeConfigService_GetKubeConfigInternal(t *testing.T) { is.True(strings.Contains(clusterAccessDetails.ClusterServerURL, ":1010"), "should contain bind address port") }) - t.Run("GetKubeConfigInternal contains endpoint proxy url", func(t *testing.T) { + t.Run("GetKubeConfigInternal contains environment proxy url", func(t *testing.T) { kcs := NewKubeConfigCAService("", "") clusterAccessDetails := kcs.GetKubeConfigInternal(100, "some-token") - is.True(strings.Contains(clusterAccessDetails.ClusterServerURL, "api/endpoints/100/kubernetes"), "should contain endpoint proxy url") + is.True(strings.Contains(clusterAccessDetails.ClusterServerURL, "api/endpoints/100/kubernetes"), "should contain environment proxy url") }) t.Run("GetKubeConfigInternal returns insecure cluster access config", func(t *testing.T) { diff --git a/api/kubernetes/snapshot.go b/api/kubernetes/snapshot.go index 8382d95ab..954766e8c 100644 --- a/api/kubernetes/snapshot.go +++ b/api/kubernetes/snapshot.go @@ -22,7 +22,7 @@ func NewSnapshotter(clientFactory *cli.ClientFactory) *Snapshotter { } } -// CreateSnapshot creates a snapshot of a specific Kubernetes endpoint +// CreateSnapshot creates a snapshot of a specific Kubernetes environment(endpoint) func (snapshotter *Snapshotter) CreateSnapshot(endpoint *portainer.Endpoint) (*portainer.KubernetesSnapshot, error) { client, err := snapshotter.clientFactory.CreateClient(endpoint) if err != nil { diff --git a/api/oauth/oauth.go b/api/oauth/oauth.go index ef039d056..8ff5afeee 100644 --- a/api/oauth/oauth.go +++ b/api/oauth/oauth.go @@ -23,7 +23,7 @@ func NewService() *Service { return &Service{} } -// Authenticate takes an access code and exchanges it for an access token from portainer OAuthSettings token endpoint. +// Authenticate takes an access code and exchanges it for an access token from portainer OAuthSettings token environment(endpoint). // On success, it will then return the username and token expiry time associated to authenticated user by fetching this information // from the resource server and matching it with the user identifier setting. func (*Service) Authenticate(code string, configuration *portainer.OAuthSettings) (string, error) { diff --git a/api/portainer.go b/api/portainer.go index e52255054..787e62fe8 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -31,7 +31,7 @@ type ( Authorizations map[Authorization]bool // AzureCredentials represents the credentials used to connect to an Azure - // environment. + // environment(endpoint). AzureCredentials struct { // Azure application ID ApplicationID string `json:"ApplicationID" example:"eag7cdo9-o09l-9i83-9dO9-f0b23oe78db4"` @@ -112,7 +112,7 @@ type ( Password string `json:"Password,omitempty" example:"passwd"` } - // DockerSnapshot represents a snapshot of a specific Docker endpoint at a specific time + // DockerSnapshot represents a snapshot of a specific Docker environment(endpoint) at a specific time DockerSnapshot struct { Time int64 `json:"Time"` DockerVersion string `json:"DockerVersion"` @@ -148,27 +148,27 @@ type ( Name string `json:"Name"` Dynamic bool `json:"Dynamic"` TagIDs []TagID `json:"TagIds"` - Endpoints []EndpointID `json:"Endpoints"` + Endpoints []EndpointID `json:"Environments"` PartialMatch bool `json:"PartialMatch"` } // EdgeGroupID represents an Edge group identifier EdgeGroupID int - // EdgeJob represents a job that can run on Edge environments. + // EdgeJob represents a job that can run on Edge environments(endpoints). EdgeJob struct { // EdgeJob Identifier ID EdgeJobID `json:"Id" example:"1"` Created int64 `json:"Created"` CronExpression string `json:"CronExpression"` - Endpoints map[EndpointID]EdgeJobEndpointMeta `json:"Endpoints"` + Endpoints map[EndpointID]EdgeJobEndpointMeta `json:"Environments"` Name string `json:"Name"` ScriptPath string `json:"ScriptPath"` Recurring bool `json:"Recurring"` Version int `json:"Version"` } - // EdgeJobEndpointMeta represents a meta data object for an Edge job and Endpoint relation + // EdgeJobEndpointMeta represents a meta data object for an Edge job and Environment(Endpoint) relation EdgeJobEndpointMeta struct { LogsStatus EdgeJobLogsStatus CollectLogs bool @@ -180,7 +180,7 @@ type ( // EdgeJobLogsStatus represent status of logs collection job EdgeJobLogsStatus int - // EdgeSchedule represents a scheduled job that can run on Edge environments. + // EdgeSchedule represents a scheduled job that can run on Edge environments(endpoints). // Deprecated in favor of EdgeJob EdgeSchedule struct { // EdgeSchedule Identifier @@ -188,7 +188,7 @@ type ( CronExpression string `json:"CronExpression"` Script string `json:"Script"` Version int `json:"Version"` - Endpoints []EndpointID `json:"Endpoints"` + Endpoints []EndpointID `json:"Environments"` } //EdgeStack represents an edge stack @@ -224,35 +224,35 @@ type ( //EdgeStackStatusType represents an edge stack status type EdgeStackStatusType int - // Endpoint represents a Docker endpoint with all the info required + // Environment(Endpoint) represents a Docker environment(endpoint) with all the info required // to connect to it Endpoint struct { - // Endpoint Identifier + // Environment(Endpoint) Identifier ID EndpointID `json:"Id" example:"1"` - // Endpoint name - Name string `json:"Name" example:"my-endpoint"` - // Endpoint environment type. 1 for a Docker environment, 2 for an agent on Docker environment or 3 for an Azure environment. + // Environment(Endpoint) name + Name string `json:"Name" example:"my-environment"` + // Environment(Endpoint) environment(endpoint) type. 1 for a Docker environment(endpoint), 2 for an agent on Docker environment(endpoint) or 3 for an Azure environment(endpoint). Type EndpointType `json:"Type" example:"1"` - // URL or IP address of the Docker host associated to this endpoint + // URL or IP address of the Docker host associated to this environment(endpoint) URL string `json:"URL" example:"docker.mydomain.tld:2375"` - // Endpoint group identifier + // Environment(Endpoint) group identifier GroupID EndpointGroupID `json:"GroupId" example:"1"` // URL or IP address where exposed containers will be reachable PublicURL string `json:"PublicURL" example:"docker.mydomain.tld:2375"` TLSConfig TLSConfiguration `json:"TLSConfig"` Extensions []EndpointExtension `json:"Extensions" example:""` AzureCredentials AzureCredentials `json:"AzureCredentials,omitempty" example:""` - // List of tag identifiers to which this endpoint is associated + // List of tag identifiers to which this environment(endpoint) is associated TagIDs []TagID `json:"TagIds"` - // The status of the endpoint (1 - up, 2 - down) + // The status of the environment(endpoint) (1 - up, 2 - down) Status EndpointStatus `json:"Status" example:"1"` // List of snapshots Snapshots []DockerSnapshot `json:"Snapshots" example:""` - // List of user identifiers authorized to connect to this endpoint + // List of user identifiers authorized to connect to this environment(endpoint) UserAccessPolicies UserAccessPolicies `json:"UserAccessPolicies"` - // List of team identifiers authorized to connect to this endpoint + // List of team identifiers authorized to connect to this environment(endpoint) TeamAccessPolicies TeamAccessPolicies `json:"TeamAccessPolicies" example:""` - // The identifier of the edge agent associated with this endpoint + // The identifier of the edge agent associated with this environment(endpoint) EdgeID string `json:"EdgeID,omitempty" example:""` // The key which is used to map the agent to Portainer EdgeKey string `json:"EdgeKey" example:""` @@ -262,7 +262,7 @@ type ( Kubernetes KubernetesData `json:"Kubernetes" example:""` // Maximum version of docker-compose ComposeSyntaxMaxVersion string `json:"ComposeSyntaxMaxVersion" example:"3.8"` - // Endpoint specific security settings + // Environment(Endpoint) specific security settings SecuritySettings EndpointSecuritySettings // LastCheckInDate mark last check-in date on checkin LastCheckInDate int64 @@ -282,7 +282,7 @@ type ( Tags []string `json:"Tags"` } - // EndpointAuthorizations represents the authorizations associated to a set of endpoints + // EndpointAuthorizations represents the authorizations associated to a set of environments(endpoints) EndpointAuthorizations map[EndpointID]Authorizations // EndpointExtension represents a deprecated form of Portainer extension @@ -292,21 +292,21 @@ type ( URL string `json:"URL"` } - // EndpointExtensionType represents the type of an endpoint extension. Only - // one extension of each type can be associated to an endpoint + // EndpointExtensionType represents the type of an environment(endpoint) extension. Only + // one extension of each type can be associated to an environment(endpoint) EndpointExtensionType int - // EndpointGroup represents a group of endpoints + // EndpointGroup represents a group of environments(endpoints) EndpointGroup struct { - // Endpoint group Identifier + // Environment(Endpoint) group Identifier ID EndpointGroupID `json:"Id" example:"1"` - // Endpoint group name - Name string `json:"Name" example:"my-endpoint-group"` - // Description associated to the endpoint group - Description string `json:"Description" example:"Endpoint group description"` + // Environment(Endpoint) group name + Name string `json:"Name" example:"my-environment-group"` + // Description associated to the environment(endpoint) group + Description string `json:"Description" example:"Environment(Endpoint) group description"` UserAccessPolicies UserAccessPolicies `json:"UserAccessPolicies" example:""` TeamAccessPolicies TeamAccessPolicies `json:"TeamAccessPolicies" example:""` - // List of tags associated to this endpoint group + // List of tags associated to this environment(endpoint) group TagIDs []TagID `json:"TagIds"` // Deprecated fields @@ -320,20 +320,20 @@ type ( Tags []string `json:"Tags"` } - // EndpointGroupID represents an endpoint group identifier + // EndpointGroupID represents an environment(endpoint) group identifier EndpointGroupID int - // EndpointID represents an endpoint identifier + // EndpointID represents an environment(endpoint) identifier EndpointID int - // EndpointStatus represents the status of an endpoint + // EndpointStatus represents the status of an environment(endpoint) EndpointStatus int - // EndpointSyncJob represents a scheduled job that synchronize endpoints based on an external file + // EndpointSyncJob represents a scheduled job that synchronize environments(endpoints) based on an external file // Deprecated EndpointSyncJob struct{} - // EndpointSecuritySettings represents settings for an endpoint + // EndpointSecuritySettings represents settings for an environment(endpoint) EndpointSecuritySettings struct { // Whether non-administrator should be able to use bind mounts when creating containers AllowBindMountsForRegularUsers bool `json:"allowBindMountsForRegularUsers" example:"false"` @@ -355,10 +355,10 @@ type ( EnableHostManagementFeatures bool `json:"enableHostManagementFeatures" example:"true"` } - // EndpointType represents the type of an endpoint + // EndpointType represents the type of an environment(endpoint) EndpointType int - // EndpointRelation represents a endpoint relation object + // EndpointRelation represents a environment(endpoint) relation object EndpointRelation struct { EndpointID EndpointID EdgeStacks map[EdgeStackID]bool @@ -428,13 +428,13 @@ type ( TeamAccessPolicies TeamAccessPolicies `json:"TeamAccessPolicies"` } - // KubernetesData contains all the Kubernetes related endpoint information + // KubernetesData contains all the Kubernetes related environment(endpoint) information KubernetesData struct { Snapshots []KubernetesSnapshot `json:"Snapshots"` Configuration KubernetesConfiguration `json:"Configuration"` } - // KubernetesSnapshot represents a snapshot of a specific Kubernetes endpoint at a specific time + // KubernetesSnapshot represents a snapshot of a specific Kubernetes environment(endpoint) at a specific time KubernetesSnapshot struct { Time int64 `json:"Time"` KubernetesVersion string `json:"KubernetesVersion"` @@ -443,7 +443,7 @@ type ( TotalMemory int64 `json:"TotalMemory"` } - // KubernetesConfiguration represents the configuration of a Kubernetes endpoint + // KubernetesConfiguration represents the configuration of a Kubernetes environment(endpoint) KubernetesConfiguration struct { UseLoadBalancer bool `json:"UseLoadBalancer"` UseServerMetrics bool `json:"UseServerMetrics"` @@ -649,7 +649,7 @@ type ( // Role name Name string `json:"Name" example:"HelpDesk"` // Role description - Description string `json:"Description" example:"Read-only access of all resources in an endpoint"` + Description string `json:"Description" example:"Read-only access of all resources in an environment(endpoint)"` // Authorizations associated to a role Authorizations Authorizations `json:"Authorizations"` Priority int `json:"Priority"` @@ -697,7 +697,7 @@ type ( AuthenticationMethod AuthenticationMethod `json:"AuthenticationMethod" example:"1"` LDAPSettings LDAPSettings `json:"LDAPSettings" example:""` OAuthSettings OAuthSettings `json:"OAuthSettings" example:""` - // The interval in which endpoint snapshots are created + // The interval in which environment(endpoint) snapshots are created SnapshotInterval string `json:"SnapshotInterval" example:"5m"` // URL to the templates that will be displayed in the UI when navigating to App Templates TemplatesURL string `json:"TemplatesURL" example:"https://raw.githubusercontent.com/portainer/templates/master/templates.json"` @@ -729,7 +729,7 @@ type ( AllowContainerCapabilitiesForRegularUsers bool `json:"AllowContainerCapabilitiesForRegularUsers"` } - // SnapshotJob represents a scheduled job that can create endpoint snapshots + // SnapshotJob represents a scheduled job that can create environment(endpoint) snapshots SnapshotJob struct{} // SoftwareEdition represents an edition of Portainer @@ -751,13 +751,13 @@ type ( Name string `json:"Name" example:"myStack"` // Stack type. 1 for a Swarm stack, 2 for a Compose stack Type StackType `json:"Type" example:"2"` - // Endpoint identifier. Reference the endpoint that will be used for deployment + // Environment(Endpoint) identifier. Reference the environment(endpoint) that will be used for deployment EndpointID EndpointID `json:"EndpointId" example:"1"` // Cluster identifier of the Swarm cluster where the stack is deployed SwarmID string `json:"SwarmId" example:"jpofkc0i9uo9wtx1zesuk649w"` // Path to the Stack file EntryPoint string `json:"EntryPoint" example:"docker-compose.yml"` - // A list of environment variables used during stack deployment + // A list of environment(endpoint) variables used during stack deployment Env []Pair `json:"Env" example:""` // ResourceControl *ResourceControl `json:"ResourceControl" example:""` @@ -818,9 +818,9 @@ type ( ID TagID `example:"1"` // Tag name Name string `json:"Name" example:"org/acme"` - // A set of endpoint ids that have this tag + // A set of environment(endpoint) ids that have this tag Endpoints map[EndpointID]bool `json:"Endpoints"` - // A set of endpoint group ids that have this tag + // A set of environment(endpoint) group ids that have this tag EndpointGroups map[EndpointGroupID]bool `json:"EndpointGroups"` } @@ -893,7 +893,7 @@ type ( Name string `json:"name,omitempty" example:"mystackname"` // URL of the template's logo Logo string `json:"logo,omitempty" example:"https://cloudinovasi.id/assets/img/logos/nginx.png"` - // A list of environment variables used during the template deployment + // A list of environment(endpoint) variables used during the template deployment Env []TemplateEnv `json:"env,omitempty"` // A note that will be displayed in the UI. Supports HTML content Note string `json:"note,omitempty" example:"This is my custom template"` @@ -908,7 +908,7 @@ type ( Registry string `json:"registry,omitempty" example:"quay.io"` // The command that will be executed in a container template Command string `json:"command,omitempty" example:"ls -lah"` - // Name of a network that will be used on container deployment if it exists inside the environment + // Name of a network that will be used on container deployment if it exists inside the environment(endpoint) Network string `json:"network,omitempty" example:"mynet"` // A list of volumes used during the container template deployment Volumes []TemplateVolume `json:"volumes,omitempty"` @@ -927,9 +927,9 @@ type ( Hostname string `json:"hostname,omitempty" example:"mycontainer"` } - // TemplateEnv represents a template environment variable configuration + // TemplateEnv represents a template environment(endpoint) variable configuration TemplateEnv struct { - // name of the environment variable + // name of the environment(endpoint) variable Name string `json:"name" example:"MYSQL_ROOT_PASSWORD"` // Text for the label that will be generated in the UI Label string `json:"label,omitempty" example:"Root password"` @@ -992,7 +992,7 @@ type ( TLSKeyPath string `json:"TLSKey,omitempty" example:"/data/tls/key.pem"` } - // TLSFileType represents a type of TLS file required to connect to a Docker endpoint. + // TLSFileType represents a type of TLS file required to connect to a Docker environment(endpoint). // It can be either a TLS CA file, a TLS certificate file or a TLS key file TLSFileType int @@ -1138,7 +1138,7 @@ type ( CreateSignature(message string) (string, error) } - // DockerSnapshotter represents a service used to create Docker endpoint snapshots + // DockerSnapshotter represents a service used to create Docker environment(endpoint) snapshots DockerSnapshotter interface { CreateSnapshot(endpoint *Endpoint) (*DockerSnapshot, error) } @@ -1172,7 +1172,7 @@ type ( GetNextIdentifier() int } - // EndpointService represents a service for managing endpoint data + // EndpointService represents a service for managing environment(endpoint) data EndpointService interface { Endpoint(ID EndpointID) (*Endpoint, error) Endpoints() ([]Endpoint, error) @@ -1183,7 +1183,7 @@ type ( GetNextIdentifier() int } - // EndpointGroupService represents a service for managing endpoint group data + // EndpointGroupService represents a service for managing environment(endpoint) group data EndpointGroupService interface { EndpointGroup(ID EndpointGroupID) (*EndpointGroup, error) EndpointGroups() ([]EndpointGroup, error) @@ -1192,7 +1192,7 @@ type ( DeleteEndpointGroup(ID EndpointGroupID) error } - // EndpointRelationService represents a service for managing endpoint relations data + // EndpointRelationService represents a service for managing environment(endpoint) relations data EndpointRelationService interface { EndpointRelation(EndpointID EndpointID) (*EndpointRelation, error) CreateEndpointRelation(endpointRelation *EndpointRelation) error @@ -1256,7 +1256,7 @@ type ( SetUserSessionDuration(userSessionDuration time.Duration) } - // KubeClient represents a service used to query a Kubernetes environment + // KubeClient represents a service used to query a Kubernetes environment(endpoint) KubeClient interface { SetupUserServiceAccount(userID int, teamIDs []int, restrictDefaultNamespace bool) error GetServiceAccount(tokendata *TokenData) (*v1.ServiceAccount, error) @@ -1274,13 +1274,13 @@ type ( ToggleSystemState(namespace string, isSystem bool) error } - // KubernetesDeployer represents a service to deploy a manifest inside a Kubernetes endpoint + // KubernetesDeployer represents a service to deploy a manifest inside a Kubernetes environment(endpoint) KubernetesDeployer interface { Deploy(request *http.Request, endpoint *Endpoint, data string, namespace string) (string, error) ConvertCompose(data []byte) ([]byte, error) } - // KubernetesSnapshotter represents a service used to create Kubernetes endpoint snapshots + // KubernetesSnapshotter represents a service used to create Kubernetes environment(endpoint) snapshots KubernetesSnapshotter interface { CreateSnapshot(endpoint *Endpoint) (*KubernetesSnapshot, error) } @@ -1367,7 +1367,7 @@ type ( RefreshableStacks() ([]Stack, error) } - // SnapshotService represents a service for managing endpoint snapshots + // SnapshotService represents a service for managing environment(endpoint) snapshots SnapshotService interface { Start() Stop() @@ -1542,7 +1542,7 @@ const ( _ EdgeStackStatusType = iota //StatusOk represents a successfully deployed edge stack StatusOk - //StatusError represents an edge endpoint which failed to deploy its edge stack + //StatusError represents an edge environment(endpoint) which failed to deploy its edge stack StatusError //StatusAcknowledged represents an acknowledged edge stack StatusAcknowledged @@ -1556,33 +1556,33 @@ const ( const ( _ EndpointStatus = iota - // EndpointStatusUp is used to represent an available endpoint + // EndpointStatusUp is used to represent an available environment(endpoint) EndpointStatusUp - // EndpointStatusDown is used to represent an unavailable endpoint + // EndpointStatusDown is used to represent an unavailable environment(endpoint) EndpointStatusDown ) const ( _ EndpointType = iota - // DockerEnvironment represents an endpoint connected to a Docker environment + // DockerEnvironment represents an environment(endpoint) connected to a Docker environment(endpoint) DockerEnvironment - // AgentOnDockerEnvironment represents an endpoint connected to a Portainer agent deployed on a Docker environment + // AgentOnDockerEnvironment represents an environment(endpoint) connected to a Portainer agent deployed on a Docker environment(endpoint) AgentOnDockerEnvironment - // AzureEnvironment represents an endpoint connected to an Azure environment + // AzureEnvironment represents an environment(endpoint) connected to an Azure environment(endpoint) AzureEnvironment - // EdgeAgentOnDockerEnvironment represents an endpoint connected to an Edge agent deployed on a Docker environment + // EdgeAgentOnDockerEnvironment represents an environment(endpoint) connected to an Edge agent deployed on a Docker environment(endpoint) EdgeAgentOnDockerEnvironment - // KubernetesLocalEnvironment represents an endpoint connected to a local Kubernetes environment + // KubernetesLocalEnvironment represents an environment(endpoint) connected to a local Kubernetes environment(endpoint) KubernetesLocalEnvironment - // AgentOnKubernetesEnvironment represents an endpoint connected to a Portainer agent deployed on a Kubernetes environment + // AgentOnKubernetesEnvironment represents an environment(endpoint) connected to a Portainer agent deployed on a Kubernetes environment(endpoint) AgentOnKubernetesEnvironment - // EdgeAgentOnKubernetesEnvironment represents an endpoint connected to an Edge agent deployed on a Kubernetes environment + // EdgeAgentOnKubernetesEnvironment represents an environment(endpoint) connected to an Edge agent deployed on a Kubernetes environment(endpoint) EdgeAgentOnKubernetesEnvironment ) const ( _ JobType = iota - // SnapshotJobType is a system job used to create endpoint snapshots + // SnapshotJobType is a system job used to create environment(endpoint) snapshots SnapshotJobType = 2 ) @@ -1701,11 +1701,11 @@ const ( ) const ( - // EdgeAgentIdle represents an idle state for a tunnel connected to an Edge endpoint. + // EdgeAgentIdle represents an idle state for a tunnel connected to an Edge environment(endpoint). EdgeAgentIdle string = "IDLE" - // EdgeAgentManagementRequired represents a required state for a tunnel connected to an Edge endpoint + // EdgeAgentManagementRequired represents a required state for a tunnel connected to an Edge environment(endpoint) EdgeAgentManagementRequired string = "REQUIRED" - // EdgeAgentActive represents an active state for a tunnel connected to an Edge endpoint + // EdgeAgentActive represents an active state for a tunnel connected to an Edge environment(endpoint) EdgeAgentActive string = "ACTIVE" ) From 49d2c68a19fd52ee20a614a495e718716454063b Mon Sep 17 00:00:00 2001 From: Richard Wei <54336863+WaysonWei@users.noreply.github.com> Date: Mon, 20 Sep 2021 12:20:45 +1200 Subject: [PATCH 10/25] fix icon not displayed when template created via upload file (#5659) --- api/http/handler/customtemplates/customtemplate_create.go | 4 +++- .../createCustomTemplateViewController.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/http/handler/customtemplates/customtemplate_create.go b/api/http/handler/customtemplates/customtemplate_create.go index f2bacb6f9..60727396b 100644 --- a/api/http/handler/customtemplates/customtemplate_create.go +++ b/api/http/handler/customtemplates/customtemplate_create.go @@ -279,9 +279,11 @@ func (payload *customTemplateFromFileUploadPayload) Validate(r *http.Request) er if err != nil { return errors.New("Invalid custom template description") } - payload.Description = description + logo, _ := request.RetrieveMultiPartFormValue(r, "Logo", true) + payload.Logo = logo + note, _ := request.RetrieveMultiPartFormValue(r, "Note", true) payload.Note = note diff --git a/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateViewController.js b/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateViewController.js index b63dd8037..1a0857e1b 100644 --- a/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateViewController.js +++ b/app/portainer/views/custom-templates/create-custom-template-view/createCustomTemplateViewController.js @@ -30,6 +30,7 @@ class CreateCustomTemplateViewController { ComposeFilePathInRepository: 'docker-compose.yml', Description: '', Note: '', + Logo:'', Platform: 1, Type: 1, AccessControlData: new AccessControlFormData(), From af8065e8c24398c688f04dc7f7c9e06a34cc8046 Mon Sep 17 00:00:00 2001 From: Richard Wei <54336863+WaysonWei@users.noreply.github.com> Date: Mon, 20 Sep 2021 15:41:40 +1200 Subject: [PATCH 11/25] fix error description on stats for non-admin user (#5664) --- app/kubernetes/node/service.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/kubernetes/node/service.js b/app/kubernetes/node/service.js index e2d207f7b..80c0ec267 100644 --- a/app/kubernetes/node/service.js +++ b/app/kubernetes/node/service.js @@ -26,7 +26,9 @@ class KubernetesNodeService { const [details, yaml] = await Promise.all([this.KubernetesNodes().get(params).$promise, this.KubernetesNodes().getYaml(params).$promise]); return KubernetesNodeConverter.apiToNodeDetails(details, yaml); } catch (err) { - throw new PortainerError('Unable to retrieve node details', err); + // changing the structure of error message to fix [object, Object] issue + const errData = err.data; + throw new PortainerError('Unable to retrieve node details', errData); } } From 1796545d2ecdbaf3e4debf089d5d0561c7a9fc30 Mon Sep 17 00:00:00 2001 From: Richard Wei <54336863+WaysonWei@users.noreply.github.com> Date: Mon, 20 Sep 2021 22:36:22 +1200 Subject: [PATCH 12/25] fix authentication toggle on by default - set to off (#5666) --- app/portainer/views/stacks/create/createStackController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/portainer/views/stacks/create/createStackController.js b/app/portainer/views/stacks/create/createStackController.js index 93c5ca05d..d01646ef8 100644 --- a/app/portainer/views/stacks/create/createStackController.js +++ b/app/portainer/views/stacks/create/createStackController.js @@ -34,7 +34,7 @@ angular StackFile: null, RepositoryURL: '', RepositoryReferenceName: '', - RepositoryAuthentication: true, + RepositoryAuthentication: false, RepositoryUsername: '', RepositoryPassword: '', Env: [], From 483559af09e9a37682e47a02aa1a1e6c737caf24 Mon Sep 17 00:00:00 2001 From: Richard Wei <54336863+WaysonWei@users.noreply.github.com> Date: Tue, 21 Sep 2021 10:19:18 +1200 Subject: [PATCH 13/25] fix edge heartbeat turn red when use search filter (#5683) --- .../endpoint-list/endpoint-item/endpoint-item-controller.js | 3 +-- .../components/endpoint-list/endpoint-item/endpointItem.js | 1 + app/portainer/components/endpoint-list/endpoint-list.js | 1 + app/portainer/components/endpoint-list/endpointList.html | 2 ++ app/portainer/views/home/home.html | 1 + app/portainer/views/home/homeController.js | 2 ++ 6 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/portainer/components/endpoint-list/endpoint-item/endpoint-item-controller.js b/app/portainer/components/endpoint-list/endpoint-item/endpoint-item-controller.js index 0a0a944ea..1ca24a0a1 100644 --- a/app/portainer/components/endpoint-list/endpoint-item/endpoint-item-controller.js +++ b/app/portainer/components/endpoint-list/endpoint-item/endpoint-item-controller.js @@ -35,10 +35,9 @@ class EndpointItemController { return false; } const checkInInterval = this.model.EdgeCheckinInterval; - const now = Math.floor(Date.now() / 1000); // give checkIn some wiggle room - return now - this.model.LastCheckInDate <= checkInInterval * 2 + 20; + return this.endpointInitTime - this.model.LastCheckInDate <= checkInInterval * 2; } $onInit() { diff --git a/app/portainer/components/endpoint-list/endpoint-item/endpointItem.js b/app/portainer/components/endpoint-list/endpoint-item/endpointItem.js index ec8f2b1fa..a22f5f0e3 100644 --- a/app/portainer/components/endpoint-list/endpoint-item/endpointItem.js +++ b/app/portainer/components/endpoint-list/endpoint-item/endpointItem.js @@ -10,6 +10,7 @@ angular.module('portainer.app').component('endpointItem', { onEdit: '<', isAdmin: '<', tags: '<', + endpointInitTime: '<', }, controller: EndpointItemController, }); diff --git a/app/portainer/components/endpoint-list/endpoint-list.js b/app/portainer/components/endpoint-list/endpoint-list.js index c9d16826c..04914d268 100644 --- a/app/portainer/components/endpoint-list/endpoint-list.js +++ b/app/portainer/components/endpoint-list/endpoint-list.js @@ -14,5 +14,6 @@ angular.module('portainer.app').component('endpointList', { isAdmin: '<', totalCount: '<', retrievePage: '<', + endpointInitTime: '<', }, }); diff --git a/app/portainer/components/endpoint-list/endpointList.html b/app/portainer/components/endpoint-list/endpointList.html index 7f835a95b..98e12d2b6 100644 --- a/app/portainer/components/endpoint-list/endpointList.html +++ b/app/portainer/components/endpoint-list/endpointList.html @@ -38,6 +38,7 @@ on-edit="($ctrl.editAction)" is-admin="$ctrl.isAdmin" tags="$ctrl.tags" + endpoint-init-time="$ctrl.endpointInitTime" >
Loading... diff --git a/app/portainer/views/home/home.html b/app/portainer/views/home/home.html index 3b1a4d47c..6d780165b 100644 --- a/app/portainer/views/home/home.html +++ b/app/portainer/views/home/home.html @@ -56,6 +56,7 @@ is-admin="isAdmin" total-count="totalCount" retrieve-page="getPaginatedEndpoints" + endpoint-init-time="state.homepageLoadTime" >
diff --git a/app/portainer/views/home/homeController.js b/app/portainer/views/home/homeController.js index 9083090e4..9fae5b1b6 100644 --- a/app/portainer/views/home/homeController.js +++ b/app/portainer/views/home/homeController.js @@ -18,6 +18,7 @@ angular ) { $scope.state = { connectingToEdgeEndpoint: false, + homepageLoadTime: '', }; $scope.goToEdit = function (id) { @@ -92,6 +93,7 @@ angular } async function initView() { + $scope.state.homepageLoadTime = Math.floor(Date.now() / 1000); $scope.isAdmin = Authentication.isAdmin(); MotdService.motd().then(function success(data) { From 33118babddfb175e9a4f4780b88126f936600b90 Mon Sep 17 00:00:00 2001 From: cong meng Date: Tue, 21 Sep 2021 13:12:37 +1200 Subject: [PATCH 14/25] fix(k8s) keep tunnel alive for websocket connection EE-1690 (#5677) * fix(k8s) EE-1690 keep tunnel alive for websocket connection * fix(k8s) EE-1690 fix comment Co-authored-by: Simon Meng --- api/chisel/service.go | 50 +++++++++++++++++++++++++++++ api/http/handler/websocket/proxy.go | 3 ++ api/kubernetes/cli/pod.go | 6 ++-- api/portainer.go | 3 ++ 4 files changed, 58 insertions(+), 4 deletions(-) diff --git a/api/chisel/service.go b/api/chisel/service.go index 9af0f4866..f22281bd5 100644 --- a/api/chisel/service.go +++ b/api/chisel/service.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "net/http" "strconv" "time" @@ -42,6 +43,55 @@ func NewService(dataStore portainer.DataStore, shutdownCtx context.Context) *Ser } } +// pingAgent ping the given agent so that the agent can keep the tunnel alive +func (service *Service) pingAgent(endpointID portainer.EndpointID) error{ + tunnel := service.GetTunnelDetails(endpointID) + requestURL := fmt.Sprintf("http://127.0.0.1:%d/ping", tunnel.Port) + req, err := http.NewRequest(http.MethodHead, requestURL, nil) + if err != nil { + return err + } + + httpClient := &http.Client{ + Timeout: 3 * time.Second, + } + _, err = httpClient.Do(req) + if err != nil { + return err + } + + return nil +} + +// KeepTunnelAlive keeps the tunnel of the given environment for maxAlive duration, or until ctx is done +func (service *Service) KeepTunnelAlive(endpointID portainer.EndpointID, ctx context.Context, maxAlive time.Duration) { + go func() { + log.Printf("[DEBUG] [chisel,KeepTunnelAlive] [endpoint_id: %d] [message: start for %.0f minutes]\n", endpointID, maxAlive.Minutes()) + maxAliveTicker := time.NewTicker(maxAlive) + defer maxAliveTicker.Stop() + pingTicker := time.NewTicker(tunnelCleanupInterval) + defer pingTicker.Stop() + + for { + select { + case <-pingTicker.C: + service.SetTunnelStatusToActive(endpointID) + err := service.pingAgent(endpointID) + if err != nil { + log.Printf("[DEBUG] [chisel,KeepTunnelAlive] [endpoint_id: %d] [warning: ping agent err=%s]\n", endpointID, err) + } + case <-maxAliveTicker.C: + log.Printf("[DEBUG] [chisel,KeepTunnelAlive] [endpoint_id: %d] [message: stop as %.0f minutes timeout]\n", endpointID, maxAlive.Minutes()) + return + case <-ctx.Done(): + err := ctx.Err() + log.Printf("[DEBUG] [chisel,KeepTunnelAlive] [endpoint_id: %d] [message: stop as err=%s]\n", endpointID, err) + return + } + } + }() +} + // StartTunnelServer starts a tunnel server on the specified addr and port. // It uses a seed to generate a new private/public key pair. If the seed cannot // be found inside the database, it will generate a new one randomly and persist it. diff --git a/api/http/handler/websocket/proxy.go b/api/http/handler/websocket/proxy.go index a03cb6637..c9a3b07de 100644 --- a/api/http/handler/websocket/proxy.go +++ b/api/http/handler/websocket/proxy.go @@ -35,6 +35,9 @@ func (handler *Handler) proxyEdgeAgentWebsocketRequest(w http.ResponseWriter, r } handler.ReverseTunnelService.SetTunnelStatusToActive(params.endpoint.ID) + + handler.ReverseTunnelService.KeepTunnelAlive(params.endpoint.ID, r.Context(), portainer.WebSocketKeepAlive) + proxy.ServeHTTP(w, r) return nil diff --git a/api/kubernetes/cli/pod.go b/api/kubernetes/cli/pod.go index 3db620d55..43d66434c 100644 --- a/api/kubernetes/cli/pod.go +++ b/api/kubernetes/cli/pod.go @@ -21,9 +21,7 @@ const shellPodImage = "portainer/kubectl-shell" // - The shell pod will be automatically removed after a specified max life (prevent zombie pods) // - The shell pod will be automatically removed if request is cancelled (or client closes websocket connection) func (kcl *KubeClient) CreateUserShellPod(ctx context.Context, serviceAccountName string) (*portainer.KubernetesShellPod, error) { - // Schedule the pod for automatic removal - maxPodKeepAlive := 1 * time.Hour - maxPodKeepAliveSecondsStr := fmt.Sprintf("%d", int(maxPodKeepAlive.Seconds())) + maxPodKeepAliveSecondsStr := fmt.Sprintf("%d", int(portainer.WebSocketKeepAlive.Seconds())) podPrefix := userShellPodPrefix(serviceAccountName) @@ -81,7 +79,7 @@ func (kcl *KubeClient) CreateUserShellPod(ctx context.Context, serviceAccountNam // Handle pod lifecycle/cleanup - terminate pod after maxPodKeepAlive or upon request (long-lived) cancellation go func() { select { - case <-time.After(maxPodKeepAlive): + case <-time.After(portainer.WebSocketKeepAlive): log.Println("[DEBUG] [internal,kubernetes/pod] [message: pod removal schedule duration exceeded]") kcl.cli.CoreV1().Pods(portainerNamespace).Delete(shellPod.Name, nil) case <-ctx.Done(): diff --git a/api/portainer.go b/api/portainer.go index 787e62fe8..9ebc4d7d7 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -1324,6 +1324,7 @@ type ( SetTunnelStatusToActive(endpointID EndpointID) SetTunnelStatusToRequired(endpointID EndpointID) error SetTunnelStatusToIdle(endpointID EndpointID) + KeepTunnelAlive(endpointID EndpointID, ctx context.Context, maxKeepAlive time.Duration) GetTunnelDetails(endpointID EndpointID) *TunnelDetails AddEdgeJob(endpointID EndpointID, edgeJob *EdgeJob) RemoveEdgeJob(edgeJobID EdgeJobID) @@ -1493,6 +1494,8 @@ const ( DefaultUserSessionTimeout = "8h" // DefaultUserSessionTimeout represents the default timeout after which the user session is cleared DefaultKubeconfigExpiry = "0" + // WebSocketKeepAlive web socket keep alive for edge environments + WebSocketKeepAlive = 1 * time.Hour ) const ( From 24f11902b237a3f1929d86f58a9f7c9f8103000f Mon Sep 17 00:00:00 2001 From: fhanportainer <79428273+fhanportainer@users.noreply.github.com> Date: Tue, 21 Sep 2021 13:42:01 +1200 Subject: [PATCH 15/25] fix(stack): fixed issue cannot deploy git stack without username. (#5681) --- .../git-form/git-form-auth-fieldset/git-form-auth-fieldset.html | 1 - 1 file changed, 1 deletion(-) diff --git a/app/portainer/components/forms/git-form/git-form-auth-fieldset/git-form-auth-fieldset.html b/app/portainer/components/forms/git-form/git-form-auth-fieldset/git-form-auth-fieldset.html index dc4ee9435..a197325dc 100644 --- a/app/portainer/components/forms/git-form/git-form-auth-fieldset/git-form-auth-fieldset.html +++ b/app/portainer/components/forms/git-form/git-form-auth-fieldset/git-form-auth-fieldset.html @@ -25,7 +25,6 @@ placeholder="git username" ng-change="$ctrl.onChangeUsername($ctrl.model.RepositoryUsername)" data-cy="component-gitUsernameInput" - ng-required="$ctrl.model.RepositoryAuthentication" /> From 4267304e50d2d2de86a0d67a1349466c0d5057b0 Mon Sep 17 00:00:00 2001 From: cong meng Date: Tue, 21 Sep 2021 17:41:14 +1200 Subject: [PATCH 16/25] fix(edge) EE-1733 cant edit edge groups (#5687) * fix(edge) EE-1733 cant edit edge groups * fix(edge) EE-1733 correct json names of a few edge objects Co-authored-by: Simon Meng --- api/portainer.go | 6 +++--- .../editEdgeGroupView/editEdgeGroupViewController.js | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/portainer.go b/api/portainer.go index 9ebc4d7d7..f9f0652ce 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -148,7 +148,7 @@ type ( Name string `json:"Name"` Dynamic bool `json:"Dynamic"` TagIDs []TagID `json:"TagIds"` - Endpoints []EndpointID `json:"Environments"` + Endpoints []EndpointID `json:"Endpoints"` PartialMatch bool `json:"PartialMatch"` } @@ -161,7 +161,7 @@ type ( ID EdgeJobID `json:"Id" example:"1"` Created int64 `json:"Created"` CronExpression string `json:"CronExpression"` - Endpoints map[EndpointID]EdgeJobEndpointMeta `json:"Environments"` + Endpoints map[EndpointID]EdgeJobEndpointMeta `json:"Endpoints"` Name string `json:"Name"` ScriptPath string `json:"ScriptPath"` Recurring bool `json:"Recurring"` @@ -188,7 +188,7 @@ type ( CronExpression string `json:"CronExpression"` Script string `json:"Script"` Version int `json:"Version"` - Endpoints []EndpointID `json:"Environments"` + Endpoints []EndpointID `json:"Endpoints"` } //EdgeStack represents an edge stack diff --git a/app/edge/views/edge-groups/editEdgeGroupView/editEdgeGroupViewController.js b/app/edge/views/edge-groups/editEdgeGroupView/editEdgeGroupViewController.js index 49c7c05fc..d2c910c31 100644 --- a/app/edge/views/edge-groups/editEdgeGroupView/editEdgeGroupViewController.js +++ b/app/edge/views/edge-groups/editEdgeGroupView/editEdgeGroupViewController.js @@ -8,6 +8,11 @@ export class EditEdgeGroupController { this.$state = $state; this.$async = $async; + this.state = { + actionInProgress: false, + loaded: false, + }; + this.updateGroup = this.updateGroup.bind(this); this.updateGroupAsync = this.updateGroupAsync.bind(this); } From 48c762c98b0631eb07b340725bdee0e2b4afc4fb Mon Sep 17 00:00:00 2001 From: Richard Wei <54336863+WaysonWei@users.noreply.github.com> Date: Tue, 21 Sep 2021 20:58:23 +1200 Subject: [PATCH 17/25] fix(notification): fix error in kube application stack name with space EE-1726 (#5691) * fix error in kube application stack name with space --- app/portainer/services/notifications.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/portainer/services/notifications.js b/app/portainer/services/notifications.js index 863f883d7..db401e4bd 100644 --- a/app/portainer/services/notifications.js +++ b/app/portainer/services/notifications.js @@ -16,7 +16,7 @@ angular.module('portainer.app').factory('Notifications', [ service.error = function (title, e, fallbackText) { var msg = fallbackText; - if (e.err && e.err.data && e.err.data.details) { + if (e.err && e.err.data && e.err.data.details && typeof e.err.data.details === 'string') { msg = e.err.data.details; } else if (e.err && e.err.data && e.err.data.message) { msg = e.err.data.message; From 0efbf5bbf3eeb3ce0f3d372c3d3a2a6d94a3a0de Mon Sep 17 00:00:00 2001 From: Richard Wei <54336863+WaysonWei@users.noreply.github.com> Date: Wed, 22 Sep 2021 13:18:52 +1200 Subject: [PATCH 18/25] rename endpoint to environment in wizard breadcrumb header (#5696) --- app/portainer/views/wizard/wizard-view.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/portainer/views/wizard/wizard-view.html b/app/portainer/views/wizard/wizard-view.html index db8c880b6..5df89cc93 100644 --- a/app/portainer/views/wizard/wizard-view.html +++ b/app/portainer/views/wizard/wizard-view.html @@ -1,6 +1,6 @@ - Endpoint Wizard + Environment Wizard
From 092d217985d8fca02fb7447578ed6f0cb604d4f7 Mon Sep 17 00:00:00 2001 From: zees-dev <63374656+zees-dev@users.noreply.github.com> Date: Wed, 22 Sep 2021 13:42:13 +1200 Subject: [PATCH 19/25] table settings propagated through nested tables (#5699) --- .../applications-datatable/applicationsDatatable.html | 1 + .../datatables/applications-datatable/applicationsDatatable.js | 1 + .../applications-datatable/applicationsDatatableController.js | 2 +- app/kubernetes/views/applications/applications.html | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/kubernetes/components/datatables/applications-datatable/applicationsDatatable.html b/app/kubernetes/components/datatables/applications-datatable/applicationsDatatable.html index 1f1d46fdd..e495e37ce 100644 --- a/app/kubernetes/components/datatables/applications-datatable/applicationsDatatable.html +++ b/app/kubernetes/components/datatables/applications-datatable/applicationsDatatable.html @@ -231,6 +231,7 @@ Date: Wed, 22 Sep 2021 16:01:42 +1200 Subject: [PATCH 20/25] fix(k8s): fixerror handling for namespace restricted user EE-1703 (#5693) * fix error handler for namespace when user have no namespace access --- .../helm/helm-templates/helm-templates.html | 10 +- .../create/createApplication.html | 4 +- .../create/createConfiguration.html | 115 ++++++++++-------- app/kubernetes/views/deploy/deploy.html | 8 +- .../views/deploy/deployController.js | 8 +- 5 files changed, 79 insertions(+), 66 deletions(-) diff --git a/app/kubernetes/components/helm/helm-templates/helm-templates.html b/app/kubernetes/components/helm/helm-templates/helm-templates.html index 1c1cda61f..1cdae0d32 100644 --- a/app/kubernetes/components/helm/helm-templates/helm-templates.html +++ b/app/kubernetes/components/helm/helm-templates/helm-templates.html @@ -39,7 +39,7 @@ Configuration
-
+
-
-
- - This namespace has exhausted its resource capacity and you will not be able to deploy the application. Contact your administrator to expand the capacity of the - namespace. -
-
+
diff --git a/app/kubernetes/views/applications/create/createApplication.html b/app/kubernetes/views/applications/create/createApplication.html index ef6916c59..20785d089 100644 --- a/app/kubernetes/views/applications/create/createApplication.html +++ b/app/kubernetes/views/applications/create/createApplication.html @@ -141,6 +141,7 @@
- +
Stack
@@ -1607,6 +1608,7 @@ form-values="ctrl.formValues" old-form-values="ctrl.savedFormValues" > +
diff --git a/app/kubernetes/views/configurations/create/createConfiguration.html b/app/kubernetes/views/configurations/create/createConfiguration.html index 040c138c5..8c21a33df 100644 --- a/app/kubernetes/views/configurations/create/createConfiguration.html +++ b/app/kubernetes/views/configurations/create/createConfiguration.html @@ -49,7 +49,7 @@
-
+
@@ -68,69 +69,75 @@ namespace.
- - -
- Configuration type -
- -
+
- Select the type of data that you want to save in the configuration. + + You do not have access to any namespace. Contact your administrator to get access to a namespace.
+ +
+
+ Configuration type +
- -
-
-
- - -
-
- - +
+
+ Select the type of data that you want to save in the configuration.
-
- -
- Information -
-
-
- Creating a sensitive configuration will create a Kubernetes Secret of type Opaque. You can find more information about this in the - official documentation. + +
+
+
+ + +
+
+ + +
+
-
+ - +
+ Information +
+
+
+ Creating a sensitive configuration will create a Kubernetes Secret of type Opaque. You can find more information about this in the + official documentation. +
+
- - + + + +
Actions @@ -140,7 +147,7 @@