Commit bbf31849 authored by Mike Greiling's avatar Mike Greiling

Merge branch 'ak/remove-kibana' into 'master'

Remove kibana from elastic stack

See merge request gitlab-org/gitlab!22780
parents d20a0afb 3b5aaea0
......@@ -222,9 +222,6 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
elasticStackInstalled() {
return this.applications.elastic_stack.status === APPLICATION_STATUS.INSTALLED;
},
elasticStackKibanaHostname() {
return this.applications.elastic_stack.kibana_hostname;
},
knative() {
return this.applications.knative;
},
......@@ -681,9 +678,6 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
: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">
......@@ -694,40 +688,6 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
)
}}
</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>
......
......@@ -5,7 +5,6 @@ import {
JUPYTER,
KNATIVE,
CERT_MANAGER,
ELASTIC_STACK,
CROSSPLANE,
RUNNER,
APPLICATION_INSTALLED_STATUSES,
......@@ -97,7 +96,6 @@ export default class ClusterStore {
elastic_stack: {
...applicationInitialState,
title: s__('ClusterIntegration|Elastic Stack'),
kibana_hostname: null,
},
},
environments: [],
......@@ -236,12 +234,6 @@ 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',
);
}
});
}
......
......@@ -47,7 +47,7 @@ class Clusters::ApplicationsController < Clusters::BaseController
end
def cluster_application_params
params.permit(:application, :hostname, :kibana_hostname, :email, :stack, :modsecurity_enabled)
params.permit(:application, :hostname, :email, :stack, :modsecurity_enabled)
end
def cluster_application_destroy_params
......
......@@ -15,24 +15,15 @@ module Clusters
include ::Clusters::Concerns::ApplicationData
include ::Gitlab::Utils::StrongMemoize
default_value_for :version, VERSION
def set_initial_status
return unless not_installable?
return unless cluster&.application_ingress_available?
include IgnorableColumns
ignore_column :kibana_hostname, remove_with: '12.8', remove_after: '2020-01-22'
ingress = cluster.application_ingress
self.status = status_states[:installable] if ingress.external_ip_or_hostname?
end
default_value_for :version, VERSION
def chart
'stable/elastic-stack'
end
def values
content_values.to_yaml
end
def install_command
Gitlab::Kubernetes::Helm::InstallCommand.new(
name: 'elastic-stack',
......@@ -78,24 +69,6 @@ module Clusters
private
def specification
{
"kibana" => {
"ingress" => {
"hosts" => [kibana_hostname],
"tls" => [{
"hosts" => [kibana_hostname],
"secretName" => "kibana-cert"
}]
}
}
}
end
def content_values
YAML.load_file(chart_values_file).deep_merge!(specification)
end
def post_delete_script
[
Gitlab::Kubernetes::KubectlCmd.delete("pvc", "--selector", "release=elastic-stack")
......
......@@ -42,7 +42,7 @@ module Clusters
end
def allowed_to_uninstall?
external_ip_or_hostname? && application_jupyter_nil_or_installable? && application_elastic_stack_nil_or_installable?
external_ip_or_hostname? && application_jupyter_nil_or_installable?
end
def install_command
......@@ -155,10 +155,6 @@ module Clusters
def application_jupyter_nil_or_installable?
cluster.application_jupyter.nil? || cluster.application_jupyter&.installable?
end
def application_elastic_stack_nil_or_installable?
cluster.application_elastic_stack.nil? || cluster.application_elastic_stack&.installable?
end
end
end
end
......@@ -8,7 +8,6 @@ class ClusterApplicationEntity < Grape::Entity
expose :external_ip, if: -> (e, _) { e.respond_to?(:external_ip) }
expose :external_hostname, if: -> (e, _) { e.respond_to?(:external_hostname) }
expose :hostname, if: -> (e, _) { e.respond_to?(:hostname) }
expose :kibana_hostname, if: -> (e, _) { e.respond_to?(:kibana_hostname) }
expose :email, if: -> (e, _) { e.respond_to?(:email) }
expose :stack, if: -> (e, _) { e.respond_to?(:stack) }
expose :modsecurity_enabled, if: -> (e, _) { e.respond_to?(:modsecurity_enabled) }
......
......@@ -19,10 +19,6 @@ module Clusters
application.hostname = params[:hostname]
end
if application.has_attribute?(:kibana_hostname)
application.kibana_hostname = params[:kibana_hostname]
end
if application.has_attribute?(:email)
application.email = params[:email]
end
......
......@@ -3824,9 +3824,6 @@ msgstr ""
msgid "ClusterIntegration|Copy Jupyter Hostname"
msgstr ""
msgid "ClusterIntegration|Copy Kibana Hostname"
msgstr ""
msgid "ClusterIntegration|Copy Knative Endpoint"
msgstr ""
......@@ -4043,9 +4040,6 @@ msgstr ""
msgid "ClusterIntegration|Key pair name"
msgstr ""
msgid "ClusterIntegration|Kibana Hostname"
msgstr ""
msgid "ClusterIntegration|Knative"
msgstr ""
......
......@@ -181,11 +181,8 @@ shared_examples "installing applications on a cluster" do
context 'when user installs Elastic Stack' do
before do
allow(ClusterInstallAppWorker).to receive(:perform_async)
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_in)
allow(ClusterWaitForIngressIpAddressWorker).to receive(:perform_async)
create(:clusters_applications_helm, :installed, cluster: cluster)
create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1', cluster: cluster)
page.within('.js-cluster-application-row-elastic_stack') do
click_button 'Install'
......
......@@ -35,7 +35,6 @@
"external_ip": { "type": ["string", "null"] },
"external_hostname": { "type": ["string", "null"] },
"hostname": { "type": ["string", "null"] },
"kibana_hostname": { "type": ["string", "null"] },
"email": { "type": ["string", "null"] },
"stack": { "type": ["string", "null"] },
"modsecurity_enabled": { "type": ["boolean", "null"] },
......
......@@ -199,7 +199,7 @@ describe('Applications', () => {
prometheus: { title: 'Prometheus' },
jupyter: { title: 'JupyterHub', hostname: '' },
knative: { title: 'Knative', hostname: '' },
elastic_stack: { title: 'Elastic Stack', kibana_hostname: '' },
elastic_stack: { title: 'Elastic Stack' },
},
});
......@@ -433,79 +433,33 @@ describe('Applications', () => {
});
describe('Elastic Stack application', () => {
describe('with ingress installed with ip & elastic stack installable', () => {
describe('with elastic stack installable', () => {
it('renders hostname active input', () => {
vm = mountComponent(Applications, {
applications: {
...APPLICATIONS_MOCK_STATE,
ingress: {
title: 'Ingress',
status: 'installed',
externalIp: '1.1.1.1',
},
},
});
expect(
vm.$el
.querySelector('.js-cluster-application-row-elastic_stack .js-hostname')
.getAttribute('readonly'),
).toEqual(null);
});
});
describe('with ingress installed without external ip', () => {
it('does not render hostname input', () => {
vm = mountComponent(Applications, {
applications: {
...APPLICATIONS_MOCK_STATE,
ingress: { title: 'Ingress', status: 'installed' },
},
});
expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack .js-hostname')).toBe(
null,
);
.querySelector(
'.js-cluster-application-row-elastic_stack .js-cluster-application-install-button',
)
.getAttribute('disabled'),
).toEqual('disabled');
});
});
describe('with ingress & elastic stack installed', () => {
it('renders readonly input', () => {
describe('elastic stack installed', () => {
it('renders uninstall button', () => {
vm = mountComponent(Applications, {
applications: {
...APPLICATIONS_MOCK_STATE,
ingress: {
title: 'Ingress',
status: 'installed',
externalIp: '1.1.1.1',
modsecurity_enabled: false,
},
elastic_stack: { title: 'Elastic Stack', status: 'installed', kibana_hostname: '' },
elastic_stack: { title: 'Elastic Stack', status: 'installed' },
},
});
expect(
vm.$el
.querySelector('.js-cluster-application-row-elastic_stack .js-hostname')
.getAttribute('readonly'),
).toEqual('readonly');
});
});
describe('without ingress installed', () => {
beforeEach(() => {
vm = mountComponent(Applications, {
applications: APPLICATIONS_MOCK_STATE,
});
});
it('does not render input', () => {
expect(vm.$el.querySelector('.js-cluster-application-row-elastic_stack .js-hostname')).toBe(
null,
);
});
it('renders disabled install button', () => {
expect(
vm.$el
.querySelector(
......
......@@ -157,7 +157,7 @@ const APPLICATIONS_MOCK_STATE = {
prometheus: { title: 'Prometheus' },
jupyter: { title: 'JupyterHub', status: 'installable', hostname: '' },
knative: { title: 'Knative ', status: 'installable', hostname: '' },
elastic_stack: { title: 'Elastic Stack', status: 'installable', kibana_hostname: '' },
elastic_stack: { title: 'Elastic Stack', status: 'installable' },
};
export { CLUSTERS_MOCK_DATA, DEFAULT_APPLICATION_STATE, APPLICATIONS_MOCK_STATE };
......@@ -167,7 +167,6 @@ describe('Clusters Store', () => {
installFailed: true,
statusReason: mockResponseData.applications[7].status_reason,
requestReason: null,
kibana_hostname: '',
installed: false,
uninstallable: false,
uninstallSuccessful: false,
......@@ -216,16 +215,5 @@ describe('Clusters Store', () => {
`jupyter.${store.state.applications.ingress.externalIp}.nip.io`,
);
});
it('sets default hostname for elastic stack when ingress has a ip address', () => {
const mockResponseData =
CLUSTERS_MOCK_DATA.GET['/gitlab-org/gitlab-shell/clusters/2/status.json'].data;
store.updateStateFromServer(mockResponseData);
expect(store.state.applications.elastic_stack.kibana_hostname).toEqual(
`kibana.${store.state.applications.ingress.externalIp}.nip.io`,
);
});
});
});
......@@ -10,45 +10,8 @@ describe Clusters::Applications::ElasticStack do
include_examples 'cluster application version specs', :clusters_applications_elastic_stack
include_examples 'cluster application helm specs', :clusters_applications_elastic_stack
describe '#can_uninstall?' do
let(:ingress) { create(:clusters_applications_ingress, :installed, external_hostname: 'localhost.localdomain') }
let(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
subject { elastic_stack.can_uninstall? }
it { is_expected.to be_truthy }
end
describe '#set_initial_status' do
before do
elastic_stack.set_initial_status
end
context 'when ingress is not installed' do
let(:cluster) { create(:cluster, :provided_by_gcp) }
let(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: cluster) }
it { expect(elastic_stack).to be_not_installable }
end
context 'when ingress is installed and external_ip is assigned' do
let(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
let(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
it { expect(elastic_stack).to be_installable }
end
context 'when ingress is installed and external_hostname is assigned' do
let(:ingress) { create(:clusters_applications_ingress, :installed, external_hostname: 'localhost.localdomain') }
let(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
it { expect(elastic_stack).to be_installable }
end
end
describe '#install_command' do
let!(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
let!(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
let!(:elastic_stack) { create(:clusters_applications_elastic_stack) }
subject { elastic_stack.install_command }
......@@ -80,8 +43,7 @@ describe Clusters::Applications::ElasticStack do
end
describe '#uninstall_command' do
let!(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
let!(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
let!(:elastic_stack) { create(:clusters_applications_elastic_stack) }
subject { elastic_stack.uninstall_command }
......@@ -100,19 +62,6 @@ describe Clusters::Applications::ElasticStack do
end
end
describe '#files' do
let!(:ingress) { create(:clusters_applications_ingress, :installed, external_ip: '127.0.0.1') }
let!(:elastic_stack) { create(:clusters_applications_elastic_stack, cluster: ingress.cluster) }
let(:values) { subject[:'values.yaml'] }
subject { elastic_stack.files }
it 'includes elastic stack specific keys in the values.yaml file' do
expect(values).to include('ELASTICSEARCH_HOSTS')
end
end
describe '#elasticsearch_client' do
context 'cluster is nil' do
it 'returns nil' do
......
......@@ -163,8 +163,7 @@ describe Clusters::Applications::CreateService do
context 'elastic stack application' do
let(:params) do
{
application: 'elastic_stack',
kibana_hostname: 'example.com'
application: 'elastic_stack'
}
end
......@@ -182,10 +181,6 @@ describe Clusters::Applications::CreateService do
cluster.reload
end.to change(cluster, :application_elastic_stack)
end
it 'sets the kibana_hostname' do
expect(subject.kibana_hostname).to eq('example.com')
end
end
end
......
......@@ -11,14 +11,7 @@ elasticsearch:
replicas: 1
kibana:
enabled: true
env:
ELASTICSEARCH_HOSTS: http://elastic-stack-elasticsearch-client:9200
ingress:
enabled: true
annotations:
kubernetes.io/ingress.class: "nginx"
kubernetes.io/tls-acme: "true"
enabled: false
logstash:
enabled: false
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment