diff options
Diffstat (limited to 'app/assets/javascripts/clusters')
6 files changed, 132 insertions, 8 deletions
diff --git a/app/assets/javascripts/clusters/clusters_bundle.js b/app/assets/javascripts/clusters/clusters_bundle.js index 7ea8901ecbb..17251ccdffb 100644 --- a/app/assets/javascripts/clusters/clusters_bundle.js +++ b/app/assets/javascripts/clusters/clusters_bundle.js @@ -37,6 +37,7 @@ export default class Clusters { installJupyterPath, installKnativePath, updateKnativePath, + installElasticStackPath, installPrometheusPath, managePrometheusPath, clusterEnvironmentsPath, @@ -86,6 +87,7 @@ export default class Clusters { installJupyterEndpoint: installJupyterPath, installKnativeEndpoint: installKnativePath, updateKnativeEndpoint: updateKnativePath, + installElasticStackEndpoint: installElasticStackPath, clusterEnvironmentsEndpoint: clusterEnvironmentsPath, }); diff --git a/app/assets/javascripts/clusters/components/applications.vue b/app/assets/javascripts/clusters/components/applications.vue index b95f97077f6..44d77277cc5 100644 --- a/app/assets/javascripts/clusters/components/applications.vue +++ b/app/assets/javascripts/clusters/components/applications.vue @@ -12,6 +12,7 @@ import certManagerLogo from 'images/cluster_app_logos/cert_manager.png'; import knativeLogo from 'images/cluster_app_logos/knative.png'; import meltanoLogo from 'images/cluster_app_logos/meltano.png'; import prometheusLogo from 'images/cluster_app_logos/prometheus.png'; +import elasticStackLogo from 'images/cluster_app_logos/elastic_stack.png'; import { s__, sprintf } from '../../locale'; import applicationRow from './application_row.vue'; import clipboardButton from '../../vue_shared/components/clipboard_button.vue'; @@ -91,6 +92,7 @@ export default { knativeLogo, meltanoLogo, prometheusLogo, + elasticStackLogo, }), computed: { isProjectCluster() { @@ -114,6 +116,9 @@ export default { certManagerInstalled() { return this.applications.cert_manager.status === APPLICATION_STATUS.INSTALLED; }, + enableClusterApplicationElasticStack() { + return gon.features && gon.features.enableClusterApplicationElasticStack; + }, ingressDescription() { return sprintf( _.escape( @@ -168,6 +173,12 @@ export default { jupyterHostname() { return this.applications.jupyter.hostname; }, + elasticStackInstalled() { + return this.applications.elastic_stack.status === APPLICATION_STATUS.INSTALLED; + }, + elasticStackKibanaHostname() { + return this.applications.elastic_stack.kibana_hostname; + }, knative() { return this.applications.knative; }, @@ -542,6 +553,75 @@ export default { /> </div> </application-row> + <application-row + v-if="enableClusterApplicationElasticStack" + id="elastic_stack" + :logo-url="elasticStackLogo" + :title="applications.elastic_stack.title" + :status="applications.elastic_stack.status" + :status-reason="applications.elastic_stack.statusReason" + :request-status="applications.elastic_stack.requestStatus" + :request-reason="applications.elastic_stack.requestReason" + :version="applications.elastic_stack.version" + :chart-repo="applications.elastic_stack.chartRepo" + :update-available="applications.elastic_stack.updateAvailable" + :installed="applications.elastic_stack.installed" + :install-failed="applications.elastic_stack.installFailed" + :update-successful="applications.elastic_stack.updateSuccessful" + :update-failed="applications.elastic_stack.updateFailed" + :uninstallable="applications.elastic_stack.uninstallable" + :uninstall-successful="applications.elastic_stack.uninstallSuccessful" + :uninstall-failed="applications.elastic_stack.uninstallFailed" + :disabled="!helmInstalled" + :install-application-request-params="{ + kibana_hostname: applications.elastic_stack.kibana_hostname, + }" + title-link="https://github.com/helm/charts/tree/master/stable/elastic-stack" + > + <div slot="description"> + <p> + {{ + s__( + `ClusterIntegration|The elastic stack collects logs from all pods in your cluster`, + ) + }} + </p> + + <template v-if="ingressExternalEndpoint"> + <div class="form-group"> + <label for="elastic-stack-kibana-hostname">{{ + s__('ClusterIntegration|Kibana Hostname') + }}</label> + + <div class="input-group"> + <input + v-model="applications.elastic_stack.kibana_hostname" + :readonly="elasticStackInstalled" + type="text" + class="form-control js-hostname" + /> + <span class="input-group-btn"> + <clipboard-button + :text="elasticStackKibanaHostname" + :title="s__('ClusterIntegration|Copy Kibana Hostname')" + class="js-clipboard-btn" + /> + </span> + </div> + + <p v-if="ingressInstalled" class="form-text text-muted"> + {{ + s__(`ClusterIntegration|Replace this with your own hostname if you want. + If you do so, point hostname to Ingress IP Address from above.`) + }} + <a :href="ingressDnsHelpPath" target="_blank" rel="noopener noreferrer"> + {{ __('More information') }} + </a> + </p> + </div> + </template> + </div> + </application-row> </div> </section> </template> diff --git a/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue b/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue index f1925c243f2..125bcaacc1c 100644 --- a/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue +++ b/app/assets/javascripts/clusters/components/uninstall_application_confirmation_modal.vue @@ -2,7 +2,16 @@ import { GlModal } from '@gitlab/ui'; import { sprintf, s__ } from '~/locale'; import trackUninstallButtonClickMixin from 'ee_else_ce/clusters/mixins/track_uninstall_button_click'; -import { HELM, INGRESS, CERT_MANAGER, PROMETHEUS, RUNNER, KNATIVE, JUPYTER } from '../constants'; +import { + HELM, + INGRESS, + CERT_MANAGER, + PROMETHEUS, + RUNNER, + KNATIVE, + JUPYTER, + ELASTIC_STACK, +} from '../constants'; const CUSTOM_APP_WARNING_TEXT = { [HELM]: sprintf( @@ -28,6 +37,7 @@ const CUSTOM_APP_WARNING_TEXT = { [JUPYTER]: s__( 'ClusterIntegration|All data not committed to GitLab will be deleted and cannot be restored.', ), + [ELASTIC_STACK]: s__('ClusterIntegration|All data will be deleted and cannot be restored.'), }; export default { diff --git a/app/assets/javascripts/clusters/constants.js b/app/assets/javascripts/clusters/constants.js index c6e4b7951cf..d7152e32376 100644 --- a/app/assets/javascripts/clusters/constants.js +++ b/app/assets/javascripts/clusters/constants.js @@ -51,7 +51,17 @@ export const KNATIVE = 'knative'; export const RUNNER = 'runner'; export const CERT_MANAGER = 'cert_manager'; export const PROMETHEUS = 'prometheus'; +export const ELASTIC_STACK = 'elastic_stack'; -export const APPLICATIONS = [HELM, INGRESS, JUPYTER, KNATIVE, RUNNER, CERT_MANAGER, PROMETHEUS]; +export const APPLICATIONS = [ + HELM, + INGRESS, + JUPYTER, + KNATIVE, + RUNNER, + CERT_MANAGER, + PROMETHEUS, + ELASTIC_STACK, +]; export const INGRESS_DOMAIN_SUFFIX = '.nip.io'; diff --git a/app/assets/javascripts/clusters/services/clusters_service.js b/app/assets/javascripts/clusters/services/clusters_service.js index fa12802b3de..dab4da04bf3 100644 --- a/app/assets/javascripts/clusters/services/clusters_service.js +++ b/app/assets/javascripts/clusters/services/clusters_service.js @@ -11,6 +11,7 @@ export default class ClusterService { prometheus: this.options.installPrometheusEndpoint, jupyter: this.options.installJupyterEndpoint, knative: this.options.installKnativeEndpoint, + elastic_stack: this.options.installElasticStackEndpoint, }; this.appUpdateEndpointMap = { knative: this.options.updateKnativeEndpoint, diff --git a/app/assets/javascripts/clusters/stores/clusters_store.js b/app/assets/javascripts/clusters/stores/clusters_store.js index 6464461ea0c..6304e81c296 100644 --- a/app/assets/javascripts/clusters/stores/clusters_store.js +++ b/app/assets/javascripts/clusters/stores/clusters_store.js @@ -5,6 +5,7 @@ import { JUPYTER, KNATIVE, CERT_MANAGER, + ELASTIC_STACK, RUNNER, APPLICATION_INSTALLED_STATUSES, APPLICATION_STATUS, @@ -85,6 +86,11 @@ export default class ClusterStore { updateSuccessful: false, updateFailed: false, }, + elastic_stack: { + ...applicationInitialState, + title: s__('ClusterIntegration|Elastic Stack'), + kibana_hostname: null, + }, }, environments: [], fetchingEnvironments: false, @@ -198,12 +204,11 @@ export default class ClusterStore { this.state.applications.cert_manager.email = this.state.applications.cert_manager.email || serverAppEntry.email; } else if (appId === JUPYTER) { - this.state.applications.jupyter.hostname = - this.state.applications.jupyter.hostname || - serverAppEntry.hostname || - (this.state.applications.ingress.externalIp - ? `jupyter.${this.state.applications.ingress.externalIp}.nip.io` - : ''); + this.state.applications.jupyter.hostname = this.updateHostnameIfUnset( + this.state.applications.jupyter.hostname, + serverAppEntry.hostname, + 'jupyter', + ); } else if (appId === KNATIVE) { if (!this.state.applications.knative.isEditingHostName) { this.state.applications.knative.hostname = @@ -216,10 +221,26 @@ export default class ClusterStore { } else if (appId === RUNNER) { this.state.applications.runner.version = version; this.state.applications.runner.updateAvailable = updateAvailable; + } else if (appId === ELASTIC_STACK) { + this.state.applications.elastic_stack.kibana_hostname = this.updateHostnameIfUnset( + this.state.applications.elastic_stack.kibana_hostname, + serverAppEntry.kibana_hostname, + 'kibana', + ); } }); } + updateHostnameIfUnset(current, updated, fallback) { + return ( + current || + updated || + (this.state.applications.ingress.externalIp + ? `${fallback}.${this.state.applications.ingress.externalIp}.nip.io` + : '') + ); + } + toggleFetchEnvironments(isFetching) { this.state.fetchingEnvironments = isFetching; } |