feat(endpoint-init): remove Azure ACI and remote Docker options (#4015)

pull/3881/merge
Anthony Lapenna 2020-07-07 16:55:02 +12:00 committed by GitHub
parent 91981c815c
commit d4456f81ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 2 additions and 271 deletions

View File

@ -35,7 +35,5 @@ export const PortainerEndpointInitFormValueEndpointSections = Object.freeze([
'fas fa-dharmachakra', 'fas fa-dharmachakra',
'Manage the local Kubernetes environment' 'Manage the local Kubernetes environment'
), ),
new PortainerEndpointInitFormValueEndpointSection(PortainerEndpointConnectionTypes.REMOTE, 'Remote', 'fab fa-docker', 'Manage a remote Docker environment'),
new PortainerEndpointInitFormValueEndpointSection(PortainerEndpointConnectionTypes.AGENT, 'Agent', 'fa fa-bolt', 'Connect to a Portainer agent'), new PortainerEndpointInitFormValueEndpointSection(PortainerEndpointConnectionTypes.AGENT, 'Agent', 'fa fa-bolt', 'Connect to a Portainer agent'),
new PortainerEndpointInitFormValueEndpointSection(PortainerEndpointConnectionTypes.AZURE, 'Azure', 'fab fa-microsoft', 'Connect to Microsoft Azure ACI'),
]); ]);

View File

@ -1,63 +0,0 @@
<div class="col-sm-12 form-section-title">
Information
</div>
<div class="form-group">
<div class="col-sm-12">
<span class="small">
<p class="text-muted"> <i class="fa fa-flask orange-icon" aria-hidden="true" style="margin-right: 2px;"></i> This feature is experimental. </p>
<p class="text-primary">
Connect to Microsoft Azure to manage Azure Container Instances (ACI).
</p>
<p class="text-muted">
<i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
Have a look at
<a href="https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal" target="_blank">the Azure documentation</a>
to retrieve the credentials required below.
</p>
</span>
</div>
</div>
<div class="col-sm-12 form-section-title">
Environment
</div>
<!-- name-input -->
<div class="form-group">
<label for="endpoint_name" class="col-sm-4 col-lg-3 control-label text-left">Name</label>
<div class="col-sm-8 col-lg-9">
<input type="text" class="form-control" id="endpoint_name" ng-model="ctrl.formValues.Name" placeholder="e.g. azure-01" />
</div>
</div>
<!-- !name-input -->
<div class="col-sm-12 form-section-title">
Azure credentials
</div>
<!-- applicationId-input -->
<div class="form-group">
<label for="azure_credential_appid" class="col-sm-4 col-lg-3 control-label text-left">Application ID</label>
<div class="col-sm-8 col-lg-9">
<input type="text" class="form-control" id="azure_credential_appid" ng-model="ctrl.formValues.AzureApplicationId" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" />
</div>
</div>
<!-- !applicationId-input -->
<!-- tenantId-input -->
<div class="form-group">
<label for="azure_credential_tenantid" class="col-sm-4 col-lg-3 control-label text-left">Tenant ID</label>
<div class="col-sm-8 col-lg-9">
<input type="text" class="form-control" id="azure_credential_tenantid" ng-model="ctrl.formValues.AzureTenantId" placeholder="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" />
</div>
</div>
<!-- !tenantId-input -->
<!-- authenticationkey-input -->
<div class="form-group">
<label for="azure_credential_authkey" class="col-sm-4 col-lg-3 control-label text-left">Authentication key</label>
<div class="col-sm-8 col-lg-9">
<input
type="text"
class="form-control"
id="azure_credential_authkey"
ng-model="ctrl.formValues.AzureAuthenticationKey"
placeholder="cOrXoK/1D35w8YQ8nH1/8ZGwzz45JIYD5jxHKXEQknk="
/>
</div>
</div>
<!-- !authenticationkey-input -->

View File

@ -1,120 +0,0 @@
<div class="col-sm-12 form-section-title">
Information
</div>
<div class="form-group">
<div class="col-sm-12">
<span class="small">
<p class="text-primary">
Connect Portainer to a remote Docker environment using the Docker API over TCP.
</p>
<p class="text-muted">
<i class="fa fa-info-circle blue-icon" aria-hidden="true" style="margin-right: 2px;"></i>
The Docker API must be exposed over TCP. You can find more information about how to expose the Docker API over TCP
<a href="https://docs.docker.com/engine/security/https/" target="_blank">in the Docker documentation</a>.
</p>
</span>
</div>
</div>
<div class="col-sm-12 form-section-title">
Environment
</div>
<!-- name-input -->
<div class="form-group">
<label for="endpoint_name" class="col-sm-4 col-lg-3 control-label text-left">Name</label>
<div class="col-sm-8 col-lg-9">
<input type="text" class="form-control" id="endpoint_name" ng-model="ctrl.formValues.Name" placeholder="e.g. docker-prod01" />
</div>
</div>
<!-- !name-input -->
<!-- endpoint-url-input -->
<div class="form-group">
<label for="endpoint_url" class="col-sm-4 col-lg-3 control-label text-left">
Endpoint URL
<portainer-tooltip position="bottom" message="URL or IP address of a Docker host with API exposed over TCP."></portainer-tooltip>
</label>
<div class="col-sm-8 col-lg-9">
<input type="text" class="form-control" id="endpoint_url" ng-model="ctrl.formValues.URL" placeholder="e.g. 10.0.0.10:2375 or mydocker.mydomain.com:2375" />
</div>
</div>
<!-- !endpoint-url-input -->
<!-- tls-checkbox -->
<div class="form-group">
<div class="col-sm-12">
<label for="tls" class="control-label text-left">
TLS
<portainer-tooltip position="bottom" message="Enable this option if you need to specify TLS certificates to connect to the Docker endpoint."></portainer-tooltip>
</label>
<label class="switch" style="margin-left: 20px;"> <input type="checkbox" ng-model="ctrl.formValues.TLS" /><i></i> </label>
</div>
</div>
<!-- !tls-checkbox -->
<!-- tls-options -->
<div ng-if="ctrl.formValues.TLS">
<!-- skip-server-verification -->
<div class="form-group">
<div class="col-sm-10">
<label for="tls_verify" class="control-label text-left">
Skip server verification
<portainer-tooltip position="bottom" message="Enable this option if you need to authenticate server based on given CA."></portainer-tooltip>
</label>
<label class="switch" style="margin-left: 20px;"> <input type="checkbox" ng-model="ctrl.formValues.TLSSkipVerify" /><i></i> </label>
</div>
</div>
<!-- !skip-server-verification -->
<!-- skip-client-verification -->
<div class="form-group">
<div class="col-sm-10">
<label for="tls_client_cert" class="control-label text-left">
Skip client verification
<portainer-tooltip position="bottom" message="Enable this option if you need to authenticate with a client certificate."></portainer-tooltip>
</label>
<label class="switch" style="margin-left: 20px;"> <input type="checkbox" ng-model="ctrl.formValues.TLSSKipClientVerify" /><i></i> </label>
</div>
</div>
<!-- !skip-client-verification -->
<div class="col-sm-12 form-section-title" ng-if="!ctrl.formValues.TLSSkipVerify || !ctrl.formValues.TLSSKipClientVerify">
Required TLS files
</div>
<!-- ca-input -->
<div class="form-group" ng-if="!ctrl.formValues.TLSSkipVerify">
<label class="col-sm-4 col-lg-3 control-label text-left">TLS CA certificate</label>
<div class="col-sm-8 col-lg-9">
<button class="btn btn-sm btn-primary" ngf-select ng-model="ctrl.formValues.TLSCACert">Select file</button>
<span style="margin-left: 5px;">
{{ ctrl.formValues.TLSCACert.name }}
<i class="fa fa-times red-icon" ng-if="!ctrl.formValues.TLSCACert" aria-hidden="true"></i>
<i class="fa fa-circle-notch fa-spin" ng-if="ctrl.state.uploadInProgress"></i>
</span>
</div>
</div>
<!-- !ca-input -->
<div ng-if="!ctrl.formValues.TLSSKipClientVerify">
<!-- cert-input -->
<div class="form-group">
<label for="tls_cert" class="col-sm-4 col-lg-3 control-label text-left">TLS certificate</label>
<div class="col-sm-8 col-lg-9">
<button class="btn btn-sm btn-primary" ngf-select ng-model="ctrl.formValues.TLSCert">Select file</button>
<span style="margin-left: 5px;">
{{ ctrl.formValues.TLSCert.name }}
<i class="fa fa-times red-icon" ng-if="!ctrl.formValues.TLSCert" aria-hidden="true"></i>
<i class="fa fa-circle-notch fa-spin" ng-if="ctrl.state.uploadInProgress"></i>
</span>
</div>
</div>
<!-- !cert-input -->
<!-- key-input -->
<div class="form-group">
<label class="col-sm-4 col-lg-3 control-label text-left">TLS key</label>
<div class="col-sm-8 col-lg-9">
<button class="btn btn-sm btn-primary" ngf-select ng-model="ctrl.formValues.TLSKey">Select file</button>
<span style="margin-left: 5px;">
{{ ctrl.formValues.TLSKey.name }}
<i class="fa fa-times red-icon" ng-if="!ctrl.formValues.TLSKey" aria-hidden="true"></i>
<i class="fa fa-circle-notch fa-spin" ng-if="ctrl.state.uploadInProgress"></i>
</span>
</div>
</div>
<!-- !key-input -->
</div>
</div>
<!-- !tls-options -->

View File

@ -45,12 +45,6 @@
<div ng-if="ctrl.formValues.ConnectionType === ctrl.PortainerEndpointConnectionTypes.KUBERNETES_LOCAL"> <div ng-if="ctrl.formValues.ConnectionType === ctrl.PortainerEndpointConnectionTypes.KUBERNETES_LOCAL">
<ng-include src="'app/portainer/views/init/endpoint/includes/localKubernetes.html'"></ng-include> <ng-include src="'app/portainer/views/init/endpoint/includes/localKubernetes.html'"></ng-include>
</div> </div>
<div ng-if="ctrl.formValues.ConnectionType === ctrl.PortainerEndpointConnectionTypes.REMOTE">
<ng-include src="'app/portainer/views/init/endpoint/includes/remote.html'"></ng-include>
</div>
<div ng-if="ctrl.formValues.ConnectionType === ctrl.PortainerEndpointConnectionTypes.AZURE">
<ng-include src="'app/portainer/views/init/endpoint/includes/azure.html'"></ng-include>
</div>
<div ng-if="ctrl.formValues.ConnectionType === ctrl.PortainerEndpointConnectionTypes.AGENT"> <div ng-if="ctrl.formValues.ConnectionType === ctrl.PortainerEndpointConnectionTypes.AGENT">
<ng-include src="'app/portainer/views/init/endpoint/includes/agent.html'"></ng-include> <ng-include src="'app/portainer/views/init/endpoint/includes/agent.html'"></ng-include>
</div> </div>

View File

@ -1,12 +1,10 @@
import _ from 'lodash-es'; import _ from 'lodash-es';
import angular from 'angular'; import angular from 'angular';
import { PortainerEndpointInitFormValues, PortainerEndpointInitFormValueEndpointSections } from 'Portainer/models/endpoint/formValues'; import { PortainerEndpointInitFormValueEndpointSections, PortainerEndpointInitFormValues } from 'Portainer/models/endpoint/formValues';
import { PortainerEndpointTypes, PortainerEndpointConnectionTypes } from 'Portainer/models/endpoint/models'; import { PortainerEndpointConnectionTypes, PortainerEndpointTypes } from 'Portainer/models/endpoint/models';
require('./includes/localDocker.html'); require('./includes/localDocker.html');
require('./includes/localKubernetes.html'); require('./includes/localKubernetes.html');
require('./includes/remote.html');
require('./includes/azure.html');
require('./includes/agent.html'); require('./includes/agent.html');
class InitEndpointController { class InitEndpointController {
@ -23,8 +21,6 @@ class InitEndpointController {
this.createLocalEndpointAsync = this.createLocalEndpointAsync.bind(this); this.createLocalEndpointAsync = this.createLocalEndpointAsync.bind(this);
this.createLocalKubernetesEndpointAsync = this.createLocalKubernetesEndpointAsync.bind(this); this.createLocalKubernetesEndpointAsync = this.createLocalKubernetesEndpointAsync.bind(this);
this.createAgentEndpointAsync = this.createAgentEndpointAsync.bind(this); this.createAgentEndpointAsync = this.createAgentEndpointAsync.bind(this);
this.createAzureEndpointAsync = this.createAzureEndpointAsync.bind(this);
this.createRemoteEndpointAsync = this.createRemoteEndpointAsync.bind(this);
} }
$onInit() { $onInit() {
@ -43,30 +39,12 @@ class InitEndpointController {
this.PortainerEndpointConnectionTypes = PortainerEndpointConnectionTypes; this.PortainerEndpointConnectionTypes = PortainerEndpointConnectionTypes;
} }
isRemoteConnectButtonDisabled() {
return (
this.state.actionInProgress ||
!this.formValues.Name ||
!this.formValues.URL ||
(this.formValues.TLS &&
((this.formValues.TLSVerify && !this.formValues.TLSCACert) || (!this.formValues.TLSSKipClientVerify && (!this.formValues.TLSCert || !this.formValues.TLSKey))))
);
}
isAzureConnectButtonDisabled() {
return this.state.actionInProgress || !this.formValues.Name || !this.formValues.AzureApplicationId || !this.formValues.AzureTenantId || !this.formValues.AzureAuthenticationKey;
}
isConnectButtonDisabled() { isConnectButtonDisabled() {
switch (this.formValues.ConnectionType) { switch (this.formValues.ConnectionType) {
case PortainerEndpointConnectionTypes.DOCKER_LOCAL: case PortainerEndpointConnectionTypes.DOCKER_LOCAL:
return this.state.actionInProgress; return this.state.actionInProgress;
case PortainerEndpointConnectionTypes.KUBERNETES_LOCAL: case PortainerEndpointConnectionTypes.KUBERNETES_LOCAL:
return this.state.actionInProgress; return this.state.actionInProgress;
case PortainerEndpointConnectionTypes.REMOTE:
return this.isRemoteConnectButtonDisabled();
case PortainerEndpointConnectionTypes.AZURE:
return this.isAzureConnectButtonDisabled();
case PortainerEndpointConnectionTypes.AGENT: case PortainerEndpointConnectionTypes.AGENT:
return this.state.actionInProgress || !this.formValues.Name || !this.formValues.URL; return this.state.actionInProgress || !this.formValues.Name || !this.formValues.URL;
default: default:
@ -80,10 +58,6 @@ class InitEndpointController {
return this.createLocalEndpoint(); return this.createLocalEndpoint();
case PortainerEndpointConnectionTypes.KUBERNETES_LOCAL: case PortainerEndpointConnectionTypes.KUBERNETES_LOCAL:
return this.createLocalKubernetesEndpoint(); return this.createLocalKubernetesEndpoint();
case PortainerEndpointConnectionTypes.REMOTE:
return this.createRemoteEndpoint();
case PortainerEndpointConnectionTypes.AZURE:
return this.createAzureEndpoint();
case PortainerEndpointConnectionTypes.AGENT: case PortainerEndpointConnectionTypes.AGENT:
return this.createAgentEndpoint(); return this.createAgentEndpoint();
default: default:
@ -165,58 +139,6 @@ class InitEndpointController {
createAgentEndpoint() { createAgentEndpoint() {
return this.$async(this.createAgentEndpointAsync); return this.$async(this.createAgentEndpointAsync);
} }
/**
* DOCKER REMOTE (1)
*/
async createRemoteEndpointAsync() {
try {
this.state.actionInProgress = true;
const name = this.formValues.Name;
const type = PortainerEndpointTypes.DockerEnvironment;
const URL = this.formValues.URL;
const PublicURL = URL.split(':')[0];
const TLS = this.formValues.TLS;
const TLSSkipVerify = TLS && this.formValues.TLSSkipVerify;
const TLSSKipClientVerify = TLS && this.formValues.TLSSKipClientVerify;
const TLSCAFile = TLSSkipVerify ? null : this.formValues.TLSCACert;
const TLSCertFile = TLSSKipClientVerify ? null : this.formValues.TLSCert;
const TLSKeyFile = TLSSKipClientVerify ? null : this.formValues.TLSKey;
await this.EndpointService.createRemoteEndpoint(name, type, URL, PublicURL, 1, [], TLS, TLSSkipVerify, TLSSKipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile);
this.$state.go('portainer.home');
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to connect to the Docker environment');
} finally {
this.state.actionInProgress = false;
}
}
createRemoteEndpoint() {
return this.$async(this.createAgentEndpointAsync);
}
/**
* AZURE (4)
*/
async createAzureEndpointAsync() {
try {
this.state.actionInProgress = true;
var name = this.formValues.Name;
var applicationId = this.formValues.AzureApplicationId;
var tenantId = this.formValues.AzureTenantId;
var authenticationKey = this.formValues.AzureAuthenticationKey;
await this.EndpointService.createAzureEndpoint(name, applicationId, tenantId, authenticationKey, 1, []);
this.$state.go('portainer.home');
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to connect to the Azure environment');
} finally {
this.state.actionInProgress = false;
}
}
createAzureEndpoint() {
return this.$async(this.createAgentEndpointAsync);
}
} }
export default InitEndpointController; export default InitEndpointController;