Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

Commit

Permalink
chore: distribute apiserver.crt to control plane nodes only (#3860)
Browse files Browse the repository at this point in the history
  • Loading branch information
jadarsie authored Sep 24, 2020
1 parent 1a3556e commit a949b03
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/rotate_certs.go
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ func (rcc *rotateCertsCmd) rotateApiserver() error {

for _, host := range rcc.agentNodes {
log.Debugf("Ranging over node: %s\n", host.Name)
for _, cmd := range []string{caCertificateCmd, apiServerCertificateCmd} {
for _, cmd := range []string{caCertificateCmd} {
out, err := rcc.sshCommandExecuter(cmd, rcc.masterFQDN, host.Name, "22", rcc.sshConfig)
if err != nil {
log.Printf("Command %s output: %s\n", cmd, out)
Expand Down
12 changes: 7 additions & 5 deletions parts/k8s/cloud-init/artifacts/cse_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,18 @@ configureKubeletServerCert() {
configureK8s() {
local client_key="/etc/kubernetes/certs/client.key" apiserver_crt="/etc/kubernetes/certs/apiserver.crt" azure_json="/etc/kubernetes/azure.json"
touch "${client_key}"
touch "${apiserver_crt}"
chmod 0600 "${client_key}"
chmod 0644 "${apiserver_crt}"
chown root:root "${client_key}" "${apiserver_crt}"

chown root:root "${client_key}"
if [[ -n ${MASTER_NODE} ]]; then
touch "${apiserver_crt}"
chmod 0644 "${apiserver_crt}"
chown root:root "${apiserver_crt}"
fi
set +x
echo "${KUBELET_PRIVATE_KEY}" | base64 --decode >"${client_key}"
echo "${APISERVER_PUBLIC_KEY}" | base64 --decode >"${apiserver_crt}"
configureKubeletServerCert
if [[ -n ${MASTER_NODE} ]]; then
echo "${APISERVER_PUBLIC_KEY}" | base64 --decode >"${apiserver_crt}"
if [[ ${ENABLE_AGGREGATED_APIS} == True ]]; then
generateAggregatedAPICerts
fi
Expand Down
12 changes: 7 additions & 5 deletions pkg/engine/templates_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a949b03

Please sign in to comment.