Created
April 25, 2021 11:39
-
-
Save jdennes/ae4f747f771c40d747f5886bccb69ade to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auth_options = { | |
bearer_token_file: "/var/run/secrets/kubernetes.io/serviceaccount/token" | |
} | |
ssl_options = { | |
ca_file: "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt" | |
} | |
control_client = Kubeclient::Client.new \ | |
"https://kubernetes.default.svc", | |
"v1", | |
auth_options: auth_options, | |
ssl_options: ssl_options | |
candidate_client = Kubeclient::Client.new \ | |
"https://kubernetes.default.svc", | |
"v1", | |
auth_options: auth_options, | |
ssl_options: ssl_options, | |
as: :parsed_symbolized | |
require "benchmark" | |
config_map = "enterprise-settings" | |
namespace = File.read("/var/run/secrets/kubernetes.io/serviceaccount/namespace") | |
n = 1000 | |
Benchmark.bm do |benchmark| | |
benchmark.report("control") do | |
n.times do | |
control_client.get_config_map(config_map, namespace) | |
end | |
end | |
benchmark.report("candidate") do | |
n.times do | |
candidate_client.get_config_map(config_map, namespace) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment