mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #60174 from hyperbolic2346/mwilson/metrics-server
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Adding metrics server **What this PR does / why we need it**: Adds support for the metrics server in the kubernetes-master charm. This allows the use of a horizontal pod autoscaler. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/484 **Special notes for your reviewer**: Needs to go in after https://github.com/juju-solutions/cdk-addons/pull/28 **Release note**: ```release-note kubernetes-master charm now supports metrics server for horizontal pod autoscaler. ```
This commit is contained in:
commit
2550bab1e3
@ -86,3 +86,8 @@ options:
|
||||
description: |
|
||||
The storage backend for kube-apiserver persistence. Can be "etcd2", "etcd3", or
|
||||
"auto". Auto mode will select etcd3 on new installations, or etcd2 on upgrades.
|
||||
enable-metrics:
|
||||
type: boolean
|
||||
default: true
|
||||
description: |
|
||||
If true the metrics server for Kubernetes will be deployed onto the cluster.
|
||||
|
@ -640,12 +640,14 @@ def configure_cdk_addons():
|
||||
remove_state('cdk-addons.configured')
|
||||
dbEnabled = str(hookenv.config('enable-dashboard-addons')).lower()
|
||||
dnsEnabled = str(hookenv.config('enable-kube-dns')).lower()
|
||||
metricsEnabled = str(hookenv.config('enable-metrics')).lower()
|
||||
args = [
|
||||
'arch=' + arch(),
|
||||
'dns-ip=' + get_deprecated_dns_ip(),
|
||||
'dns-domain=' + hookenv.config('dns_domain'),
|
||||
'enable-dashboard=' + dbEnabled,
|
||||
'enable-kube-dns=' + dnsEnabled
|
||||
'enable-kube-dns=' + dnsEnabled,
|
||||
'enable-metrics=' + metricsEnabled
|
||||
]
|
||||
check_call(['snap', 'set', 'cdk-addons'] + args)
|
||||
if not addons_ready():
|
||||
@ -1183,6 +1185,18 @@ def configure_apiserver(etcd_connection_string, leader_etcd_version):
|
||||
else:
|
||||
api_opts['admission-control'] = ','.join(admission_control)
|
||||
|
||||
if get_version('kube-apiserver') > (1, 6) and \
|
||||
hookenv.config('enable-metrics'):
|
||||
api_opts['requestheader-client-ca-file'] = ca_cert_path
|
||||
api_opts['requestheader-allowed-names'] = 'client'
|
||||
api_opts['requestheader-extra-headers-prefix'] = 'X-Remote-Extra-'
|
||||
api_opts['requestheader-group-headers'] = 'X-Remote-Group'
|
||||
api_opts['requestheader-username-headers'] = 'X-Remote-User'
|
||||
api_opts['proxy-client-cert-file'] = client_cert_path
|
||||
api_opts['proxy-client-key-file'] = client_key_path
|
||||
api_opts['enable-aggregator-routing'] = 'true'
|
||||
api_opts['client-ca-file'] = ca_cert_path
|
||||
|
||||
configure_kubernetes_service('kube-apiserver', api_opts, 'api-extra-args')
|
||||
restart_apiserver()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user