diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-05-22 11:36:56 +0100 |
---|---|---|
committer | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-05-22 11:36:56 +0100 |
commit | 0b1c690466db49fa2338046b9e841dfbce7ac2d9 (patch) | |
tree | 9cd8d23bb93e4342facbf7465e8cba7f71ccd8a2 | |
parent | 4d674bd38c8a3568f6e1295c25c902ef10151aef (diff) | |
download | gitlab-ce-0b1c690466db49fa2338046b9e841dfbce7ac2d9.tar.gz |
Monkey patches Kubeclient::Client#proxy_url in order to make it compliant with version 1.10 of kubernetes API
-rw-r--r-- | config/initializers/kubeclient.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/config/initializers/kubeclient.rb b/config/initializers/kubeclient.rb new file mode 100644 index 00000000000..1847b9e0e89 --- /dev/null +++ b/config/initializers/kubeclient.rb @@ -0,0 +1,15 @@ +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 |