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

chore: reduce customData payload #3793

Merged
merged 12 commits into from
Sep 10, 2020

Conversation

jackfrancis
Copy link
Member

Reason for Change:

Yes, this is a chore.

Reducing customData (Azure ARM template cloud-init payload) via:

  • moved the static "generate proxy certs" script to the VHD, so that VHD-enabled cluster buildouts don't need to include that script at runtime
  • a CSE once-over, to shorten variable names, remove duplication, and other optimizations that have no functional impact but reduce the payload of the script itself

Issue Fixed:

Requirements:

Notes:

@codecov
Copy link

codecov bot commented Sep 4, 2020

Codecov Report

Merging #3793 into master will decrease coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3793      +/-   ##
==========================================
- Coverage   73.21%   73.19%   -0.03%     
==========================================
  Files         148      148              
  Lines       25385    25394       +9     
==========================================
+ Hits        18586    18587       +1     
- Misses       5663     5671       +8     
  Partials     1136     1136              
Impacted Files Coverage Δ
pkg/engine/templates_generated.go 53.42% <ø> (ø)
pkg/api/types.go 94.32% <100.00%> (ø)
pkg/engine/armvariables.go 86.49% <100.00%> (ø)
cmd/upgrade.go 42.71% <0.00%> (-1.50%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c58ad50...fe3f49b. Read the comment docs.

mboersma
mboersma previously approved these changes Sep 8, 2020
Copy link
Member

@mboersma mboersma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

Just some optional suggestions.

@@ -50,20 +50,21 @@
},
{
"name": "node-problem-detector",
"enabled": true
"enabled": false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢 oh well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is just temporary :)

ETCD_SERVER_PRIVATE_KEY_PATH="/etc/kubernetes/certs/etcdserver.key"
touch "${ETCD_SERVER_PRIVATE_KEY_PATH}"
local apiserver_key="/etc/kubernetes/certs/apiserver.key" ca_key="/etc/kubernetes/certs/ca.key" etcdserver_key="/etc/kubernetes/certs/etcdserver.key"
touch "${apiserver_key}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

touch takes multiple arguments, so these three commands could be a one-liner for a savings of...drumroll...12 bytes.

ETCD_PEER_PRIVATE_KEY_PATH="/etc/kubernetes/certs/etcdpeer${NODE_INDEX}.key"
touch "${ETCD_PEER_PRIVATE_KEY_PATH}"
local etcdclient_key="/etc/kubernetes/certs/etcdclient.key" etcdpeer_key="/etc/kubernetes/certs/etcdpeer${NODE_INDEX}.key"
touch "${etcdclient_key}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, this could be

 touch "${etcdclient_key}" "${etcdpeer_key}"

and so on below...

echo "${ETCD_SERVER_CERTIFICATE}" | base64 --decode >"${ETCD_SERVER_CERTIFICATE_PATH}"
echo "${ETCD_CLIENT_CERTIFICATE}" | base64 --decode >"${ETCD_CLIENT_CERTIFICATE_PATH}"
echo "${ETCD_PEER_CERT}" | base64 --decode >"${ETCD_PEER_CERTIFICATE_PATH}"
echo "${APISERVER_PRIVATE_KEY}" | base64 --decode >"${apiserver_key}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

base64 -d could save some bytes if we're ok with the short argument style.

dkms remove -m nvidia -v $GPU_DV -k $KERNEL_NAME
local d="/var/lib/dkms/nvidia/${GPU_DV}" k log_file="/var/log/nvidia-installer-$(date +%s).log"
k=$(uname -r)
if [ -d $d ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shortening these variable names makes things less readable, but these changes are mostly localized so I suppose it's tolerable. Whatever is necessary to save bytes.

local path="/usr/bin"
CONTAINER_IMAGE=${ETCD_DOWNLOAD_URL}etcd:v${ETCD_VERSION}
pullContainerImage $CLI_TOOL ${CONTAINER_IMAGE}
local v
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra space here. 🙀

parts/k8s/cloud-init/artifacts/cse_install.sh Show resolved Hide resolved
@acs-bot
Copy link

acs-bot commented Sep 8, 2020

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jackfrancis, mboersma

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [jackfrancis,mboersma]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jackfrancis
Copy link
Member Author

Hold merge until we get a new VHD built and merged from this commit, so that we can undo the E2E cluster config changes.

@acs-bot
Copy link

acs-bot commented Sep 9, 2020

New changes are detected. LGTM label has been removed.

@acs-bot acs-bot removed the lgtm label Sep 9, 2020
@jackfrancis
Copy link
Member Author

Flatcar config regressed:

Error from deployment for kubernetes-westus2-29909 in resource group kubernetes-westus2-29909:exit status 1
 2020/09/10 00:30:51 Command Output: Deployment failed. Correlation ID: bcee57e6-b586-4d8f-89a2-d057062e6da0. {
   "status": "Failed",
   "error": {
     "code": "ResourceDeploymentFailure",
     "message": "The resource operation completed with terminal provisioning state 'Failed'.",
     "details": [
       {
         "code": "VMExtensionProvisioningError",
         "message": "VM has reported a failure when processing extension 'vmssCSE'. Error message: \"Enable failed: failed to execute command: command terminated with exit status=6\n[stdout]\nThu Sep 10 00:08:59 UTC 2020,k8s-pool1-13077327-vmss000000\n\n[stderr]\ngrep: /opt/azure/containers/provision.sh: No such file or directory\ngrep: /opt/azure/containers/provision.sh: No such file or directory\ngrep: /opt/azure/containers/provision.sh: No such file or directory\ngrep: /opt/azure/containers/provision.sh: No such file or directory\n\"\r\n\r\nMore information on troubleshooting is available at https://aka.ms/VMExtensionCSELinuxTroubleshoot "
       }
     ]
   }
 }

@jackfrancis jackfrancis merged commit db44f60 into Azure:master Sep 10, 2020
@jackfrancis jackfrancis deleted the customData-reduce branch September 10, 2020 19:45
penggu pushed a commit to penggu/aks-engine that referenced this pull request Oct 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants