Class: Porkadot::Configs::Kubernetes::Apiserver

Inherits:
Object
  • Object
show all
Includes:
Porkadot::ConfigUtils, Component
Defined in:
lib/porkadot/configs/kubernetes.rb

Constant Summary

Constants included from Component

Component::RECOMMENDED_LABEL_PREFIX

Instance Method Summary collapse

Methods included from Component

#args, #instance_labels, #labels, #log_level

Methods included from Porkadot::ConfigUtils

#asset_path, #config, #logger, #method_missing, #raw, #respond_to_missing?, #secrets_path

Constructor Details

#initialize(config) ⇒ Apiserver

Returns a new instance of Apiserver.



88
89
90
91
# File 'lib/porkadot/configs/kubernetes.rb', line 88

def initialize config
  @config = config
  @raw = config.raw.kubernetes.apiserver
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Porkadot::ConfigUtils

Instance Method Details

#bootstrap_argsObject



97
98
99
# File 'lib/porkadot/configs/kubernetes.rb', line 97

def bootstrap_args
  return {}
end

#component_nameObject



93
94
95
# File 'lib/porkadot/configs/kubernetes.rb', line 93

def component_name
  'kube-apiserver'
end

#default_argsObject



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/porkadot/configs/kubernetes.rb', line 101

def default_args
  return %W(
    --advertise-address=$(POD_IP)
    --allow-privileged=true
    --authorization-mode=Node,RBAC
    --bind-address=0.0.0.0
    --client-ca-file=/etc/kubernetes/pki/kubernetes/ca.crt
    --enable-admission-plugins=NodeRestriction
    --enable-bootstrap-token-auth=true
    --etcd-cafile=/etc/kubernetes/pki/etcd/ca.crt
    --etcd-certfile=/etc/kubernetes/pki/etcd/etcd-client.crt
    --etcd-keyfile=/etc/kubernetes/pki/etcd/etcd-client.key
    --etcd-servers=#{config.etcd.advertise_client_urls.join(',')}
    --kubelet-certificate-authority=/etc/kubernetes/pki/kubernetes/ca.crt
    --kubelet-client-certificate=/etc/kubernetes/pki/kubernetes/kubelet-client.crt
    --kubelet-client-key=/etc/kubernetes/pki/kubernetes/kubelet-client.key
    --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
    --proxy-client-cert-file=/etc/kubernetes/pki/kubernetes/front-proxy-client.crt
    --proxy-client-key-file=/etc/kubernetes/pki/kubernetes/front-proxy-client.key
    --requestheader-allowed-names=aggregator-client
    --requestheader-client-ca-file=/etc/kubernetes/pki/kubernetes/front-proxy-ca.crt
    --requestheader-extra-headers-prefix=X-Remote-Extra-
    --requestheader-group-headers=X-Remote-Group
    --requestheader-username-headers=X-Remote-User
    --secure-port=#{self.bind_port}
    --service-account-issuer=https://kubernetes.default.svc#{self.config.k8s.networking.dns_domain}
    --service-account-key-file=/etc/kubernetes/pki/kubernetes/sa.pub
    --service-account-signing-key-file=/etc/kubernetes/pki/kubernetes/sa.key
    --service-cluster-ip-range=#{config.k8s.networking.service_subnet}
    --storage-backend=etcd3
    --tls-cert-file=/etc/kubernetes/pki/kubernetes/apiserver.crt
    --tls-private-key-file=/etc/kubernetes/pki/kubernetes/apiserver.key
    --v=#{self.log_level}
  ).map {|i| i.split('=', 2)}.to_h
end