From 493de205406c75fea88ed0a1c5e96e544063d682 Mon Sep 17 00:00:00 2001 From: Anthony Lapenna Date: Tue, 19 May 2020 15:08:57 +1200 Subject: [PATCH] refactor(azure): remove Azure ACI endpoint support (#3803) * feat(templates): remove template management features (#3719) * feat(api): remove template management features * feat(templates): remove template management features * refactor(azure): remove Azure ACI endpoint support --- api/cron/job_snapshot.go | 2 +- api/docker/client.go | 4 +- api/errors.go | 5 - api/go.sum | 1 + api/http/client/client.go | 52 ------ api/http/handler/endpointproxy/handler.go | 2 - api/http/handler/endpointproxy/proxy_azure.go | 43 ----- api/http/handler/endpoints/endpoint_create.go | 106 +++-------- .../handler/endpoints/endpoint_snapshot.go | 4 - .../handler/endpoints/endpoint_snapshots.go | 4 - api/http/handler/endpoints/endpoint_update.go | 48 ++--- api/http/handler/endpoints/handler.go | 1 - api/http/handler/handler.go | 2 - api/http/proxy/factory/azure.go | 20 --- api/http/proxy/factory/azure/transport.go | 80 --------- api/http/proxy/factory/factory.go | 7 - api/portainer.go | 10 +- api/swagger.yaml | 47 +---- app/__module.js | 2 - app/azure/_module.js | 51 ------ .../azure-endpoint-config.js | 8 - .../azureEndpointConfig.html | 36 ---- .../azure-sidebar-content.js | 3 - .../azureSidebarContent.html | 6 - .../containerGroupsDatatable.html | 105 ----------- .../containerGroupsDatatable.js | 13 -- app/azure/models/container_group.js | 66 ------- app/azure/models/location.js | 6 - app/azure/models/provider.js | 9 - app/azure/models/resource_group.js | 6 - app/azure/models/subscription.js | 4 - app/azure/rest/azure.js | 20 --- app/azure/rest/container_group.js | 45 ----- app/azure/rest/location.js | 18 -- app/azure/rest/provider.js | 18 -- app/azure/rest/resource_group.js | 18 -- app/azure/rest/subscription.js | 18 -- app/azure/services/azureService.js | 72 -------- app/azure/services/containerGroupService.js | 41 ----- app/azure/services/locationService.js | 29 --- app/azure/services/providerService.js | 27 --- app/azure/services/resourceGroupService.js | 29 --- app/azure/services/subscriptionService.js | 29 --- .../containerInstancesController.js | 44 ----- .../containerinstances.html | 21 --- .../createContainerInstanceController.js | 93 ---------- .../create/createcontainerinstance.html | 167 ------------------ app/azure/views/dashboard/dashboard.html | 33 ---- .../views/dashboard/dashboardController.js | 23 --- .../endpoint-item/endpointItem.html | 2 +- app/portainer/filters/filters.js | 2 - app/portainer/services/api/endpointService.js | 14 -- app/portainer/services/fileUpload.js | 16 -- app/portainer/services/stateManager.js | 8 - .../create/createEndpointController.js | 29 --- .../endpoints/create/createendpoint.html | 114 ------------ .../views/endpoints/edit/endpoint.html | 6 - .../endpoints/edit/endpointController.js | 3 - app/portainer/views/home/homeController.js | 17 +- .../views/init/endpoint/initEndpoint.html | 95 ---------- .../init/endpoint/initEndpointController.js | 26 --- app/portainer/views/sidebar/sidebar.html | 2 - assets/css/app.css | 4 - jsconfig.json | 1 - webpack/webpack.common.js | 1 - 65 files changed, 47 insertions(+), 1791 deletions(-) delete mode 100644 api/http/handler/endpointproxy/proxy_azure.go delete mode 100644 api/http/proxy/factory/azure.go delete mode 100644 api/http/proxy/factory/azure/transport.go delete mode 100644 app/azure/_module.js delete mode 100644 app/azure/components/azure-endpoint-config/azure-endpoint-config.js delete mode 100644 app/azure/components/azure-endpoint-config/azureEndpointConfig.html delete mode 100644 app/azure/components/azure-sidebar-content/azure-sidebar-content.js delete mode 100644 app/azure/components/azure-sidebar-content/azureSidebarContent.html delete mode 100644 app/azure/components/datatables/containergroups-datatable/containerGroupsDatatable.html delete mode 100644 app/azure/components/datatables/containergroups-datatable/containerGroupsDatatable.js delete mode 100644 app/azure/models/container_group.js delete mode 100644 app/azure/models/location.js delete mode 100644 app/azure/models/provider.js delete mode 100644 app/azure/models/resource_group.js delete mode 100644 app/azure/models/subscription.js delete mode 100644 app/azure/rest/azure.js delete mode 100644 app/azure/rest/container_group.js delete mode 100644 app/azure/rest/location.js delete mode 100644 app/azure/rest/provider.js delete mode 100644 app/azure/rest/resource_group.js delete mode 100644 app/azure/rest/subscription.js delete mode 100644 app/azure/services/azureService.js delete mode 100644 app/azure/services/containerGroupService.js delete mode 100644 app/azure/services/locationService.js delete mode 100644 app/azure/services/providerService.js delete mode 100644 app/azure/services/resourceGroupService.js delete mode 100644 app/azure/services/subscriptionService.js delete mode 100644 app/azure/views/containerinstances/containerInstancesController.js delete mode 100644 app/azure/views/containerinstances/containerinstances.html delete mode 100644 app/azure/views/containerinstances/create/createContainerInstanceController.js delete mode 100644 app/azure/views/containerinstances/create/createcontainerinstance.html delete mode 100644 app/azure/views/dashboard/dashboard.html delete mode 100644 app/azure/views/dashboard/dashboardController.js diff --git a/api/cron/job_snapshot.go b/api/cron/job_snapshot.go index 458d026c0..b3dcc9b74 100644 --- a/api/cron/job_snapshot.go +++ b/api/cron/job_snapshot.go @@ -53,7 +53,7 @@ func (runner *SnapshotJobRunner) Run() { } for _, endpoint := range endpoints { - if endpoint.Type == portainer.AzureEnvironment || endpoint.Type == portainer.EdgeAgentEnvironment { + if endpoint.Type == portainer.EdgeAgentEnvironment { continue } diff --git a/api/docker/client.go b/api/docker/client.go index c1bd7a8d0..ce8d21ec1 100644 --- a/api/docker/client.go +++ b/api/docker/client.go @@ -35,9 +35,7 @@ func NewClientFactory(signatureService portainer.DigitalSignatureService, revers // a specific endpoint configuration. The nodeName parameter can be used // with an agent enabled 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, unsupportedEnvironmentType - } else if endpoint.Type == portainer.AgentOnDockerEnvironment { + if endpoint.Type == portainer.AgentOnDockerEnvironment { return createAgentClient(endpoint, factory.signatureService, nodeName) } else if endpoint.Type == portainer.EdgeAgentEnvironment { return createEdgeClient(endpoint, factory.reverseTunnelService, nodeName) diff --git a/api/errors.go b/api/errors.go index 8e09838a1..bc639d341 100644 --- a/api/errors.go +++ b/api/errors.go @@ -39,11 +39,6 @@ const ( ErrEndpointAccessDenied = Error("Access denied to endpoint") ) -// Azure environment errors -const ( - ErrAzureInvalidCredentials = Error("Invalid Azure credentials") -) - // Endpoint group errors. const ( ErrCannotRemoveDefaultGroup = Error("Cannot remove the default endpoint group") diff --git a/api/go.sum b/api/go.sum index 621d3a831..d3eead3d3 100644 --- a/api/go.sum +++ b/api/go.sum @@ -171,6 +171,7 @@ github.com/portainer/libcrypto v0.0.0-20190723020515-23ebe86ab2c2 h1:0PfgGLys9yH github.com/portainer/libcrypto v0.0.0-20190723020515-23ebe86ab2c2/go.mod h1:/wIeGwJOMYc1JplE/OvYMO5korce39HddIfI8VKGyAM= github.com/portainer/libhttp v0.0.0-20190806161843-ba068f58be33 h1:H8HR2dHdBf8HANSkUyVw4o8+4tegGcd+zyKZ3e599II= github.com/portainer/libhttp v0.0.0-20190806161843-ba068f58be33/go.mod h1:Y2TfgviWI4rT2qaOTHr+hq6MdKIE5YjgQAu7qwptTV0= +github.com/portainer/portainer v0.10.1 h1:I8K345CjGWfUGsVA8c8/gqamwLCC6CIAjxZXSklAFq0= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.1.0 h1:BQ53HtBmfOitExawJ6LokA4x8ov/z0SYYb0+HxJfRI8= diff --git a/api/http/client/client.go b/api/http/client/client.go index fb690105f..0e6d9d41d 100644 --- a/api/http/client/client.go +++ b/api/http/client/client.go @@ -2,12 +2,9 @@ package client import ( "crypto/tls" - "encoding/json" - "fmt" "io/ioutil" "log" "net/http" - "net/url" "strings" "time" @@ -19,55 +16,6 @@ const ( defaultHTTPTimeout = 5 ) -// HTTPClient represents a client to send HTTP requests. -type HTTPClient struct { - *http.Client -} - -// NewHTTPClient is used to build a new HTTPClient. -func NewHTTPClient() *HTTPClient { - return &HTTPClient{ - &http.Client{ - Timeout: time.Second * time.Duration(defaultHTTPTimeout), - }, - } -} - -// AzureAuthenticationResponse represents an Azure API authentication response. -type AzureAuthenticationResponse struct { - AccessToken string `json:"access_token"` - ExpiresOn string `json:"expires_on"` -} - -// ExecuteAzureAuthenticationRequest is used to execute an authentication request -// against the Azure API. It re-uses the same http.Client. -func (client *HTTPClient) ExecuteAzureAuthenticationRequest(credentials *portainer.AzureCredentials) (*AzureAuthenticationResponse, error) { - loginURL := fmt.Sprintf("https://login.microsoftonline.com/%s/oauth2/token", credentials.TenantID) - params := url.Values{ - "grant_type": {"client_credentials"}, - "client_id": {credentials.ApplicationID}, - "client_secret": {credentials.AuthenticationKey}, - "resource": {"https://management.azure.com/"}, - } - - response, err := client.PostForm(loginURL, params) - if err != nil { - return nil, err - } - - if response.StatusCode != http.StatusOK { - return nil, portainer.ErrAzureInvalidCredentials - } - - var token AzureAuthenticationResponse - err = json.NewDecoder(response.Body).Decode(&token) - if err != nil { - return nil, err - } - - return &token, nil -} - // Get executes a simple HTTP GET to the specified URL and returns // the content of the response body. Timeout can be specified via the timeout parameter, // will default to defaultHTTPTimeout if set to 0. diff --git a/api/http/handler/endpointproxy/handler.go b/api/http/handler/endpointproxy/handler.go index be89bb750..ed81a6527 100644 --- a/api/http/handler/endpointproxy/handler.go +++ b/api/http/handler/endpointproxy/handler.go @@ -24,8 +24,6 @@ func NewHandler(bouncer *security.RequestBouncer) *Handler { Router: mux.NewRouter(), requestBouncer: bouncer, } - h.PathPrefix("/{id}/azure").Handler( - bouncer.AuthenticatedAccess(httperror.LoggerHandler(h.proxyRequestsToAzureAPI))) h.PathPrefix("/{id}/docker").Handler( bouncer.AuthenticatedAccess(httperror.LoggerHandler(h.proxyRequestsToDockerAPI))) h.PathPrefix("/{id}/storidge").Handler( diff --git a/api/http/handler/endpointproxy/proxy_azure.go b/api/http/handler/endpointproxy/proxy_azure.go deleted file mode 100644 index 6ffc4598a..000000000 --- a/api/http/handler/endpointproxy/proxy_azure.go +++ /dev/null @@ -1,43 +0,0 @@ -package endpointproxy - -import ( - "strconv" - - httperror "github.com/portainer/libhttp/error" - "github.com/portainer/libhttp/request" - "github.com/portainer/portainer/api" - - "net/http" -) - -func (handler *Handler) proxyRequestsToAzureAPI(w http.ResponseWriter, r *http.Request) *httperror.HandlerError { - endpointID, err := request.RetrieveNumericRouteVariableValue(r, "id") - if err != nil { - return &httperror.HandlerError{http.StatusBadRequest, "Invalid endpoint identifier route variable", err} - } - - endpoint, err := handler.EndpointService.Endpoint(portainer.EndpointID(endpointID)) - if err == portainer.ErrObjectNotFound { - return &httperror.HandlerError{http.StatusNotFound, "Unable to find an endpoint with the specified identifier inside the database", err} - } else if err != nil { - return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} - } - - err = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint, false) - if err != nil { - return &httperror.HandlerError{http.StatusForbidden, "Permission denied to access endpoint", err} - } - - var proxy http.Handler - proxy = handler.ProxyManager.GetEndpointProxy(endpoint) - if proxy == nil { - proxy, err = handler.ProxyManager.CreateAndRegisterEndpointProxy(endpoint) - if err != nil { - return &httperror.HandlerError{http.StatusInternalServerError, "Unable to create proxy", err} - } - } - - id := strconv.Itoa(endpointID) - http.StripPrefix("/"+id+"/azure", proxy).ServeHTTP(w, r) - return nil -} diff --git a/api/http/handler/endpoints/endpoint_create.go b/api/http/handler/endpoints/endpoint_create.go index f037c88ab..cd1b84cb5 100644 --- a/api/http/handler/endpoints/endpoint_create.go +++ b/api/http/handler/endpoints/endpoint_create.go @@ -18,21 +18,18 @@ import ( ) type endpointCreatePayload struct { - Name string - URL string - EndpointType int - PublicURL string - GroupID int - TLS bool - TLSSkipVerify bool - TLSSkipClientVerify bool - TLSCACertFile []byte - TLSCertFile []byte - TLSKeyFile []byte - AzureApplicationID string - AzureTenantID string - AzureAuthenticationKey string - TagIDs []portainer.TagID + Name string + URL string + EndpointType int + PublicURL string + GroupID int + TLS bool + TLSSkipVerify bool + TLSSkipClientVerify bool + TLSCACertFile []byte + TLSCertFile []byte + TLSKeyFile []byte + TagIDs []portainer.TagID } func (payload *endpointCreatePayload) Validate(r *http.Request) error { @@ -44,7 +41,7 @@ func (payload *endpointCreatePayload) Validate(r *http.Request) error { endpointType, err := request.RetrieveNumericMultiPartFormValue(r, "EndpointType", false) if err != nil || endpointType == 0 { - return portainer.Error("Invalid endpoint type value. Value must be one of: 1 (Docker environment), 2 (Agent environment), 3 (Azure environment) or 4 (Edge Agent environment)") + return portainer.Error("Invalid endpoint type value. Value must be one of: 1 (Docker environment), 2 (Agent environment) or 4 (Edge Agent environment)") } payload.EndpointType = endpointType @@ -96,35 +93,14 @@ func (payload *endpointCreatePayload) Validate(r *http.Request) error { } } - switch portainer.EndpointType(payload.EndpointType) { - case portainer.AzureEnvironment: - azureApplicationID, err := request.RetrieveMultiPartFormValue(r, "AzureApplicationID", false) - if err != nil { - return portainer.Error("Invalid Azure application ID") - } - payload.AzureApplicationID = azureApplicationID - - azureTenantID, err := request.RetrieveMultiPartFormValue(r, "AzureTenantID", false) - if err != nil { - return portainer.Error("Invalid Azure tenant ID") - } - payload.AzureTenantID = azureTenantID - - azureAuthenticationKey, err := request.RetrieveMultiPartFormValue(r, "AzureAuthenticationKey", false) - if err != nil { - return portainer.Error("Invalid Azure authentication key") - } - payload.AzureAuthenticationKey = azureAuthenticationKey - default: - url, err := request.RetrieveMultiPartFormValue(r, "URL", true) - if err != nil { - return portainer.Error("Invalid endpoint URL") - } - payload.URL = url - - publicURL, _ := request.RetrieveMultiPartFormValue(r, "PublicURL", true) - payload.PublicURL = publicURL + endpointURL, err := request.RetrieveMultiPartFormValue(r, "URL", true) + if err != nil { + return portainer.Error("Invalid endpoint URL") } + payload.URL = endpointURL + + publicURL, _ := request.RetrieveMultiPartFormValue(r, "PublicURL", true) + payload.PublicURL = publicURL return nil } @@ -178,9 +154,7 @@ func (handler *Handler) endpointCreate(w http.ResponseWriter, r *http.Request) * } func (handler *Handler) createEndpoint(payload *endpointCreatePayload) (*portainer.Endpoint, *httperror.HandlerError) { - if portainer.EndpointType(payload.EndpointType) == portainer.AzureEnvironment { - return handler.createAzureEndpoint(payload) - } else if portainer.EndpointType(payload.EndpointType) == portainer.EdgeAgentEnvironment { + if portainer.EndpointType(payload.EndpointType) == portainer.EdgeAgentEnvironment { return handler.createEdgeAgentEndpoint(payload) } @@ -190,44 +164,6 @@ func (handler *Handler) createEndpoint(payload *endpointCreatePayload) (*portain return handler.createUnsecuredEndpoint(payload) } -func (handler *Handler) createAzureEndpoint(payload *endpointCreatePayload) (*portainer.Endpoint, *httperror.HandlerError) { - credentials := portainer.AzureCredentials{ - ApplicationID: payload.AzureApplicationID, - TenantID: payload.AzureTenantID, - AuthenticationKey: payload.AzureAuthenticationKey, - } - - httpClient := client.NewHTTPClient() - _, err := httpClient.ExecuteAzureAuthenticationRequest(&credentials) - if err != nil { - return nil, &httperror.HandlerError{http.StatusInternalServerError, "Unable to authenticate against Azure", err} - } - - endpointID := handler.EndpointService.GetNextIdentifier() - endpoint := &portainer.Endpoint{ - ID: portainer.EndpointID(endpointID), - Name: payload.Name, - URL: "https://management.azure.com", - Type: portainer.AzureEnvironment, - GroupID: portainer.EndpointGroupID(payload.GroupID), - PublicURL: payload.PublicURL, - UserAccessPolicies: portainer.UserAccessPolicies{}, - TeamAccessPolicies: portainer.TeamAccessPolicies{}, - Extensions: []portainer.EndpointExtension{}, - AzureCredentials: credentials, - TagIDs: payload.TagIDs, - Status: portainer.EndpointStatusUp, - Snapshots: []portainer.Snapshot{}, - } - - err = handler.saveEndpointAndUpdateAuthorizations(endpoint) - if err != nil { - return nil, &httperror.HandlerError{http.StatusInternalServerError, "An error occured while trying to create the endpoint", err} - } - - return endpoint, nil -} - func (handler *Handler) createEdgeAgentEndpoint(payload *endpointCreatePayload) (*portainer.Endpoint, *httperror.HandlerError) { endpointType := portainer.EdgeAgentEnvironment endpointID := handler.EndpointService.GetNextIdentifier() diff --git a/api/http/handler/endpoints/endpoint_snapshot.go b/api/http/handler/endpoints/endpoint_snapshot.go index de3eba46c..ba73674a9 100644 --- a/api/http/handler/endpoints/endpoint_snapshot.go +++ b/api/http/handler/endpoints/endpoint_snapshot.go @@ -23,10 +23,6 @@ func (handler *Handler) endpointSnapshot(w http.ResponseWriter, r *http.Request) return &httperror.HandlerError{http.StatusInternalServerError, "Unable to find an endpoint with the specified identifier inside the database", err} } - if endpoint.Type == portainer.AzureEnvironment { - return &httperror.HandlerError{http.StatusBadRequest, "Snapshots not supported for Azure endpoints", err} - } - snapshot, snapshotError := handler.Snapshotter.CreateSnapshot(endpoint) latestEndpointReference, err := handler.EndpointService.Endpoint(endpoint.ID) diff --git a/api/http/handler/endpoints/endpoint_snapshots.go b/api/http/handler/endpoints/endpoint_snapshots.go index e25be6f89..11a5b07ab 100644 --- a/api/http/handler/endpoints/endpoint_snapshots.go +++ b/api/http/handler/endpoints/endpoint_snapshots.go @@ -17,10 +17,6 @@ func (handler *Handler) endpointSnapshots(w http.ResponseWriter, r *http.Request } for _, endpoint := range endpoints { - if endpoint.Type == portainer.AzureEnvironment { - continue - } - snapshot, snapshotError := handler.Snapshotter.CreateSnapshot(&endpoint) latestEndpointReference, err := handler.EndpointService.Endpoint(endpoint.ID) diff --git a/api/http/handler/endpoints/endpoint_update.go b/api/http/handler/endpoints/endpoint_update.go index 8fe0b920c..a1c63d53c 100644 --- a/api/http/handler/endpoints/endpoint_update.go +++ b/api/http/handler/endpoints/endpoint_update.go @@ -9,24 +9,20 @@ import ( "github.com/portainer/libhttp/request" "github.com/portainer/libhttp/response" "github.com/portainer/portainer/api" - "github.com/portainer/portainer/api/http/client" ) type endpointUpdatePayload struct { - Name *string - URL *string - PublicURL *string - GroupID *int - TLS *bool - TLSSkipVerify *bool - TLSSkipClientVerify *bool - Status *int - AzureApplicationID *string - AzureTenantID *string - AzureAuthenticationKey *string - TagIDs []portainer.TagID - UserAccessPolicies portainer.UserAccessPolicies - TeamAccessPolicies portainer.TeamAccessPolicies + Name *string + URL *string + PublicURL *string + GroupID *int + TLS *bool + TLSSkipVerify *bool + TLSSkipClientVerify *bool + Status *int + TagIDs []portainer.TagID + UserAccessPolicies portainer.UserAccessPolicies + TeamAccessPolicies portainer.TeamAccessPolicies } func (payload *endpointUpdatePayload) Validate(r *http.Request) error { @@ -137,26 +133,6 @@ func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) * } } - if endpoint.Type == portainer.AzureEnvironment { - credentials := endpoint.AzureCredentials - if payload.AzureApplicationID != nil { - credentials.ApplicationID = *payload.AzureApplicationID - } - if payload.AzureTenantID != nil { - credentials.TenantID = *payload.AzureTenantID - } - if payload.AzureAuthenticationKey != nil { - credentials.AuthenticationKey = *payload.AzureAuthenticationKey - } - - httpClient := client.NewHTTPClient() - _, authErr := httpClient.ExecuteAzureAuthenticationRequest(&credentials) - if authErr != nil { - return &httperror.HandlerError{http.StatusInternalServerError, "Unable to authenticate against Azure", authErr} - } - endpoint.AzureCredentials = credentials - } - if payload.TLS != nil { folder := strconv.Itoa(endpointID) @@ -201,7 +177,7 @@ func (handler *Handler) endpointUpdate(w http.ResponseWriter, r *http.Request) * } } - if payload.URL != nil || payload.TLS != nil || endpoint.Type == portainer.AzureEnvironment { + if payload.URL != nil || payload.TLS != nil { _, err = handler.ProxyManager.CreateAndRegisterEndpointProxy(endpoint) if err != nil { return &httperror.HandlerError{http.StatusInternalServerError, "Unable to register HTTP proxy for the endpoint", err} diff --git a/api/http/handler/endpoints/handler.go b/api/http/handler/endpoints/handler.go index f7a19d106..605c81322 100644 --- a/api/http/handler/endpoints/handler.go +++ b/api/http/handler/endpoints/handler.go @@ -12,7 +12,6 @@ import ( ) func hideFields(endpoint *portainer.Endpoint) { - endpoint.AzureCredentials = portainer.AzureCredentials{} if len(endpoint.Snapshots) > 0 { endpoint.Snapshots[0].SnapshotRaw = portainer.SnapshotRaw{} } diff --git a/api/http/handler/handler.go b/api/http/handler/handler.go index 8b167b12e..ad0fa92df 100644 --- a/api/http/handler/handler.go +++ b/api/http/handler/handler.go @@ -90,8 +90,6 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r) case strings.Contains(r.URL.Path, "/storidge/"): http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r) - case strings.Contains(r.URL.Path, "/azure/"): - http.StripPrefix("/api/endpoints", h.EndpointProxyHandler).ServeHTTP(w, r) case strings.Contains(r.URL.Path, "/edge/"): http.StripPrefix("/api/endpoints", h.EndpointEdgeHandler).ServeHTTP(w, r) default: diff --git a/api/http/proxy/factory/azure.go b/api/http/proxy/factory/azure.go deleted file mode 100644 index 27b8a26f8..000000000 --- a/api/http/proxy/factory/azure.go +++ /dev/null @@ -1,20 +0,0 @@ -package factory - -import ( - "net/http" - "net/url" - - portainer "github.com/portainer/portainer/api" - "github.com/portainer/portainer/api/http/proxy/factory/azure" -) - -func newAzureProxy(endpoint *portainer.Endpoint) (http.Handler, error) { - remoteURL, err := url.Parse(azureAPIBaseURL) - if err != nil { - return nil, err - } - - proxy := newSingleHostReverseProxyWithHostHeader(remoteURL) - proxy.Transport = azure.NewTransport(&endpoint.AzureCredentials) - return proxy, nil -} diff --git a/api/http/proxy/factory/azure/transport.go b/api/http/proxy/factory/azure/transport.go deleted file mode 100644 index 0c8505c8b..000000000 --- a/api/http/proxy/factory/azure/transport.go +++ /dev/null @@ -1,80 +0,0 @@ -package azure - -import ( - "net/http" - "strconv" - "sync" - "time" - - "github.com/portainer/portainer/api" - "github.com/portainer/portainer/api/http/client" -) - -type ( - azureAPIToken struct { - value string - expirationTime time.Time - } - - Transport struct { - credentials *portainer.AzureCredentials - client *client.HTTPClient - token *azureAPIToken - mutex sync.Mutex - } -) - -// NewTransport returns a pointer to a new instance of Transport that implements the HTTP Transport -// interface for proxying requests to the Azure API. -func NewTransport(credentials *portainer.AzureCredentials) *Transport { - return &Transport{ - credentials: credentials, - client: client.NewHTTPClient(), - } -} - -// RoundTrip is the implementation of the the http.RoundTripper interface -func (transport *Transport) RoundTrip(request *http.Request) (*http.Response, error) { - err := transport.retrieveAuthenticationToken() - if err != nil { - return nil, err - } - - request.Header.Set("Authorization", "Bearer "+transport.token.value) - return http.DefaultTransport.RoundTrip(request) -} - -func (transport *Transport) authenticate() error { - token, err := transport.client.ExecuteAzureAuthenticationRequest(transport.credentials) - if err != nil { - return err - } - - expiresOn, err := strconv.ParseInt(token.ExpiresOn, 10, 64) - if err != nil { - return err - } - - transport.token = &azureAPIToken{ - value: token.AccessToken, - expirationTime: time.Unix(expiresOn, 0), - } - - return nil -} - -func (transport *Transport) retrieveAuthenticationToken() error { - transport.mutex.Lock() - defer transport.mutex.Unlock() - - if transport.token == nil { - return transport.authenticate() - } - - timeLimit := time.Now().Add(-5 * time.Minute) - if timeLimit.After(transport.token.expirationTime) { - return transport.authenticate() - } - - return nil -} diff --git a/api/http/proxy/factory/factory.go b/api/http/proxy/factory/factory.go index 207977f21..3f44b1211 100644 --- a/api/http/proxy/factory/factory.go +++ b/api/http/proxy/factory/factory.go @@ -10,8 +10,6 @@ import ( "github.com/portainer/portainer/api/docker" ) -const azureAPIBaseURL = "https://management.azure.com" - var extensionPorts = map[portainer.ExtensionID]string{ portainer.RegistryManagementExtension: "7001", portainer.OAuthAuthenticationExtension: "7002", @@ -100,11 +98,6 @@ func (factory *ProxyFactory) NewLegacyExtensionProxy(extensionAPIURL string) (ht // NewEndpointProxy returns a new reverse proxy (filesystem based or HTTP) to an endpoint API server func (factory *ProxyFactory) NewEndpointProxy(endpoint *portainer.Endpoint) (http.Handler, error) { - switch endpoint.Type { - case portainer.AzureEnvironment: - return newAzureProxy(endpoint) - } - return factory.newDockerProxy(endpoint) } diff --git a/api/portainer.go b/api/portainer.go index 2666fc24b..a53c5355c 100644 --- a/api/portainer.go +++ b/api/portainer.go @@ -25,7 +25,7 @@ type ( Authorizations map[Authorization]bool // AzureCredentials represents the credentials used to connect to an Azure - // environment. + // environment (deprecated). AzureCredentials struct { ApplicationID string `json:"ApplicationID"` TenantID string `json:"TenantID"` @@ -140,7 +140,6 @@ type ( PublicURL string `json:"PublicURL"` TLSConfig TLSConfiguration `json:"TLSConfig"` Extensions []EndpointExtension `json:"Extensions"` - AzureCredentials AzureCredentials `json:"AzureCredentials,omitempty"` TagIDs []TagID `json:"TagIds"` Status EndpointStatus `json:"Status"` Snapshots []Snapshot `json:"Snapshots"` @@ -161,6 +160,9 @@ type ( // Deprecated in DBVersion == 22 Tags []string `json:"Tags"` + + // Deprecated in DBVersion == 24 + AzureCredentials AzureCredentials `json:"AzureCredentials,omitempty"` } // EndpointAuthorizations represents the authorizations associated to a set of endpoints @@ -1000,7 +1002,7 @@ const ( // APIVersion is the version number of the Portainer API APIVersion = "2.0.0-dev" // DBVersion is the version number of the Portainer database - DBVersion = 23 + DBVersion = 24 // AssetsServerURL represents the URL of the Portainer asset server AssetsServerURL = "https://portainer-io-assets.sfo2.digitaloceanspaces.com" // MessageOfTheDayURL represents the URL where Portainer MOTD message can be retrieved @@ -1074,7 +1076,7 @@ const ( DockerEnvironment // AgentOnDockerEnvironment represents an endpoint connected to a Portainer agent deployed on a Docker environment AgentOnDockerEnvironment - // AzureEnvironment represents an endpoint connected to an Azure environment + // AzureEnvironment represents an endpoint connected to an Azure environment (deprecated) AzureEnvironment // EdgeAgentEnvironment represents an endpoint connected to an Edge agent EdgeAgentEnvironment diff --git a/api/swagger.yaml b/api/swagger.yaml index 2ecd61139..abb4aa686 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -254,7 +254,7 @@ paths: - name: "EndpointType" in: "formData" type: "integer" - description: "Environment type. Value must be one of: 1 (Docker environment), 2 (Agent environment), 3 (Azure environment) or 4 (Edge agent environment)" + description: "Environment type. Value must be one of: 1 (Docker environment), 2 (Agent environment) or 4 (Edge agent environment)" required: true - name: "URL" in: "formData" @@ -294,18 +294,6 @@ paths: in: "formData" type: "file" description: "TLS client key file" - - name: "AzureApplicationID" - in: "formData" - type: "string" - description: "Azure application ID. Required if endpoint type is set to 3" - - name: "AzureTenantID" - in: "formData" - type: "string" - description: "Azure tenant ID. Required if endpoint type is set to 3" - - name: "AzureAuthenticationKey" - in: "formData" - type: "string" - description: "Azure authentication key. Required if endpoint type is set to 3" responses: 200: description: "Success" @@ -3221,21 +3209,6 @@ definitions: type: "string" example: "/data/tls/key.pem" description: "Path to the TLS client key file" - AzureCredentials: - type: "object" - properties: - ApplicationID: - type: "string" - example: "eag7cdo9-o09l-9i83-9dO9-f0b23oe78db4" - description: "Azure application ID" - TenantID: - type: "string" - example: "34ddc78d-4fel-2358-8cc1-df84c8o839f5" - description: "Azure tenant ID" - AuthenticationKey: - type: "string" - example: "cOrXoK/1D35w8YQ8nH1/8ZGwzz45JIYD5jxHKXEQknk=" - description: "Azure authentication key" LDAPSearchSettings: type: "object" properties: @@ -3507,7 +3480,7 @@ definitions: Type: type: "integer" example: 1 - description: "Endpoint environment type. 1 for a Docker environment, 2 for an agent on Docker environment or 3 for an Azure environment." + description: "Endpoint environment type. 1 for a Docker environment or 2 for an agent on Docker environment" URL: type: "string" example: "docker.mydomain.tld:2375" @@ -3536,8 +3509,6 @@ definitions: description: "Team identifier" TLSConfig: $ref: "#/definitions/TLSConfiguration" - AzureCredentials: - $ref: "#/definitions/AzureCredentials" EndpointSubset: type: "object" properties: @@ -3552,7 +3523,7 @@ definitions: Type: type: "integer" example: 1 - description: "Endpoint environment type. 1 for a Docker environment, 2 for an agent on Docker environment, 3 for an Azure environment." + description: "Endpoint environment type. 1 for a Docker environment or 2 for an agent on Docker environment" URL: type: "string" example: "docker.mydomain.tld:2375" @@ -3732,18 +3703,6 @@ definitions: type: "boolean" example: false description: "Skip client verification when using TLS" - ApplicationID: - type: "string" - example: "eag7cdo9-o09l-9i83-9dO9-f0b23oe78db4" - description: "Azure application ID" - TenantID: - type: "string" - example: "34ddc78d-4fel-2358-8cc1-df84c8o839f5" - description: "Azure tenant ID" - AuthenticationKey: - type: "string" - example: "cOrXoK/1D35w8YQ8nH1/8ZGwzz45JIYD5jxHKXEQknk=" - description: "Azure authentication key" UserAccessPolicies: $ref: "#/definitions/UserAccessPolicies" TeamAccessPolicies: diff --git a/app/__module.js b/app/__module.js index 53c901aab..0c3cde285 100644 --- a/app/__module.js +++ b/app/__module.js @@ -2,7 +2,6 @@ import '../assets/css/app.css'; import angular from 'angular'; import './agent/_module'; -import './azure/_module'; import './docker/__module'; import './edge/__module'; import './portainer/__module'; @@ -28,7 +27,6 @@ angular.module('portainer', [ 'luegg.directives', 'portainer.app', 'portainer.agent', - 'portainer.azure', 'portainer.docker', 'portainer.edge', 'portainer.extensions', diff --git a/app/azure/_module.js b/app/azure/_module.js deleted file mode 100644 index a11a5aa5e..000000000 --- a/app/azure/_module.js +++ /dev/null @@ -1,51 +0,0 @@ -angular.module('portainer.azure', ['portainer.app']).config([ - '$stateRegistryProvider', - function ($stateRegistryProvider) { - 'use strict'; - - var azure = { - name: 'azure', - url: '/azure', - parent: 'root', - abstract: true, - }; - - var containerInstances = { - name: 'azure.containerinstances', - url: '/containerinstances', - views: { - 'content@': { - templateUrl: './views/containerinstances/containerinstances.html', - controller: 'AzureContainerInstancesController', - }, - }, - }; - - var containerInstanceCreation = { - name: 'azure.containerinstances.new', - url: '/new/', - views: { - 'content@': { - templateUrl: './views/containerinstances/create/createcontainerinstance.html', - controller: 'AzureCreateContainerInstanceController', - }, - }, - }; - - var dashboard = { - name: 'azure.dashboard', - url: '/dashboard', - views: { - 'content@': { - templateUrl: './views/dashboard/dashboard.html', - controller: 'AzureDashboardController', - }, - }, - }; - - $stateRegistryProvider.register(azure); - $stateRegistryProvider.register(containerInstances); - $stateRegistryProvider.register(containerInstanceCreation); - $stateRegistryProvider.register(dashboard); - }, -]); diff --git a/app/azure/components/azure-endpoint-config/azure-endpoint-config.js b/app/azure/components/azure-endpoint-config/azure-endpoint-config.js deleted file mode 100644 index ff09f0908..000000000 --- a/app/azure/components/azure-endpoint-config/azure-endpoint-config.js +++ /dev/null @@ -1,8 +0,0 @@ -angular.module('portainer.azure').component('azureEndpointConfig', { - bindings: { - applicationId: '=', - tenantId: '=', - authenticationKey: '=', - }, - templateUrl: './azureEndpointConfig.html', -}); diff --git a/app/azure/components/azure-endpoint-config/azureEndpointConfig.html b/app/azure/components/azure-endpoint-config/azureEndpointConfig.html deleted file mode 100644 index efc8bd79f..000000000 --- a/app/azure/components/azure-endpoint-config/azureEndpointConfig.html +++ /dev/null @@ -1,36 +0,0 @@ -
-
- Azure configuration -
- -
- -
- -
-
- - -
- -
- -
-
- - -
- -
- -
-
- -
diff --git a/app/azure/components/azure-sidebar-content/azure-sidebar-content.js b/app/azure/components/azure-sidebar-content/azure-sidebar-content.js deleted file mode 100644 index daec3ef12..000000000 --- a/app/azure/components/azure-sidebar-content/azure-sidebar-content.js +++ /dev/null @@ -1,3 +0,0 @@ -angular.module('portainer.azure').component('azureSidebarContent', { - templateUrl: './azureSidebarContent.html', -}); diff --git a/app/azure/components/azure-sidebar-content/azureSidebarContent.html b/app/azure/components/azure-sidebar-content/azureSidebarContent.html deleted file mode 100644 index 01986e8e7..000000000 --- a/app/azure/components/azure-sidebar-content/azureSidebarContent.html +++ /dev/null @@ -1,6 +0,0 @@ - - diff --git a/app/azure/components/datatables/containergroups-datatable/containerGroupsDatatable.html b/app/azure/components/datatables/containergroups-datatable/containerGroupsDatatable.html deleted file mode 100644 index f9936d78b..000000000 --- a/app/azure/components/datatables/containergroups-datatable/containerGroupsDatatable.html +++ /dev/null @@ -1,105 +0,0 @@ -
- - -
-
{{ $ctrl.titleText }}
-
-
- - -
- -
- - - - - - - - - - - - - - - - - - - - - -
- - - - - - Name - - - - - - Location - - - - - Published Ports -
- - - - - {{ item.Name | truncate: 50 }} - {{ item.Location }} - - :{{ p.port }} - - - -
Loading...
No container available.
-
- -
-
-
diff --git a/app/azure/components/datatables/containergroups-datatable/containerGroupsDatatable.js b/app/azure/components/datatables/containergroups-datatable/containerGroupsDatatable.js deleted file mode 100644 index 8d91518a9..000000000 --- a/app/azure/components/datatables/containergroups-datatable/containerGroupsDatatable.js +++ /dev/null @@ -1,13 +0,0 @@ -angular.module('portainer.azure').component('containergroupsDatatable', { - templateUrl: './containerGroupsDatatable.html', - controller: 'GenericDatatableController', - bindings: { - title: '@', - titleIcon: '@', - dataset: '<', - tableKey: '@', - orderBy: '@', - reverseOrder: '<', - removeAction: '<', - }, -}); diff --git a/app/azure/models/container_group.js b/app/azure/models/container_group.js deleted file mode 100644 index dfc9adeef..000000000 --- a/app/azure/models/container_group.js +++ /dev/null @@ -1,66 +0,0 @@ -export function ContainerGroupDefaultModel() { - this.Location = ''; - this.OSType = 'Linux'; - this.Name = ''; - this.Image = ''; - this.AllocatePublicIP = true; - this.Ports = [ - { - container: 80, - host: 80, - protocol: 'TCP', - }, - ]; - this.CPU = 1; - this.Memory = 1; -} - -export function ContainerGroupViewModel(data) { - this.Id = data.id; - this.Name = data.name; - this.Location = data.location; - this.IPAddress = data.properties.ipAddress.ip; - this.Ports = data.properties.ipAddress.ports; -} - -export function CreateContainerGroupRequest(model) { - this.location = model.Location; - - var containerPorts = []; - var addressPorts = []; - for (var i = 0; i < model.Ports.length; i++) { - var binding = model.Ports[i]; - - containerPorts.push({ - port: binding.container, - }); - - addressPorts.push({ - port: binding.host, - protocol: binding.protocol, - }); - } - - this.properties = { - osType: model.OSType, - containers: [ - { - name: model.Name, - properties: { - image: model.Image, - ports: containerPorts, - resources: { - requests: { - cpu: model.CPU, - memoryInGB: model.Memory, - }, - }, - }, - }, - ], - ipAddress: { - type: model.AllocatePublicIP ? 'Public' : 'Private', - ports: addressPorts, - }, - }; -} diff --git a/app/azure/models/location.js b/app/azure/models/location.js deleted file mode 100644 index 6d4031331..000000000 --- a/app/azure/models/location.js +++ /dev/null @@ -1,6 +0,0 @@ -export function LocationViewModel(data) { - this.Id = data.id; - this.SubscriptionId = data.subscriptionId; - this.DisplayName = data.displayName; - this.Name = data.name; -} diff --git a/app/azure/models/provider.js b/app/azure/models/provider.js deleted file mode 100644 index d9d6c8075..000000000 --- a/app/azure/models/provider.js +++ /dev/null @@ -1,9 +0,0 @@ -import _ from 'lodash-es'; - -export function ContainerInstanceProviderViewModel(data) { - this.Id = data.id; - this.Namespace = data.namespace; - - var containerGroupType = _.find(data.resourceTypes, { resourceType: 'containerGroups' }); - this.Locations = containerGroupType.locations; -} diff --git a/app/azure/models/resource_group.js b/app/azure/models/resource_group.js deleted file mode 100644 index 894ce326d..000000000 --- a/app/azure/models/resource_group.js +++ /dev/null @@ -1,6 +0,0 @@ -export function ResourceGroupViewModel(data, subscriptionId) { - this.Id = data.id; - this.SubscriptionId = subscriptionId; - this.Name = data.name; - this.Location = data.location; -} diff --git a/app/azure/models/subscription.js b/app/azure/models/subscription.js deleted file mode 100644 index eb9bfaf52..000000000 --- a/app/azure/models/subscription.js +++ /dev/null @@ -1,4 +0,0 @@ -export function SubscriptionViewModel(data) { - this.Id = data.subscriptionId; - this.Name = data.displayName; -} diff --git a/app/azure/rest/azure.js b/app/azure/rest/azure.js deleted file mode 100644 index f463624d6..000000000 --- a/app/azure/rest/azure.js +++ /dev/null @@ -1,20 +0,0 @@ -angular.module('portainer.azure').factory('Azure', [ - '$http', - 'API_ENDPOINT_ENDPOINTS', - 'EndpointProvider', - function AzureFactory($http, API_ENDPOINT_ENDPOINTS, EndpointProvider) { - 'use strict'; - - var service = {}; - - service.delete = function (id, apiVersion) { - var url = API_ENDPOINT_ENDPOINTS + '/' + EndpointProvider.endpointID() + '/azure' + id + '?api-version=' + apiVersion; - return $http({ - method: 'DELETE', - url: url, - }); - }; - - return service; - }, -]); diff --git a/app/azure/rest/container_group.js b/app/azure/rest/container_group.js deleted file mode 100644 index 4dc7a002d..000000000 --- a/app/azure/rest/container_group.js +++ /dev/null @@ -1,45 +0,0 @@ -angular.module('portainer.azure').factory('ContainerGroup', [ - '$resource', - 'API_ENDPOINT_ENDPOINTS', - 'EndpointProvider', - function ContainerGroupFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) { - 'use strict'; - - var resource = {}; - - var base = $resource( - API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions/:subscriptionId/providers/Microsoft.ContainerInstance/containerGroups', - { - endpointId: EndpointProvider.endpointID, - 'api-version': '2018-04-01', - }, - { - query: { method: 'GET', params: { subscriptionId: '@subscriptionId' } }, - } - ); - - var withResourceGroup = $resource( - API_ENDPOINT_ENDPOINTS + - '/:endpointId/azure/subscriptions/:subscriptionId/resourceGroups/:resourceGroupName/providers/Microsoft.ContainerInstance/containerGroups/:containerGroupName', - { - endpointId: EndpointProvider.endpointID, - 'api-version': '2018-04-01', - }, - { - create: { - method: 'PUT', - params: { - subscriptionId: '@subscriptionId', - resourceGroupName: '@resourceGroupName', - containerGroupName: '@containerGroupName', - }, - }, - } - ); - - resource.query = base.query; - resource.create = withResourceGroup.create; - - return resource; - }, -]); diff --git a/app/azure/rest/location.js b/app/azure/rest/location.js deleted file mode 100644 index 7503d9fc9..000000000 --- a/app/azure/rest/location.js +++ /dev/null @@ -1,18 +0,0 @@ -angular.module('portainer.azure').factory('Location', [ - '$resource', - 'API_ENDPOINT_ENDPOINTS', - 'EndpointProvider', - function LocationFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) { - 'use strict'; - return $resource( - API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions/:subscriptionId/locations', - { - endpointId: EndpointProvider.endpointID, - 'api-version': '2016-06-01', - }, - { - query: { method: 'GET', params: { subscriptionId: '@subscriptionId' } }, - } - ); - }, -]); diff --git a/app/azure/rest/provider.js b/app/azure/rest/provider.js deleted file mode 100644 index b8e76d81e..000000000 --- a/app/azure/rest/provider.js +++ /dev/null @@ -1,18 +0,0 @@ -angular.module('portainer.azure').factory('Provider', [ - '$resource', - 'API_ENDPOINT_ENDPOINTS', - 'EndpointProvider', - function ProviderFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) { - 'use strict'; - return $resource( - API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions/:subscriptionId/providers/:providerNamespace', - { - endpointId: EndpointProvider.endpointID, - 'api-version': '2018-02-01', - }, - { - get: { method: 'GET', params: { subscriptionId: '@subscriptionId', providerNamespace: '@providerNamespace' } }, - } - ); - }, -]); diff --git a/app/azure/rest/resource_group.js b/app/azure/rest/resource_group.js deleted file mode 100644 index 644279f3b..000000000 --- a/app/azure/rest/resource_group.js +++ /dev/null @@ -1,18 +0,0 @@ -angular.module('portainer.azure').factory('ResourceGroup', [ - '$resource', - 'API_ENDPOINT_ENDPOINTS', - 'EndpointProvider', - function ResourceGroupFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) { - 'use strict'; - return $resource( - API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions/:subscriptionId/resourcegroups', - { - endpointId: EndpointProvider.endpointID, - 'api-version': '2018-02-01', - }, - { - query: { method: 'GET', params: { subscriptionId: '@subscriptionId' } }, - } - ); - }, -]); diff --git a/app/azure/rest/subscription.js b/app/azure/rest/subscription.js deleted file mode 100644 index 0711d5f92..000000000 --- a/app/azure/rest/subscription.js +++ /dev/null @@ -1,18 +0,0 @@ -angular.module('portainer.azure').factory('Subscription', [ - '$resource', - 'API_ENDPOINT_ENDPOINTS', - 'EndpointProvider', - function SubscriptionFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) { - 'use strict'; - return $resource( - API_ENDPOINT_ENDPOINTS + '/:endpointId/azure/subscriptions', - { - endpointId: EndpointProvider.endpointID, - 'api-version': '2016-06-01', - }, - { - query: { method: 'GET' }, - } - ); - }, -]); diff --git a/app/azure/services/azureService.js b/app/azure/services/azureService.js deleted file mode 100644 index b6c3ba0aa..000000000 --- a/app/azure/services/azureService.js +++ /dev/null @@ -1,72 +0,0 @@ -angular.module('portainer.azure').factory('AzureService', [ - '$q', - 'Azure', - 'SubscriptionService', - 'ResourceGroupService', - 'ContainerGroupService', - 'ProviderService', - function AzureServiceFactory($q, Azure, SubscriptionService, ResourceGroupService, ContainerGroupService, ProviderService) { - 'use strict'; - var service = {}; - - service.deleteContainerGroup = function (id) { - return Azure.delete(id, '2018-04-01'); - }; - - service.createContainerGroup = function (model, subscriptionId, resourceGroupName) { - return ContainerGroupService.create(model, subscriptionId, resourceGroupName); - }; - - service.subscriptions = function () { - return SubscriptionService.subscriptions(); - }; - - service.containerInstanceProvider = function (subscriptions) { - return retrieveResourcesForEachSubscription(subscriptions, ProviderService.containerInstanceProvider); - }; - - service.resourceGroups = function (subscriptions) { - return retrieveResourcesForEachSubscription(subscriptions, ResourceGroupService.resourceGroups); - }; - - service.containerGroups = function (subscriptions) { - return retrieveResourcesForEachSubscription(subscriptions, ContainerGroupService.containerGroups); - }; - - service.aggregate = function (resourcesBySubcription) { - var aggregatedResources = []; - Object.keys(resourcesBySubcription).forEach(function (key) { - aggregatedResources = aggregatedResources.concat(resourcesBySubcription[key]); - }); - return aggregatedResources; - }; - - function retrieveResourcesForEachSubscription(subscriptions, resourceQuery) { - var deferred = $q.defer(); - - var resources = {}; - - var resourceQueries = []; - for (var i = 0; i < subscriptions.length; i++) { - var subscription = subscriptions[i]; - resourceQueries.push(resourceQuery(subscription.Id)); - } - - $q.all(resourceQueries) - .then(function success(data) { - for (var i = 0; i < data.length; i++) { - var result = data[i]; - resources[subscriptions[i].Id] = result; - } - deferred.resolve(resources); - }) - .catch(function error(err) { - deferred.reject({ msg: 'Unable to retrieve resources', err: err }); - }); - - return deferred.promise; - } - - return service; - }, -]); diff --git a/app/azure/services/containerGroupService.js b/app/azure/services/containerGroupService.js deleted file mode 100644 index c99b98ada..000000000 --- a/app/azure/services/containerGroupService.js +++ /dev/null @@ -1,41 +0,0 @@ -import { ContainerGroupViewModel, CreateContainerGroupRequest } from '../models/container_group'; - -angular.module('portainer.azure').factory('ContainerGroupService', [ - '$q', - 'ContainerGroup', - function ContainerGroupServiceFactory($q, ContainerGroup) { - 'use strict'; - var service = {}; - - service.containerGroups = function (subscriptionId) { - var deferred = $q.defer(); - - ContainerGroup.query({ subscriptionId: subscriptionId }) - .$promise.then(function success(data) { - var containerGroups = data.value.map(function (item) { - return new ContainerGroupViewModel(item); - }); - deferred.resolve(containerGroups); - }) - .catch(function error(err) { - deferred.reject({ msg: 'Unable to retrieve container groups', err: err }); - }); - - return deferred.promise; - }; - - service.create = function (model, subscriptionId, resourceGroupName) { - var payload = new CreateContainerGroupRequest(model); - return ContainerGroup.create( - { - subscriptionId: subscriptionId, - resourceGroupName: resourceGroupName, - containerGroupName: model.Name, - }, - payload - ).$promise; - }; - - return service; - }, -]); diff --git a/app/azure/services/locationService.js b/app/azure/services/locationService.js deleted file mode 100644 index a21e7fa0a..000000000 --- a/app/azure/services/locationService.js +++ /dev/null @@ -1,29 +0,0 @@ -import { LocationViewModel } from '../models/location'; - -angular.module('portainer.azure').factory('LocationService', [ - '$q', - 'Location', - function LocationServiceFactory($q, Location) { - 'use strict'; - var service = {}; - - service.locations = function (subscriptionId) { - var deferred = $q.defer(); - - Location.query({ subscriptionId: subscriptionId }) - .$promise.then(function success(data) { - var locations = data.value.map(function (item) { - return new LocationViewModel(item); - }); - deferred.resolve(locations); - }) - .catch(function error(err) { - deferred.reject({ msg: 'Unable to retrieve locations', err: err }); - }); - - return deferred.promise; - }; - - return service; - }, -]); diff --git a/app/azure/services/providerService.js b/app/azure/services/providerService.js deleted file mode 100644 index edc42ae9e..000000000 --- a/app/azure/services/providerService.js +++ /dev/null @@ -1,27 +0,0 @@ -import { ContainerInstanceProviderViewModel } from '../models/provider'; - -angular.module('portainer.azure').factory('ProviderService', [ - '$q', - 'Provider', - function ProviderServiceFactory($q, Provider) { - 'use strict'; - var service = {}; - - service.containerInstanceProvider = function (subscriptionId) { - var deferred = $q.defer(); - - Provider.get({ subscriptionId: subscriptionId, providerNamespace: 'Microsoft.ContainerInstance' }) - .$promise.then(function success(data) { - var provider = new ContainerInstanceProviderViewModel(data); - deferred.resolve(provider); - }) - .catch(function error(err) { - deferred.reject({ msg: 'Unable to retrieve provider', err: err }); - }); - - return deferred.promise; - }; - - return service; - }, -]); diff --git a/app/azure/services/resourceGroupService.js b/app/azure/services/resourceGroupService.js deleted file mode 100644 index 4110835f4..000000000 --- a/app/azure/services/resourceGroupService.js +++ /dev/null @@ -1,29 +0,0 @@ -import { ResourceGroupViewModel } from '../models/resource_group'; - -angular.module('portainer.azure').factory('ResourceGroupService', [ - '$q', - 'ResourceGroup', - function ResourceGroupServiceFactory($q, ResourceGroup) { - 'use strict'; - var service = {}; - - service.resourceGroups = function (subscriptionId) { - var deferred = $q.defer(); - - ResourceGroup.query({ subscriptionId: subscriptionId }) - .$promise.then(function success(data) { - var resourceGroups = data.value.map(function (item) { - return new ResourceGroupViewModel(item, subscriptionId); - }); - deferred.resolve(resourceGroups); - }) - .catch(function error(err) { - deferred.reject({ msg: 'Unable to retrieve resource groups', err: err }); - }); - - return deferred.promise; - }; - - return service; - }, -]); diff --git a/app/azure/services/subscriptionService.js b/app/azure/services/subscriptionService.js deleted file mode 100644 index 3b22ac664..000000000 --- a/app/azure/services/subscriptionService.js +++ /dev/null @@ -1,29 +0,0 @@ -import { SubscriptionViewModel } from '../models/subscription'; - -angular.module('portainer.azure').factory('SubscriptionService', [ - '$q', - 'Subscription', - function SubscriptionServiceFactory($q, Subscription) { - 'use strict'; - var service = {}; - - service.subscriptions = function () { - var deferred = $q.defer(); - - Subscription.query({}) - .$promise.then(function success(data) { - var subscriptions = data.value.map(function (item) { - return new SubscriptionViewModel(item); - }); - deferred.resolve(subscriptions); - }) - .catch(function error(err) { - deferred.reject({ msg: 'Unable to retrieve subscriptions', err: err }); - }); - - return deferred.promise; - }; - - return service; - }, -]); diff --git a/app/azure/views/containerinstances/containerInstancesController.js b/app/azure/views/containerinstances/containerInstancesController.js deleted file mode 100644 index 4863d5cac..000000000 --- a/app/azure/views/containerinstances/containerInstancesController.js +++ /dev/null @@ -1,44 +0,0 @@ -angular.module('portainer.azure').controller('AzureContainerInstancesController', [ - '$scope', - '$state', - 'AzureService', - 'Notifications', - function ($scope, $state, AzureService, Notifications) { - function initView() { - AzureService.subscriptions() - .then(function success(data) { - var subscriptions = data; - return AzureService.containerGroups(subscriptions); - }) - .then(function success(data) { - $scope.containerGroups = AzureService.aggregate(data); - }) - .catch(function error(err) { - Notifications.error('Failure', err, 'Unable to load container groups'); - }); - } - - $scope.deleteAction = function (selectedItems) { - var actionCount = selectedItems.length; - angular.forEach(selectedItems, function (item) { - AzureService.deleteContainerGroup(item.Id) - .then(function success() { - Notifications.success('Container group successfully removed', item.Name); - var index = $scope.containerGroups.indexOf(item); - $scope.containerGroups.splice(index, 1); - }) - .catch(function error(err) { - Notifications.error('Failure', err, 'Unable to remove container group'); - }) - .finally(function final() { - --actionCount; - if (actionCount === 0) { - $state.reload(); - } - }); - }); - }; - - initView(); - }, -]); diff --git a/app/azure/views/containerinstances/containerinstances.html b/app/azure/views/containerinstances/containerinstances.html deleted file mode 100644 index 6c0223852..000000000 --- a/app/azure/views/containerinstances/containerinstances.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - Container instances - - -
-
- -
-
diff --git a/app/azure/views/containerinstances/create/createContainerInstanceController.js b/app/azure/views/containerinstances/create/createContainerInstanceController.js deleted file mode 100644 index 7c2774946..000000000 --- a/app/azure/views/containerinstances/create/createContainerInstanceController.js +++ /dev/null @@ -1,93 +0,0 @@ -import { ContainerGroupDefaultModel } from '../../../models/container_group'; - -angular.module('portainer.azure').controller('AzureCreateContainerInstanceController', [ - '$q', - '$scope', - '$state', - 'AzureService', - 'Notifications', - function ($q, $scope, $state, AzureService, Notifications) { - var allResourceGroups = []; - var allProviders = []; - - $scope.state = { - actionInProgress: false, - selectedSubscription: null, - selectedResourceGroup: null, - }; - - $scope.changeSubscription = function () { - var selectedSubscription = $scope.state.selectedSubscription; - updateResourceGroupsAndLocations(selectedSubscription, allResourceGroups, allProviders); - }; - - $scope.addPortBinding = function () { - $scope.model.Ports.push({ host: '', container: '', protocol: 'TCP' }); - }; - - $scope.removePortBinding = function (index) { - $scope.model.Ports.splice(index, 1); - }; - - $scope.create = function () { - var model = $scope.model; - var subscriptionId = $scope.state.selectedSubscription.Id; - var resourceGroupName = $scope.state.selectedResourceGroup.Name; - - $scope.state.actionInProgress = true; - AzureService.createContainerGroup(model, subscriptionId, resourceGroupName) - .then(function success() { - Notifications.success('Container successfully created', model.Name); - $state.go('azure.containerinstances'); - }) - .catch(function error(err) { - Notifications.error('Failure', err, 'Unable to create container'); - }) - .finally(function final() { - $scope.state.actionInProgress = false; - }); - }; - - function updateResourceGroupsAndLocations(subscription, resourceGroups, providers) { - $scope.state.selectedResourceGroup = resourceGroups[subscription.Id][0]; - $scope.resourceGroups = resourceGroups[subscription.Id]; - - var currentSubLocations = providers[subscription.Id].Locations; - $scope.model.Location = currentSubLocations[0]; - $scope.locations = currentSubLocations; - } - - function initView() { - var model = new ContainerGroupDefaultModel(); - - AzureService.subscriptions() - .then(function success(data) { - var subscriptions = data; - $scope.state.selectedSubscription = subscriptions[0]; - $scope.subscriptions = subscriptions; - - return $q.all({ - resourceGroups: AzureService.resourceGroups(subscriptions), - containerInstancesProviders: AzureService.containerInstanceProvider(subscriptions), - }); - }) - .then(function success(data) { - var resourceGroups = data.resourceGroups; - allResourceGroups = resourceGroups; - - var containerInstancesProviders = data.containerInstancesProviders; - allProviders = containerInstancesProviders; - - $scope.model = model; - - var selectedSubscription = $scope.state.selectedSubscription; - updateResourceGroupsAndLocations(selectedSubscription, resourceGroups, containerInstancesProviders); - }) - .catch(function error(err) { - Notifications.error('Failure', err, 'Unable to retrieve Azure resources'); - }); - } - - initView(); - }, -]); diff --git a/app/azure/views/containerinstances/create/createcontainerinstance.html b/app/azure/views/containerinstances/create/createcontainerinstance.html deleted file mode 100644 index 625e50bc5..000000000 --- a/app/azure/views/containerinstances/create/createcontainerinstance.html +++ /dev/null @@ -1,167 +0,0 @@ - - - Container instances > Add container - - -
-
- - -
-
- Azure settings -
- -
- -
- -
-
- - -
- -
- -
-
- - -
- -
- -
-
- -
- Container configuration -
- -
- -
- -
-
- - -
- -
- -
-
- - -
- -
- -
-
- - -
-
- - - map additional port - -
- -
-
- -
- host - -
- - - - - -
- container - -
- - -
-
- - -
- -
- -
-
- -
- - -
-
- - -
-
- -
- Container resources -
- -
- -
- -
-
- - -
- -
- -
-
- - -
- Actions -
-
-
- -
-
- -
-
-
-
-
diff --git a/app/azure/views/dashboard/dashboard.html b/app/azure/views/dashboard/dashboard.html deleted file mode 100644 index eaa60a53e..000000000 --- a/app/azure/views/dashboard/dashboard.html +++ /dev/null @@ -1,33 +0,0 @@ - - - Dashboard - - -
- - -
diff --git a/app/azure/views/dashboard/dashboardController.js b/app/azure/views/dashboard/dashboardController.js deleted file mode 100644 index 643f900a7..000000000 --- a/app/azure/views/dashboard/dashboardController.js +++ /dev/null @@ -1,23 +0,0 @@ -angular.module('portainer.azure').controller('AzureDashboardController', [ - '$scope', - 'AzureService', - 'Notifications', - function ($scope, AzureService, Notifications) { - function initView() { - AzureService.subscriptions() - .then(function success(data) { - var subscriptions = data; - $scope.subscriptions = subscriptions; - return AzureService.resourceGroups(subscriptions); - }) - .then(function success(data) { - $scope.resourceGroups = AzureService.aggregate(data); - }) - .catch(function error(err) { - Notifications.error('Failure', err, 'Unable to load dashboard data'); - }); - } - - initView(); - }, -]); diff --git a/app/portainer/components/endpoint-list/endpoint-item/endpointItem.html b/app/portainer/components/endpoint-list/endpoint-item/endpointItem.html index 5b98bdc12..500a17ae8 100644 --- a/app/portainer/components/endpoint-list/endpoint-item/endpointItem.html +++ b/app/portainer/components/endpoint-list/endpoint-item/endpointItem.html @@ -1,6 +1,6 @@
- + diff --git a/app/portainer/filters/filters.js b/app/portainer/filters/filters.js index 034dba32c..e4c232ee5 100644 --- a/app/portainer/filters/filters.js +++ b/app/portainer/filters/filters.js @@ -128,8 +128,6 @@ angular return 'Docker'; } else if (type === 2) { return 'Agent'; - } else if (type === 3) { - return 'Azure ACI'; } else if (type === 4) { return 'Edge Agent'; } diff --git a/app/portainer/services/api/endpointService.js b/app/portainer/services/api/endpointService.js index becb4efbf..fd9b327b0 100644 --- a/app/portainer/services/api/endpointService.js +++ b/app/portainer/services/api/endpointService.js @@ -84,20 +84,6 @@ angular.module('portainer.app').factory('EndpointService', [ return deferred.promise; }; - service.createAzureEndpoint = function (name, applicationId, tenantId, authenticationKey, groupId, tagIds) { - var deferred = $q.defer(); - - FileUploadService.createAzureEndpoint(name, applicationId, tenantId, authenticationKey, groupId, tagIds) - .then(function success(response) { - deferred.resolve(response.data); - }) - .catch(function error(err) { - deferred.reject({ msg: 'Unable to connect to Azure', err: err }); - }); - - return deferred.promise; - }; - service.executeJobFromFileUpload = function (image, jobFile, endpointId, nodeName) { return FileUploadService.executeEndpointJob(image, jobFile, endpointId, nodeName); }; diff --git a/app/portainer/services/fileUpload.js b/app/portainer/services/fileUpload.js index 6a571e47a..4f024d814 100644 --- a/app/portainer/services/fileUpload.js +++ b/app/portainer/services/fileUpload.js @@ -137,22 +137,6 @@ angular.module('portainer.app').factory('FileUploadService', [ }); }; - service.createAzureEndpoint = function (name, applicationId, tenantId, authenticationKey, groupId, tagIds) { - return Upload.upload({ - url: 'api/endpoints', - data: { - Name: name, - EndpointType: 3, - GroupID: groupId, - TagIds: Upload.json(tagIds), - AzureApplicationID: applicationId, - AzureTenantID: tenantId, - AzureAuthenticationKey: authenticationKey, - }, - ignoreLoadingBar: true, - }); - }; - service.uploadLDAPTLSFiles = function (TLSCAFile, TLSCertFile, TLSKeyFile) { var queue = []; diff --git a/app/portainer/services/stateManager.js b/app/portainer/services/stateManager.js index fa2b1c72b..819d8c570 100644 --- a/app/portainer/services/stateManager.js +++ b/app/portainer/services/stateManager.js @@ -168,14 +168,6 @@ angular.module('portainer.app').factory('StateManager', [ manager.updateEndpointState = function (endpoint, extensions) { var deferred = $q.defer(); - if (endpoint.Type === 3) { - state.endpoint.name = endpoint.Name; - state.endpoint.mode = { provider: 'AZURE' }; - LocalStorage.storeEndpointState(state.endpoint); - deferred.resolve(); - return deferred.promise; - } - $q.all({ version: endpoint.Status === 1 ? SystemService.version() : $q.when(endpoint.Snapshots[0].SnapshotRaw.Version), info: endpoint.Status === 1 ? SystemService.info() : $q.when(endpoint.Snapshots[0].SnapshotRaw.Info), diff --git a/app/portainer/views/endpoints/create/createEndpointController.js b/app/portainer/views/endpoints/create/createEndpointController.js index 60f81798d..a1c6b6003 100644 --- a/app/portainer/views/endpoints/create/createEndpointController.js +++ b/app/portainer/views/endpoints/create/createEndpointController.js @@ -27,9 +27,6 @@ angular PublicURL: '', GroupId: 1, SecurityFormData: new EndpointSecurityFormData(), - AzureApplicationId: '', - AzureTenantId: '', - AzureAuthenticationKey: '', TagIds: [], }; @@ -85,17 +82,6 @@ angular addEndpoint(name, 4, URL, '', groupId, tagIds, false, false, false, null, null, null); }; - $scope.addAzureEndpoint = function () { - var name = $scope.formValues.Name; - var applicationId = $scope.formValues.AzureApplicationId; - var tenantId = $scope.formValues.AzureTenantId; - var authenticationKey = $scope.formValues.AzureAuthenticationKey; - var groupId = $scope.formValues.GroupId; - var tagIds = $scope.formValues.TagIds; - - createAzureEndpoint(name, applicationId, tenantId, authenticationKey, groupId, tagIds); - }; - $scope.onCreateTag = function onCreateTag(tagName) { return $async(onCreateTagAsync, tagName); }; @@ -110,21 +96,6 @@ angular } } - function createAzureEndpoint(name, applicationId, tenantId, authenticationKey, groupId, tagIds) { - $scope.state.actionInProgress = true; - EndpointService.createAzureEndpoint(name, applicationId, tenantId, authenticationKey, groupId, tagIds) - .then(function success() { - Notifications.success('Endpoint created', name); - $state.go('portainer.endpoints', {}, { reload: true }); - }) - .catch(function error(err) { - Notifications.error('Failure', err, 'Unable to create endpoint'); - }) - .finally(function final() { - $scope.state.actionInProgress = false; - }); - } - function addEndpoint(name, type, URL, PublicURL, groupId, tagIds, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile) { $scope.state.actionInProgress = true; EndpointService.createRemoteEndpoint(name, type, URL, PublicURL, groupId, tagIds, TLS, TLSSkipVerify, TLSSkipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile) diff --git a/app/portainer/views/endpoints/create/createendpoint.html b/app/portainer/views/endpoints/create/createendpoint.html index 3c0c014c2..4a366a22e 100644 --- a/app/portainer/views/endpoints/create/createendpoint.html +++ b/app/portainer/views/endpoints/create/createendpoint.html @@ -44,16 +44,6 @@

Directly connect to the Docker API

-
- - -
@@ -97,29 +87,6 @@
-
-
- Information -
-
-
- -

This feature is experimental.

-

- Connect to Microsoft Azure to manage Azure Container Instances (ACI). -

-

- - Have a look at - the Azure documentation - to retrieve the credentials required below. -

-
-
-
-
Environment details
@@ -214,76 +181,6 @@ - -
- -
- -
- -
-
-
-
-
-

This field is required.

-
-
-
- - -
- -
- -
-
-
-
-
-

This field is required.

-
-
-
- - -
- -
- -
-
-
-
-
-

This field is required.

-
-
-
- -
- @@ -350,17 +247,6 @@ Add endpoint Creating endpoint... - diff --git a/app/portainer/views/endpoints/edit/endpoint.html b/app/portainer/views/endpoints/edit/endpoint.html index b17b0ca8c..6223629fd 100644 --- a/app/portainer/views/endpoints/edit/endpoint.html +++ b/app/portainer/views/endpoints/edit/endpoint.html @@ -118,12 +118,6 @@ -
Metadata diff --git a/app/portainer/views/endpoints/edit/endpointController.js b/app/portainer/views/endpoints/edit/endpointController.js index c4d560645..221c9282e 100644 --- a/app/portainer/views/endpoints/edit/endpointController.js +++ b/app/portainer/views/endpoints/edit/endpointController.js @@ -89,9 +89,6 @@ angular TLSCACert: TLSSkipVerify || securityData.TLSCACert === endpoint.TLSConfig.TLSCACert ? null : securityData.TLSCACert, TLSCert: TLSSkipClientVerify || securityData.TLSCert === endpoint.TLSConfig.TLSCert ? null : securityData.TLSCert, TLSKey: TLSSkipClientVerify || securityData.TLSKey === endpoint.TLSConfig.TLSKey ? null : securityData.TLSKey, - AzureApplicationID: endpoint.AzureCredentials.ApplicationID, - AzureTenantID: endpoint.AzureCredentials.TenantID, - AzureAuthenticationKey: endpoint.AzureCredentials.AuthenticationKey, }; if ($scope.endpointType !== 'local' && endpoint.Type !== 3) { diff --git a/app/portainer/views/home/homeController.js b/app/portainer/views/home/homeController.js index af41523f7..4322c0f30 100644 --- a/app/portainer/views/home/homeController.js +++ b/app/portainer/views/home/homeController.js @@ -26,9 +26,7 @@ angular }; $scope.goToDashboard = function (endpoint) { - if (endpoint.Type === 3) { - return switchToAzureEndpoint(endpoint); - } else if (endpoint.Type === 4) { + if (endpoint.Type === 4) { return switchToEdgeEndpoint(endpoint); } @@ -89,19 +87,6 @@ angular return deferred.promise; } - function switchToAzureEndpoint(endpoint) { - EndpointProvider.setEndpointID(endpoint.Id); - EndpointProvider.setEndpointPublicURL(endpoint.PublicURL); - EndpointProvider.setOfflineModeFromStatus(endpoint.Status); - StateManager.updateEndpointState(endpoint, []) - .then(function success() { - $state.go('azure.dashboard'); - }) - .catch(function error(err) { - Notifications.error('Failure', err, 'Unable to connect to the Azure endpoint'); - }); - } - function switchToEdgeEndpoint(endpoint) { if (!endpoint.EdgeID) { $state.go('portainer.endpoints.endpoint', { id: endpoint.Id }); diff --git a/app/portainer/views/init/endpoint/initEndpoint.html b/app/portainer/views/init/endpoint/initEndpoint.html index 0c1eec55a..717d00075 100644 --- a/app/portainer/views/init/endpoint/initEndpoint.html +++ b/app/portainer/views/init/endpoint/initEndpoint.html @@ -55,16 +55,6 @@

Connect to a Portainer agent

-
- - -
@@ -168,91 +158,6 @@ - -
-
- Information -
-
-
- -

This feature is experimental.

-

- Connect to Microsoft Azure to manage Azure Container Instances (ACI). -

-

- - Have a look at - the Azure documentation - to retrieve the credentials required below. -

-
-
-
-
- Environment -
- -
- -
- -
-
- -
- Azure credentials -
- -
- -
- -
-
- - -
- -
- -
-
- - -
- -
- -
-
- - -
-
- -
-
- -
-
diff --git a/app/portainer/views/init/endpoint/initEndpointController.js b/app/portainer/views/init/endpoint/initEndpointController.js index fc4ff905a..3c41c60af 100644 --- a/app/portainer/views/init/endpoint/initEndpointController.js +++ b/app/portainer/views/init/endpoint/initEndpointController.js @@ -28,9 +28,6 @@ angular.module('portainer.app').controller('InitEndpointController', [ TLSCACert: null, TLSCert: null, TLSKey: null, - AzureApplicationId: '', - AzureTenantId: '', - AzureAuthenticationKey: '', }; $scope.createLocalEndpoint = function () { @@ -47,15 +44,6 @@ angular.module('portainer.app').controller('InitEndpointController', [ }); }; - $scope.createAzureEndpoint = function () { - var name = $scope.formValues.Name; - var applicationId = $scope.formValues.AzureApplicationId; - var tenantId = $scope.formValues.AzureTenantId; - var authenticationKey = $scope.formValues.AzureAuthenticationKey; - - createAzureEndpoint(name, applicationId, tenantId, authenticationKey); - }; - $scope.createAgentEndpoint = function () { var name = $scope.formValues.Name; var URL = $scope.formValues.URL; @@ -78,20 +66,6 @@ angular.module('portainer.app').controller('InitEndpointController', [ createRemoteEndpoint(name, 1, URL, PublicURL, TLS, TLSSkipVerify, TLSSKipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile); }; - function createAzureEndpoint(name, applicationId, tenantId, authenticationKey) { - $scope.state.actionInProgress = true; - EndpointService.createAzureEndpoint(name, applicationId, tenantId, authenticationKey, 1, []) - .then(function success() { - $state.go('portainer.home'); - }) - .catch(function error(err) { - Notifications.error('Failure', err, 'Unable to connect to the Azure environment'); - }) - .finally(function final() { - $scope.state.actionInProgress = false; - }); - } - function createRemoteEndpoint(name, type, URL, PublicURL, TLS, TLSSkipVerify, TLSSKipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile) { $scope.state.actionInProgress = true; EndpointService.createRemoteEndpoint(name, type, URL, PublicURL, 1, [], TLS, TLSSkipVerify, TLSSKipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile) diff --git a/app/portainer/views/sidebar/sidebar.html b/app/portainer/views/sidebar/sidebar.html index 8e1a3f4d9..d2f092095 100644 --- a/app/portainer/views/sidebar/sidebar.html +++ b/app/portainer/views/sidebar/sidebar.html @@ -13,9 +13,7 @@ Home -