Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove special handling for services when building the proxy URL #323

Merged
merged 4 commits into from
Jun 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ puts config.context.namespace

### Supported kubernetes versions

For 1.1 only the core api v1 is supported, all api groups are supported in later versions.
We try to support the last 3 minor versions, matching the [official support policy for Kubernetes](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/release/versioning.md#supported-releases-and-component-skew). Kubernetes 1.2 and below have known issues and are unsupported.

## Examples:

Expand Down
7 changes: 1 addition & 6 deletions lib/kubeclient/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,7 @@ def proxy_url(kind, name, port, namespace = '')
@entities[kind.to_s].resource_name
end
ns_prefix = build_namespace_prefix(namespace)
# TODO: Change this once services supports the new scheme
if entity_name_plural == 'pods'
rest_client["#{ns_prefix}#{entity_name_plural}/#{name}:#{port}/proxy"].url
else
rest_client["proxy/#{ns_prefix}#{entity_name_plural}/#{name}:#{port}"].url
end
rest_client["#{ns_prefix}#{entity_name_plural}/#{name}:#{port}/proxy"].url
end

def process_template(template)
Expand Down
12 changes: 6 additions & 6 deletions test/test_kubeclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -710,12 +710,12 @@ def test_proxy_url

client = Kubeclient::Client.new('http://host:8080', 'v1')
assert_equal(
'http://host:8080/api/v1/proxy/namespaces/ns/services/srvname:srvportname',
'http://host:8080/api/v1/namespaces/ns/services/srvname:srvportname/proxy',
client.proxy_url('service', 'srvname', 'srvportname', 'ns')
)

assert_equal(
'http://host:8080/api/v1/proxy/namespaces/ns/services/srvname:srvportname',
'http://host:8080/api/v1/namespaces/ns/services/srvname:srvportname/proxy',
client.proxy_url('services', 'srvname', 'srvportname', 'ns')
)

Expand All @@ -731,23 +731,23 @@ def test_proxy_url

# Check no namespace provided
assert_equal(
'http://host:8080/api/v1/proxy/nodes/srvname:srvportname',
'http://host:8080/api/v1/nodes/srvname:srvportname/proxy',
client.proxy_url('nodes', 'srvname', 'srvportname')
)

assert_equal(
'http://host:8080/api/v1/proxy/nodes/srvname:srvportname',
'http://host:8080/api/v1/nodes/srvname:srvportname/proxy',
client.proxy_url('node', 'srvname', 'srvportname')
)

# Check integer port
assert_equal(
'http://host:8080/api/v1/proxy/nodes/srvname:5001',
'http://host:8080/api/v1/nodes/srvname:5001/proxy',
client.proxy_url('nodes', 'srvname', 5001)
)

assert_equal(
'http://host:8080/api/v1/proxy/nodes/srvname:5001',
'http://host:8080/api/v1/nodes/srvname:5001/proxy',
client.proxy_url('node', 'srvname', 5001)
)
end
Expand Down