Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,27 @@ export AWS_SHARED_CREDENTIALS_FILE="${CLUSTER_PROFILE_DIR}/.awscred"
CONFIG="${SHARED_DIR}/install-config.yaml"


if [[ "${AWS_KMS_KEY_ENABLE_DEFAULT_MACHINE}" == "yes" ]]; then
key_arn_default_machine=${AWS_KMS_KEY_ARN_DEFAULT_MACHINE}
if [[ "${key_arn_default_machine}" == "" ]]; then
# pre-creaetd
key_arn_default_machine=$(head -n 1 ${SHARED_DIR}/aws_kms_key_arn)
fi

KMS_PATCH_DEFAULT_MACHINE="${ARTIFACT_DIR}/install-config-kms-default-machine.yaml.patch"
cat > "${KMS_PATCH_DEFAULT_MACHINE}" << EOF
platform:
aws:
defaultMachinePlatform:
rootVolume:
kmsKeyARN: ${key_arn_default_machine}
EOF
echo "KMS_PATCH_DEFAULT_MACHINE: ${KMS_PATCH_DEFAULT_MACHINE}"
cat $KMS_PATCH_DEFAULT_MACHINE
yq-go m -x -i "${CONFIG}" "${KMS_PATCH_DEFAULT_MACHINE}"
fi


if [[ "${AWS_KMS_KEY_ENABLE_CONTROL_PLANE}" == "yes" ]]; then
key_arn_control_plane=${AWS_KMS_KEY_ARN_CONTROL_PLANE}
if [[ "${key_arn_control_plane}" == "" ]]; then
Expand Down Expand Up @@ -49,6 +70,8 @@ EOF
yq-go m -x -i "${CONFIG}" "${KMS_PATCH_COMPUTE}"
fi

echo "defaultMachinePlatform key:"
yq-go r $CONFIG 'platform.aws.defaultMachinePlatform.rootVolume.kmsKeyARN'
echo "controlPlane key:"
yq-go r $CONFIG 'controlPlane.platform.aws.rootVolume.kmsKeyARN'
echo "compute key:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ ref:
cpu: 10m
memory: 100Mi
env:
- name: AWS_KMS_KEY_ARN_DEFAULT_MACHINE
default: ""
documentation: |-
KMS Key for defaultMachine, if empty (""), read key id from "${SHARED_DIR}/aws_kms_key_arn" created by step aws-provision-kms-key
- name: AWS_KMS_KEY_ARN_CONTROL_PLANE
default: ""
documentation: |-
Expand All @@ -18,12 +22,16 @@ ref:
default: ""
documentation: |-
KMS Key for control plane nodes, if empty (""), read key id from "${SHARED_DIR}/aws_kms_key_arn" created by step aws-provision-kms-key
- name: AWS_KMS_KEY_ENABLE_COMPUTE
- name: AWS_KMS_KEY_ENABLE_DEFAULT_MACHINE
default: "yes"
documentation: |-
Flag that indicate if provide KMS key in install-config.yaml for default machine nodes (platform.aws.defaultMachinePlatform.rootVolume.kmsKeyARN)
- name: AWS_KMS_KEY_ENABLE_COMPUTE
default: "no"
documentation: |-
Flag that indicate if provide KMS key in install-config.yaml for control plane nodes (controlPlane.platform.aws.rootVolume.kmsKeyARN)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems the documentation of this var and the next var mixed up, AWS_KMS_KEY_ENABLE_COMPUTE -> for control plane nodes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fix by #37019

- name: AWS_KMS_KEY_ENABLE_CONTROL_PLANE
default: "yes"
default: "no"
documentation: |-
Flag that indicate if provide KMS key in install-config.yaml for compute nodes (compute.platform.aws.rootVolume.kmsKeyARN)
documentation: |-
Expand Down