Skip to content

Commit

Permalink
refactor: remove EnableTLSBootstrapping and check bootstrap token str…
Browse files Browse the repository at this point in the history
…ing directly
  • Loading branch information
Cameron Meissner committed Feb 20, 2025
1 parent 4e8f485 commit 73ed418
Show file tree
Hide file tree
Showing 277 changed files with 364 additions and 374 deletions.
4 changes: 0 additions & 4 deletions aks-node-controller/parser/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,6 @@ func getCustomCACertsStatus(customCACerts []string) bool {
return len(customCACerts) > 0
}

func getEnableTLSBootstrap(bootstrapConfig *aksnodeconfigv1.BootstrappingConfig) bool {
return bootstrapConfig.GetTlsBootstrappingToken() != ""
}

func getEnableSecureTLSBootstrap(bootstrapConfig *aksnodeconfigv1.BootstrappingConfig) bool {
// TODO: Change logic to default to false once Secure TLS Bootstrapping is complete
return bootstrapConfig.GetBootstrappingAuthMethod() == aksnodeconfigv1.BootstrappingAuthMethod_BOOTSTRAPPING_AUTH_METHOD_SECURE_TLS_BOOTSTRAPPING
Expand Down
1 change: 0 additions & 1 deletion aks-node-controller/parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ func getCSEEnv(config *aksnodeconfigv1.Configuration) map[string]string {
"HTTPS_PROXY_URLS": config.GetHttpProxyConfig().GetHttpsProxy(),
"NO_PROXY_URLS": getStringifiedStringArray(config.GetHttpProxyConfig().GetNoProxyEntries(), ","),
"PROXY_VARS": getProxyVariables(config.GetHttpProxyConfig()),
"ENABLE_TLS_BOOTSTRAPPING": fmt.Sprintf("%v", getEnableTLSBootstrap(config.GetBootstrappingConfig())),
"ENABLE_SECURE_TLS_BOOTSTRAPPING": fmt.Sprintf("%v", getEnableSecureTLSBootstrap(config.GetBootstrappingConfig())),
"CUSTOM_SECURE_TLS_BOOTSTRAP_AAD_SERVER_APP_ID": getCustomSecureTLSBootstrapAADServerAppID(config.GetBootstrappingConfig()),
"DHCPV6_SERVICE_FILEPATH": getDHCPV6ServiceFilepath(),
Expand Down
2 changes: 1 addition & 1 deletion aks-node-controller/proto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This table is describing the all the AKSNodeConfig Fields converted to .go files
| `ClusterConfig` | `ClusterConfig` | Various Kubernetes cluster level configuration | `RESOURCE_GROUP`, `LOCATION`, `VM_TYPE`, `PRIMARY_AVAILABILITY_SET`, `PRIMARY_SCALE_SET`, `USE_INSTANCE_METADATA` |
| -`ClusterNetworkConfig` | `ClusterNetworkConfig` | Cluster network config. We assumed network mode is always "transparent" now so it's removed from the contract. | `VIRTUAL_NETWORK`, `VIRTUAL_NETWORK_RESOURCE_GROUP`, `SUBNET`, `NETWORK_SECURITY_GROUP`, `ROUTE_TABLE` |
| -`LoadBalancerConfig` | `LoadBalancerConfig` | Load balancer config | `LOAD_BALANCER_SKU`, `EXCLUDE_MASTER_FROM_STANDARD_LB`, `MAXIMUM_LOADBALANCER_RULE_COUNT`, `LOAD_BALANCER_DISABLE_OUTBOUND_SNAT` |
| `BootstrappingConfig` | `BootstrappingConfig` | Bootstrap configuration | `ENABLE_TLS_BOOTSTRAPPING`, `ENABLE_SECURE_TLS_BOOTSTRAPPING`, `CUSTOM_SECURE_TLS_BOOTSTRAP_AAD_SERVER_APP_ID` |
| `BootstrappingConfig` | `BootstrappingConfig` | Bootstrap configuration | `ENABLE_SECURE_TLS_BOOTSTRAPPING`, `CUSTOM_SECURE_TLS_BOOTSTRAP_AAD_SERVER_APP_ID` |
| `AuthConfig` | `AuthConfig` | Authentication configuration | `TENANT_ID`, `SUBSCRIPTION_ID`, `SERVICE_PRINCIPAL_CLIENT_ID`, `SERVICE_PRINCIPAL_FILE_CONTENT`, `USER_ASSIGNED_IDENTITY_ID`, `USE_MANAGED_IDENTITY_EXTENSION` |
| `RuncConfig` | `RuncConfig` | The CLI tool runc configuration | `RUNC_VERSION`, `RUNC_PACKAGE_URL` |
| `ContainerdConfig` | `ContainerdConfig` | Containerd configuration | `CONTAINERD_DOWNLOAD_URL_BASE`, `CONTAINERD_VERSION`, `CONTAINERD_PACKAGE_URL`, `CONTAINERD_CONFIG_CONTENT`, `CONTAINERD_CONFIG_NO_GPU_CONTENT` |
Expand Down
1 change: 0 additions & 1 deletion parts/linux/cloud-init/artifacts/cse_cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ HTTP_PROXY_URLS="{{GetHTTPProxy}}"
HTTPS_PROXY_URLS="{{GetHTTPSProxy}}"
NO_PROXY_URLS="{{GetNoProxy}}"
PROXY_VARS="{{GetProxyVariables}}"
ENABLE_TLS_BOOTSTRAPPING="{{EnableTLSBootstrapping}}"
ENABLE_SECURE_TLS_BOOTSTRAPPING="{{EnableSecureTLSBootstrapping}}"
CUSTOM_SECURE_TLS_BOOTSTRAP_AAD_SERVER_APP_ID="{{GetCustomSecureTLSBootstrapAADServerAppID}}"
ENABLE_KUBELET_SERVING_CERTIFICATE_ROTATION="{{EnableKubeletServingCertificateRotation}}"
Expand Down
4 changes: 2 additions & 2 deletions parts/linux/cloud-init/artifacts/cse_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ ensureKubelet() {
echo "${KUBE_CA_CRT}" | base64 -d > "${KUBE_CA_FILE}"
chmod 0600 "${KUBE_CA_FILE}"

if [ "${ENABLE_SECURE_TLS_BOOTSTRAPPING}" == "true" ] || [ "${ENABLE_TLS_BOOTSTRAPPING}" == "true" ]; then
if [ "${ENABLE_SECURE_TLS_BOOTSTRAPPING}" == "true" ] || [ -n "${TLS_BOOTSTRAP_TOKEN}" ]; then
KUBELET_TLS_DROP_IN="/etc/systemd/system/kubelet.service.d/10-tlsbootstrap.conf"
mkdir -p "$(dirname "${KUBELET_TLS_DROP_IN}")"
touch "${KUBELET_TLS_DROP_IN}"
Expand Down Expand Up @@ -566,7 +566,7 @@ contexts:
name: bootstrap-context
current-context: bootstrap-context
EOF
elif [ "${ENABLE_TLS_BOOTSTRAPPING}" == "true" ]; then
elif [ -n "${TLS_BOOTSTRAP_TOKEN}" ]; then
BOOTSTRAP_KUBECONFIG_FILE=/var/lib/kubelet/bootstrap-kubeconfig
mkdir -p "$(dirname "${BOOTSTRAP_KUBECONFIG_FILE}")"
touch "${BOOTSTRAP_KUBECONFIG_FILE}"
Expand Down
2 changes: 1 addition & 1 deletion parts/linux/cloud-init/nodecustomdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ write_files:
AZURE_ENVIRONMENT_FILEPATH=/etc/kubernetes/{{GetTargetEnvironment}}.json
{{- end}}

{{ if (or EnableSecureTLSBootstrapping EnableTLSBootstrapping) -}}
{{ if (or EnableSecureTLSBootstrapping GetTLSBootstrapTokenForKubeConfig) -}}
- path: /var/lib/kubelet/bootstrap-kubeconfig
permissions: "0644"
owner: root
Expand Down
4 changes: 0 additions & 4 deletions pkg/agent/baker.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,6 @@ func getContainerServiceFuncMap(config *datamodel.NodeBootstrappingConfiguration
"IsKubeletConfigFileEnabled": func() bool {
return IsKubeletConfigFileEnabled(cs, profile, config.EnableKubeletConfigFile)
},
"EnableTLSBootstrapping": func() bool {
// this will be true when we get a hard-coded TLS bootstrap token in the NodeBootstrappingConfiguration to use for performing TLS bootstrapping.
return IsTLSBootstrappingEnabledWithHardCodedToken(config.KubeletClientTLSBootstrapToken)
},
"EnableSecureTLSBootstrapping": func() bool {
// this will be true when we can perform TLS bootstrapping without the use of a hard-coded bootstrap token.
return config.EnableSecureTLSBootstrapping
Expand Down
2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSUbuntu1604+Containerd/CSECommand

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/agent/testdata/AKSUbuntu1604+Containerd/CustomData

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pkg/agent/testdata/AKSUbuntu1604+Containerd/line70.sh
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ ensureKubelet() {
echo "${KUBE_CA_CRT}" | base64 -d > "${KUBE_CA_FILE}"
chmod 0600 "${KUBE_CA_FILE}"

if [ "${ENABLE_SECURE_TLS_BOOTSTRAPPING}" == "true" ] || [ "${ENABLE_TLS_BOOTSTRAPPING}" == "true" ]; then
if [ "${ENABLE_SECURE_TLS_BOOTSTRAPPING}" == "true" ] || [ -n "${TLS_BOOTSTRAP_TOKEN}" ]; then
KUBELET_TLS_DROP_IN="/etc/systemd/system/kubelet.service.d/10-tlsbootstrap.conf"
mkdir -p "$(dirname "${KUBELET_TLS_DROP_IN}")"
touch "${KUBELET_TLS_DROP_IN}"
Expand Down Expand Up @@ -542,7 +542,7 @@ contexts:
name: bootstrap-context
current-context: bootstrap-context
EOF
elif [ "${ENABLE_TLS_BOOTSTRAPPING}" == "true" ]; then
elif [ -n "${TLS_BOOTSTRAP_TOKEN}" ]; then
BOOTSTRAP_KUBECONFIG_FILE=/var/lib/kubelet/bootstrap-kubeconfig
mkdir -p "$(dirname "${BOOTSTRAP_KUBECONFIG_FILE}")"
touch "${BOOTSTRAP_KUBECONFIG_FILE}"
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ ensureKubelet() {
echo "${KUBE_CA_CRT}" | base64 -d > "${KUBE_CA_FILE}"
chmod 0600 "${KUBE_CA_FILE}"

if [ "${ENABLE_SECURE_TLS_BOOTSTRAPPING}" == "true" ] || [ "${ENABLE_TLS_BOOTSTRAPPING}" == "true" ]; then
if [ "${ENABLE_SECURE_TLS_BOOTSTRAPPING}" == "true" ] || [ -n "${TLS_BOOTSTRAP_TOKEN}" ]; then
KUBELET_TLS_DROP_IN="/etc/systemd/system/kubelet.service.d/10-tlsbootstrap.conf"
mkdir -p "$(dirname "${KUBELET_TLS_DROP_IN}")"
touch "${KUBELET_TLS_DROP_IN}"
Expand Down Expand Up @@ -542,7 +542,7 @@ contexts:
name: bootstrap-context
current-context: bootstrap-context
EOF
elif [ "${ENABLE_TLS_BOOTSTRAPPING}" == "true" ]; then
elif [ -n "${TLS_BOOTSTRAP_TOKEN}" ]; then
BOOTSTRAP_KUBECONFIG_FILE=/var/lib/kubelet/bootstrap-kubeconfig
mkdir -p "$(dirname "${BOOTSTRAP_KUBECONFIG_FILE}")"
touch "${BOOTSTRAP_KUBECONFIG_FILE}"
Expand Down
Loading

0 comments on commit 73ed418

Please sign in to comment.