Commit 1a8c8313 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'ce-to-ee-2018-01-15' into 'master'

CE upstream - Monday

Closes gitaly#907

See merge request gitlab-org/gitlab-ee!4098
parents f0ee0897 fbfe3066
...@@ -419,7 +419,7 @@ group :ed25519 do ...@@ -419,7 +419,7 @@ group :ed25519 do
end end
# Gitaly GRPC client # Gitaly GRPC client
gem 'gitaly-proto', '~> 0.69.0', require: 'gitaly' gem 'gitaly-proto', '~> 0.73.0', require: 'gitaly'
gem 'toml-rb', '~> 0.3.15', require: false gem 'toml-rb', '~> 0.3.15', require: false
......
...@@ -308,7 +308,7 @@ GEM ...@@ -308,7 +308,7 @@ GEM
po_to_json (>= 1.0.0) po_to_json (>= 1.0.0)
rails (>= 3.2.0) rails (>= 3.2.0)
gherkin-ruby (0.3.2) gherkin-ruby (0.3.2)
gitaly-proto (0.69.0) gitaly-proto (0.73.0)
google-protobuf (~> 3.1) google-protobuf (~> 3.1)
grpc (~> 1.0) grpc (~> 1.0)
github-linguist (4.7.6) github-linguist (4.7.6)
...@@ -1089,7 +1089,7 @@ DEPENDENCIES ...@@ -1089,7 +1089,7 @@ DEPENDENCIES
gettext (~> 3.2.2) gettext (~> 3.2.2)
gettext_i18n_rails (~> 1.8.0) gettext_i18n_rails (~> 1.8.0)
gettext_i18n_rails_js (~> 1.2.0) gettext_i18n_rails_js (~> 1.2.0)
gitaly-proto (~> 0.69.0) gitaly-proto (~> 0.73.0)
github-linguist (~> 4.7.0) github-linguist (~> 4.7.0)
gitlab-flowdock-git-hook (~> 1.0.1) gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-license (~> 1.0) gitlab-license (~> 1.0)
......
...@@ -20,4 +20,3 @@ export default () => { ...@@ -20,4 +20,3 @@ export default () => {
); );
} }
}; };
- illustration = local_assigns.fetch(:illustration) - illustration = local_assigns.fetch(:illustration)
- illustration_size = local_assigns.fetch(:illustration_size) - illustration_size = local_assigns.fetch(:illustration_size)
- title = local_assigns.fetch(:title) - title = local_assigns.fetch(:title)
- content = local_assigns.fetch(:content) - content = local_assigns.fetch(:content, nil)
- action = local_assigns.fetch(:action, nil) - action = local_assigns.fetch(:action, nil)
.row.empty-state .row.empty-state
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
.col-xs-12 .col-xs-12
.text-content .text-content
%h4.text-center= title %h4.text-center= title
%p= content - if content
%p= content
- if action - if action
.text-center .text-center
= action = action
...@@ -95,14 +95,13 @@ ...@@ -95,14 +95,13 @@
illustration: 'illustrations/manual_action.svg', illustration: 'illustrations/manual_action.svg',
illustration_size: 'svg-394', illustration_size: 'svg-394',
title: _('This job requires a manual action'), title: _('This job requires a manual action'),
content: _('This job depends on a user to trigger its process. Often they are used to deploy code to production environments.'), content: _('This job depends on a user to trigger its process. Often they are used to deploy code to production environments'),
action: ( link_to _('Trigger this manual action'), play_project_job_path(@project, @build), class: 'btn btn-primary', title: _('Trigger this manual action') ) action: ( link_to _('Trigger this manual action'), play_project_job_path(@project, @build), method: :post, class: 'btn btn-primary', title: _('Trigger this manual action') )
- else - else
= render 'empty_state', = render 'empty_state',
illustration: 'illustrations/job_not_triggered.svg', illustration: 'illustrations/job_not_triggered.svg',
illustration_size: 'svg-306', illustration_size: 'svg-306',
title: _('This job has not been triggered yet'), title: _('This job has not been triggered yet')
content: _('This job depends on upstream jobs that need to succeed in order for this job to be triggered.')
= render "sidebar" = render "sidebar"
......
...@@ -17,10 +17,7 @@ class RepositoryForkWorker ...@@ -17,10 +17,7 @@ class RepositoryForkWorker
project.repository_storage_path, project.disk_path) project.repository_storage_path, project.disk_path)
raise "Unable to fork project #{project_id} for repository #{source_disk_path} -> #{project.disk_path}" unless result raise "Unable to fork project #{project_id} for repository #{source_disk_path} -> #{project.disk_path}" unless result
project.repository.after_import project.after_import
raise "Project #{project_id} had an invalid repository after fork" unless project.valid_repo?
project.import_finish
end end
private private
......
---
title: Makes forking protect default branch on completion
merge_request:
author:
type: fixed
---
title: 'Closes #38540 - Remove .ssh/environment file that now breaks the gitlab:check
rake task'
merge_request:
author:
type: fixed
---
title: "[API] Fix creating issue when assignee_id is empty"
merge_request:
author:
type: fixed
...@@ -17,11 +17,11 @@ module API ...@@ -17,11 +17,11 @@ module API
end end
def storage_health def storage_health
@failing_storage_health ||= Gitlab::Git::Storage::Health.for_all_storages @storage_health ||= Gitlab::Git::Storage::Health.for_all_storages
end end
end end
desc 'Get all failing git storages' do desc 'Get all git storages' do
detail 'This feature was introduced in GitLab 9.5' detail 'This feature was introduced in GitLab 9.5'
success Entities::RepositoryStorageHealth success Entities::RepositoryStorageHealth
end end
......
...@@ -44,29 +44,13 @@ module Gitlab ...@@ -44,29 +44,13 @@ module Gitlab
# Import project via git clone --bare # Import project via git clone --bare
# URL must be publicly cloneable # URL must be publicly cloneable
def import_project(source, timeout) def import_project(source, timeout)
# Skip import if repo already exists Gitlab::GitalyClient.migrate(:import_repository) do |is_enabled|
return false if File.exist?(repository_absolute_path) if is_enabled
gitaly_import_repository(source)
masked_source = mask_password_in_url(source) else
git_import_repository(source, timeout)
logger.info "Importing project from <#{masked_source}> to <#{repository_absolute_path}>." end
cmd = %W(git clone --bare -- #{source} #{repository_absolute_path})
success = run_with_timeout(cmd, timeout, nil)
unless success
logger.error("Importing project from <#{masked_source}> to <#{repository_absolute_path}> failed.")
FileUtils.rm_rf(repository_absolute_path)
return false
end end
Gitlab::Git::Repository.create_hooks(repository_absolute_path, global_hooks_path)
# The project was imported successfully.
# Remove the origin URL since it may contain password.
remove_origin_in_repo
true
end end
def fork_repository(new_shard_path, new_repository_relative_path) def fork_repository(new_shard_path, new_repository_relative_path)
...@@ -231,6 +215,42 @@ module Gitlab ...@@ -231,6 +215,42 @@ module Gitlab
raise(ShardNameNotFoundError, "no shard found for path '#{shard_path}'") raise(ShardNameNotFoundError, "no shard found for path '#{shard_path}'")
end end
def git_import_repository(source, timeout)
# Skip import if repo already exists
return false if File.exist?(repository_absolute_path)
masked_source = mask_password_in_url(source)
logger.info "Importing project from <#{masked_source}> to <#{repository_absolute_path}>."
cmd = %W(git clone --bare -- #{source} #{repository_absolute_path})
success = run_with_timeout(cmd, timeout, nil)
unless success
logger.error("Importing project from <#{masked_source}> to <#{repository_absolute_path}> failed.")
FileUtils.rm_rf(repository_absolute_path)
return false
end
Gitlab::Git::Repository.create_hooks(repository_absolute_path, global_hooks_path)
# The project was imported successfully.
# Remove the origin URL since it may contain password.
remove_origin_in_repo
true
end
def gitaly_import_repository(source)
raw_repository = Gitlab::Git::Repository.new(shard_name, repository_relative_path, nil)
Gitlab::GitalyClient::RepositoryService.new(raw_repository).import_repository(source)
true
rescue GRPC::BadStatus => e
@output << e.message
false
end
def git_fork_repository(new_shard_path, new_repository_relative_path) def git_fork_repository(new_shard_path, new_repository_relative_path)
from_path = repository_absolute_path from_path = repository_absolute_path
to_path = File.join(new_shard_path, new_repository_relative_path) to_path = File.join(new_shard_path, new_repository_relative_path)
......
...@@ -177,7 +177,7 @@ module Gitlab ...@@ -177,7 +177,7 @@ module Gitlab
response = GitalyClient.call(@repository.storage, :commit_service, :list_commits_by_oid, request, timeout: GitalyClient.medium_timeout) response = GitalyClient.call(@repository.storage, :commit_service, :list_commits_by_oid, request, timeout: GitalyClient.medium_timeout)
consume_commits_response(response) consume_commits_response(response)
rescue GRPC::Unknown # If no repository is found, happens mainly during testing rescue GRPC::NotFound # If no repository is found, happens mainly during testing
[] []
end end
......
...@@ -100,6 +100,21 @@ module Gitlab ...@@ -100,6 +100,21 @@ module Gitlab
) )
end end
def import_repository(source)
request = Gitaly::CreateRepositoryFromURLRequest.new(
repository: @gitaly_repo,
url: source
)
GitalyClient.call(
@storage,
:repository_service,
:create_repository_from_url,
request,
timeout: GitalyClient.default_timeout
)
end
def rebase_in_progress?(rebase_id) def rebase_in_progress?(rebase_id)
request = Gitaly::IsRebaseInProgressRequest.new( request = Gitaly::IsRebaseInProgressRequest.new(
repository: @gitaly_repo, repository: @gitaly_repo,
......
...@@ -36,7 +36,11 @@ module Gitlab ...@@ -36,7 +36,11 @@ module Gitlab
def complete_command(namespace_name) def complete_command(namespace_name)
return unless chart return unless chart
"helm install #{chart} --name #{name} --namespace #{namespace_name} >/dev/null" if chart_values_file
"helm install #{chart} --name #{name} --namespace #{namespace_name} -f /data/helm/#{name}/config/values.yaml >/dev/null"
else
"helm install #{chart} --name #{name} --namespace #{namespace_name} >/dev/null"
end
end end
def install_dps_command def install_dps_command
......
...@@ -10,9 +10,10 @@ module Gitlab ...@@ -10,9 +10,10 @@ module Gitlab
def generate def generate
spec = { containers: [container_specification], restartPolicy: 'Never' } spec = { containers: [container_specification], restartPolicy: 'Never' }
if command.chart_values_file if command.chart_values_file
generate_config_map create_config_map
spec['volumes'] = volumes_specification spec[:volumes] = volumes_specification
end end
::Kubeclient::Resource.new(metadata: metadata, spec: spec) ::Kubeclient::Resource.new(metadata: metadata, spec: spec)
...@@ -35,19 +36,39 @@ module Gitlab ...@@ -35,19 +36,39 @@ module Gitlab
end end
def labels def labels
{ 'gitlab.org/action': 'install', 'gitlab.org/application': command.name } {
'gitlab.org/action': 'install',
'gitlab.org/application': command.name
}
end end
def metadata def metadata
{ name: command.pod_name, namespace: namespace_name, labels: labels } {
name: command.pod_name,
namespace: namespace_name,
labels: labels
}
end end
def volume_mounts_specification def volume_mounts_specification
[{ name: 'config-volume', mountPath: '/etc/config' }] [
{
name: 'configuration-volume',
mountPath: "/data/helm/#{command.name}/config"
}
]
end end
def volumes_specification def volumes_specification
[{ name: 'config-volume', configMap: { name: 'values-config' } }] [
{
name: 'configuration-volume',
configMap: {
name: 'values-content-configuration',
items: [{ key: 'values', path: 'values.yaml' }]
}
}
]
end end
def generate_pod_env(command) def generate_pod_env(command)
...@@ -58,10 +79,10 @@ module Gitlab ...@@ -58,10 +79,10 @@ module Gitlab
}.map { |key, value| { name: key, value: value } } }.map { |key, value| { name: key, value: value } }
end end
def generate_config_map def create_config_map
resource = ::Kubeclient::Resource.new resource = ::Kubeclient::Resource.new
resource.metadata = { name: 'values-config', namespace: namespace_name } resource.metadata = { name: 'values-content-configuration', namespace: namespace_name, labels: { name: 'values-content-configuration' } }
resource.data = YAML.load_file(command.chart_values_file) resource.data = { values: File.read(command.chart_values_file) }
kubeclient.create_config_map(resource) kubeclient.create_config_map(resource)
end end
end end
......
...@@ -54,16 +54,6 @@ namespace :gitlab do ...@@ -54,16 +54,6 @@ namespace :gitlab do
# (Re)create hooks # (Re)create hooks
Rake::Task['gitlab:shell:create_hooks'].invoke Rake::Task['gitlab:shell:create_hooks'].invoke
# Required for debian packaging with PKGR: Setup .ssh/environment with
# the current PATH, so that the correct ruby version gets loaded
# Requires to set "PermitUserEnvironment yes" in sshd config (should not
# be an issue since it is more than likely that there are no "normal"
# user accounts on a gitlab server). The alternative is for the admin to
# install a ruby (1.9.3+) in the global path.
File.open(File.join(user_home, ".ssh", "environment"), "w+") do |f|
f.puts "PATH=#{ENV['PATH']}"
end
Gitlab::Shell.ensure_secret_token! Gitlab::Shell.ensure_secret_token!
end end
......
...@@ -391,9 +391,18 @@ feature 'Jobs' do ...@@ -391,9 +391,18 @@ feature 'Jobs' do
it 'shows manual action empty state' do it 'shows manual action empty state' do
expect(page).to have_content('This job requires a manual action') expect(page).to have_content('This job requires a manual action')
expect(page).to have_content('This job depends on a user to trigger its process. Often they are used to deploy code to production environments.') expect(page).to have_content('This job depends on a user to trigger its process. Often they are used to deploy code to production environments')
expect(page).to have_link('Trigger this manual action') expect(page).to have_link('Trigger this manual action')
end end
it 'plays manual action', :js do
click_link 'Trigger this manual action'
wait_for_requests
expect(page).to have_content('This job has not been triggered')
expect(page).to have_content('This job is stuck, because the project doesn\'t have any runners online assigned to it.')
expect(page).to have_content('pending')
end
end end
context 'Non triggered job' do context 'Non triggered job' do
...@@ -403,9 +412,8 @@ feature 'Jobs' do ...@@ -403,9 +412,8 @@ feature 'Jobs' do
visit project_job_path(project, job) visit project_job_path(project, job)
end end
it 'shows manual action empty state' do it 'shows empty state' do
expect(page).to have_content('This job has not been triggered yet') expect(page).to have_content('This job has not been triggered yet')
expect(page).to have_content('This job depends on upstream jobs that need to succeed in order for this job to be triggered.')
end end
end end
end end
......
...@@ -158,39 +158,55 @@ describe Gitlab::Git::GitlabProjects do ...@@ -158,39 +158,55 @@ describe Gitlab::Git::GitlabProjects do
subject { gl_projects.import_project(import_url, timeout) } subject { gl_projects.import_project(import_url, timeout) }
context 'success import' do shared_examples 'importing repository' do
it 'imports a repo' do context 'success import' do
expect(File.exist?(File.join(tmp_repo_path, 'HEAD'))).to be_falsy it 'imports a repo' do
expect(File.exist?(File.join(tmp_repo_path, 'HEAD'))).to be_falsy
message = "Importing project from <#{import_url}> to <#{tmp_repo_path}>." is_expected.to be_truthy
expect(logger).to receive(:info).with(message)
is_expected.to be_truthy expect(File.exist?(File.join(tmp_repo_path, 'HEAD'))).to be_truthy
end
end
expect(File.exist?(File.join(tmp_repo_path, 'HEAD'))).to be_truthy context 'already exists' do
it "doesn't import" do
FileUtils.mkdir_p(tmp_repo_path)
is_expected.to be_falsy
end
end end
end end
context 'already exists' do context 'when Gitaly import_repository feature is enabled' do
it "doesn't import" do it_behaves_like 'importing repository'
FileUtils.mkdir_p(tmp_repo_path) end
context 'when Gitaly import_repository feature is disabled', :disable_gitaly do
describe 'logging' do
it 'imports a repo' do
message = "Importing project from <#{import_url}> to <#{tmp_repo_path}>."
expect(logger).to receive(:info).with(message)
is_expected.to be_falsy subject
end
end end
end
context 'timeout' do context 'timeout' do
it 'does not import a repo' do it 'does not import a repo' do
stub_spawn_timeout(cmd, timeout, nil) stub_spawn_timeout(cmd, timeout, nil)
message = "Importing project from <#{import_url}> to <#{tmp_repo_path}> failed." message = "Importing project from <#{import_url}> to <#{tmp_repo_path}> failed."
expect(logger).to receive(:error).with(message) expect(logger).to receive(:error).with(message)
is_expected.to be_falsy is_expected.to be_falsy
expect(gl_projects.output).to eq("Timed out\n") expect(gl_projects.output).to eq("Timed out\n")
expect(File.exist?(File.join(tmp_repo_path, 'HEAD'))).to be_falsy expect(File.exist?(File.join(tmp_repo_path, 'HEAD'))).to be_falsy
end
end end
it_behaves_like 'importing repository'
end end
end end
......
...@@ -100,6 +100,25 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do ...@@ -100,6 +100,25 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do
is_expected.to eq(command) is_expected.to eq(command)
end end
end end
context 'when chart values file is present' do
let(:install_command) { described_class.new(prometheus.name, chart: prometheus.chart, chart_values_file: prometheus.chart_values_file) }
let(:command) do
<<~MSG.chomp
set -eo pipefail
apk add -U ca-certificates openssl >/dev/null
wget -q -O - https://kubernetes-helm.storage.googleapis.com/helm-v2.7.0-linux-amd64.tar.gz | tar zxC /tmp >/dev/null
mv /tmp/linux-amd64/helm /usr/bin/
helm init --client-only >/dev/null
helm install #{prometheus.chart} --name #{prometheus.name} --namespace #{namespace.name} -f /data/helm/#{prometheus.name}/config/values.yaml >/dev/null
MSG
end
it 'should return appropriate command' do
is_expected.to eq(command)
end
end
end end
describe "#pod_name" do describe "#pod_name" do
......
...@@ -52,18 +52,20 @@ describe Gitlab::Kubernetes::Helm::Pod do ...@@ -52,18 +52,20 @@ describe Gitlab::Kubernetes::Helm::Pod do
it 'should include volumes for the container' do it 'should include volumes for the container' do
container = subject.generate.spec.containers.first container = subject.generate.spec.containers.first
expect(container.volumeMounts.first['name']).to eq('config-volume') expect(container.volumeMounts.first['name']).to eq('configuration-volume')
expect(container.volumeMounts.first['mountPath']).to eq('/etc/config') expect(container.volumeMounts.first['mountPath']).to eq("/data/helm/#{app.name}/config")
end end
it 'should include a volume inside the specification' do it 'should include a volume inside the specification' do
spec = subject.generate.spec spec = subject.generate.spec
expect(spec.volumes.first['name']).to eq('config-volume') expect(spec.volumes.first['name']).to eq('configuration-volume')
end end
it 'should mount configMap specification in the volume' do it 'should mount configMap specification in the volume' do
spec = subject.generate.spec spec = subject.generate.spec
expect(spec.volumes.first.configMap['name']).to eq('values-config') expect(spec.volumes.first.configMap['name']).to eq('values-content-configuration')
expect(spec.volumes.first.configMap['items'].first['key']).to eq('values')
expect(spec.volumes.first.configMap['items'].first['path']).to eq('values.yaml')
end end
end end
......
...@@ -104,10 +104,12 @@ RSpec.configure do |config| ...@@ -104,10 +104,12 @@ RSpec.configure do |config|
TestEnv.init TestEnv.init
end end
# EE-specific start
config.before(:all) do config.before(:all) do
License.destroy_all License.destroy_all
TestLicense.init TestLicense.init
end end
# EE-specific stop
config.before(:example) do config.before(:example) do
# Skip pre-receive hook check so we can use the web editor and merge. # Skip pre-receive hook check so we can use the web editor and merge.
......
...@@ -47,6 +47,14 @@ describe RepositoryForkWorker do ...@@ -47,6 +47,14 @@ describe RepositoryForkWorker do
perform! perform!
end end
it 'protects the default branch' do
expect_fork_repository.and_return(true)
perform!
expect(fork_project.protected_branches.first.name).to eq(fork_project.default_branch)
end
it 'flushes various caches' do it 'flushes various caches' do
expect_fork_repository.and_return(true) expect_fork_repository.and_return(true)
......
alertmanager: | alertmanager:
enabled: false enabled: false
kubeStateMetrics: | kubeStateMetrics:
enabled: 'false' enabled: false
nodeExporter: | nodeExporter:
enabled: 'false' enabled: false
pushgateway: | pushgateway:
enabled: 'false' enabled: false
serverFiles: | serverFiles:
alerts: '' alerts: ""
rules: '' rules: ""
prometheus.yml: |- prometheus.yml: |-
rule_files: | rule_files:
- /etc/config/rules - /etc/config/rules
- /etc/config/alerts - /etc/config/alerts
scrape_configs: |
scrape_configs:
- job_name: prometheus - job_name: prometheus
static_configs: | static_configs:
- targets: - targets:
- localhost:9090 - localhost:9090
- job_name: 'kubernetes-apiservers' - job_name: 'kubernetes-apiservers'
kubernetes_sd_configs: |
kubernetes_sd_configs:
- role: endpoints - role: endpoints
scheme: https scheme: https
tls_config: tls_config:
...@@ -37,14 +40,17 @@ serverFiles: | ...@@ -37,14 +40,17 @@ serverFiles: |
- source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name] - source_labels: [__meta_kubernetes_namespace, __meta_kubernetes_service_name, __meta_kubernetes_endpoint_port_name]
action: keep action: keep
regex: default;kubernetes;https regex: default;kubernetes;https
- job_name: 'kubernetes-nodes' - job_name: 'kubernetes-nodes'
scheme: https scheme: https
tls_config: tls_config:
ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt ca_file: /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
insecure_skip_verify: true insecure_skip_verify: true
bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token bearer_token_file: /var/run/secrets/kubernetes.io/serviceaccount/token
kubernetes_sd_configs: kubernetes_sd_configs:
- role: node - role: node
relabel_configs: relabel_configs:
- action: labelmap - action: labelmap
regex: __meta_kubernetes_node_label_(.+) regex: __meta_kubernetes_node_label_(.+)
...@@ -54,14 +60,15 @@ serverFiles: | ...@@ -54,14 +60,15 @@ serverFiles: |
regex: (.+) regex: (.+)
target_label: __metrics_path__ target_label: __metrics_path__
replacement: /api/v1/nodes/${1}/proxy/metrics replacement: /api/v1/nodes/${1}/proxy/metrics
- job_name: 'kubernetes-service-endpoints' - job_name: 'kubernetes-service-endpoints'
kubernetes_sd_configs: kubernetes_sd_configs:
- role: endpoints - role: endpoints
relabel_configs: |
relabel_configs:
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape] - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scrape]
action: keep action: keep
regex: 'true' regex: true
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme] - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_scheme]
action: replace action: replace
target_label: __scheme__ target_label: __scheme__
...@@ -83,24 +90,30 @@ serverFiles: | ...@@ -83,24 +90,30 @@ serverFiles: |
- source_labels: [__meta_kubernetes_service_name] - source_labels: [__meta_kubernetes_service_name]
action: replace action: replace
target_label: kubernetes_name target_label: kubernetes_name
- job_name: 'prometheus-pushgateway' - job_name: 'prometheus-pushgateway'
honor_labels: true honor_labels: true
kubernetes_sd_configs: |
kubernetes_sd_configs:
- role: service - role: service
relabel_configs: |
relabel_configs:
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe] - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe]
action: keep action: keep
regex: pushgateway regex: pushgateway
- job_name: 'kubernetes-services' - job_name: 'kubernetes-services'
metrics_path: /probe metrics_path: /probe
params: | params:
module: [http_2xx] module: [http_2xx]
kubernetes_sd_configs: |
kubernetes_sd_configs:
- role: service - role: service
relabel_configs: |
relabel_configs:
- source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe] - source_labels: [__meta_kubernetes_service_annotation_prometheus_io_probe]
action: keep action: keep
regex: 'true' regex: true
- source_labels: [__address__] - source_labels: [__address__]
target_label: __param_target target_label: __param_target
- target_label: __address__ - target_label: __address__
...@@ -113,17 +126,25 @@ serverFiles: | ...@@ -113,17 +126,25 @@ serverFiles: |
target_label: kubernetes_namespace target_label: kubernetes_namespace
- source_labels: [__meta_kubernetes_service_name] - source_labels: [__meta_kubernetes_service_name]
target_label: kubernetes_name target_label: kubernetes_name
- job_name: 'kubernetes-pods' - job_name: 'kubernetes-pods'
kubernetes_sd_configs: kubernetes_sd_configs:
- role: pod - role: pod
relabel_configs: relabel_configs:
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape] - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]
action: keep action: keep
regex: 'true' regex: true
- source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path] - source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]
action: replace action: replace
target_label: __metrics_path__ target_label: __metrics_path__
regex: (.+) regex: (.+)
- source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]
action: replace
regex: (.+):(?:\d+);(\d+)
replacement: ${1}:${2}
target_label: __address__
- action: labelmap - action: labelmap
regex: __meta_kubernetes_pod_label_(.+) regex: __meta_kubernetes_pod_label_(.+)
- source_labels: [__meta_kubernetes_namespace] - source_labels: [__meta_kubernetes_namespace]
......
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