diff options
author | Rémy Coutable <remy@rymai.me> | 2018-05-23 19:15:26 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-05-23 19:15:26 +0300 |
commit | 63379a2ae7f04f533780ee53c04a0d2847c600aa (patch) | |
tree | 60089ab48bdc34b884909039660e42061322ddeb /config | |
parent | 31413f4c1469ebffe00cc657c3f94a59b48ace07 (diff) | |
parent | 7a73cff72edccfe00eeb78657c338bd996e1c561 (diff) |
Merge branch '46259-prometheus-integration-fails-on-kube-1-10' into 'master'
Resolve "Prometheus integration fails on k8s 1.10"
Closes #46259
See merge request gitlab-org/gitlab-ce!19082
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/kubeclient.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/config/initializers/kubeclient.rb b/config/initializers/kubeclient.rb new file mode 100644 index 00000000000..7f115268b37 --- /dev/null +++ b/config/initializers/kubeclient.rb @@ -0,0 +1,16 @@ +class Kubeclient::Client + # We need to monkey patch this method until + # https://github.com/abonas/kubeclient/pull/323 is merged + def proxy_url(kind, name, port, namespace = '') + discover unless @discovered + entity_name_plural = + if %w[services pods nodes].include?(kind.to_s) + kind.to_s + else + @entities[kind.to_s].resource_name + end + + ns_prefix = build_namespace_prefix(namespace) + rest_client["#{ns_prefix}#{entity_name_plural}/#{name}:#{port}/proxy"].url + end +end |