Skip to content

Commit 062ca7e

Browse files
committed
Add MPC macos configuration to stone-stage-p01
Add support for macos in helm template and add first configuration of macos in stone-stage-p01. Signed-off-by: Hugo Ares <[email protected]>
1 parent 4fa14a1 commit 062ca7e

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed

components/multi-platform-controller/base/host-config-chart/templates/host-config.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,40 @@ data:
10831083
{{- end }}
10841084
{{ end }}
10851085

1086+
{{- if hasKey .Values.dynamicConfigs "macos-arm64" }}
1087+
{{- $config := index .Values.dynamicConfigs "macos-arm64" | default (dict) }}
1088+
dynamic.macos-arm64.type: {{ index $config "type" | default "aws" | quote }}
1089+
dynamic.macos-arm64.region: {{ index $config "region" | default "us-east-1" | quote }}
1090+
dynamic.macos-arm64.ami: {{ default (index $amd "ami") $config.ami | quote }}
1091+
dynamic.macos-arm64.instance-type: {{ (index $config "instance-type") | default "mac2.metal" | quote }}
1092+
dynamic.macos-arm64.instance-tag: {{ (index $config "instance-tag") | default (printf "%s-arm64-macos" $environment) | quote }}
1093+
dynamic.macos-arm64.key-name: {{ default (index $amd "key-name") ((index $config "key-name")) | quote }}
1094+
dynamic.macos-arm64.aws-secret: {{ (index $config "aws-secret") | default "aws-account" | quote }}
1095+
dynamic.macos-arm64.ssh-secret: {{ (index $config "ssh-secret") | default "aws-ssh-key" | quote }}
1096+
dynamic.macos-arm64.security-group-id: {{ default (index $amd "security-group-id") ((index $config "security-group-id")) | quote }}
1097+
dynamic.macos-arm64.max-instances: {{ (index $config "max-instances") | default "1" | quote }}
1098+
dynamic.macos-arm64.subnet-id: {{ default (index $amd "subnet-id") ((index $config "subnet-id")) | quote }}
1099+
dynamic.macos-arm64.disk: {{ index $config "disk" | default "100" | quote }}
1100+
dynamic.macos-arm64.check-interval: {{ (index $config "check-interval") | default "60" | quote }}
1101+
dynamic.macos-arm64.allocation-timeout: "1200"
1102+
dynamic.macos-arm64.tenancy: "host"
1103+
dynamic.macos-arm64.host-resource-group-arn: {{ index $config "host-resource-group-arn" | quote }}
1104+
dynamic.macos-arm64.license-configuration-arn: {{ index $config "license-configuration-arn" | quote }}
1105+
{{- if (index $config "iops") }}
1106+
dynamic.macos-arm64.iops: {{ index $config "iops" | quote }}
1107+
{{ end }}
1108+
{{- if (index $config "throughput") }}
1109+
dynamic.macos-arm64.throughput: {{ index $config "throughput" | quote }}
1110+
{{ end }}
1111+
{{- if (index $config "user-data") }}
1112+
dynamic.macos-arm64.user-data: |
1113+
{{- $lines := splitList "\n" (index $config "user-data") }}
1114+
{{- range $line := $lines }}
1115+
{{ $line }}
1116+
{{- end }}
1117+
{{- end }}
1118+
{{ end }}
1119+
10861120
# Static hosts configuration
10871121
{{- range $host, $config := .Values.staticHosts }}
10881122
{{- range $key, $value := $config }}

components/multi-platform-controller/staging-downstream/host-values.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,63 @@ dynamicConfigs:
176176
sudo-commands: "/usr/bin/podman"
177177
disk: "200"
178178

179+
macos-arm64:
180+
ami: "ami-000ce2c23b96216d3"
181+
key-name: "packer-key"
182+
host-resource-group-arn: "arn:aws:resource-groups:us-east-1:654654171619:group/MacOS-Servers"
183+
license-configuration-arn: "arn:aws:license-manager:us-east-1:654654171619:license-configuration:lic-fecd71a2010a12080e452eb28065f489"
184+
user-data: |
185+
#!/bin/bash
186+
set -eu
187+
set -x
188+
189+
user="konflux-builder"
190+
191+
# Check if user already exists
192+
if ! id "$user" &>/dev/null; then
193+
# Generate random password
194+
random_password=$(openssl rand -base64 32)
195+
196+
# Create user
197+
sudo sysadminctl -addUser "$user" -fullName "Konflux Builder" -password "$random_password" -home /Users/$user
198+
199+
# Clear password from variable
200+
unset random_password
201+
else
202+
echo "User $user already exists, skipping user creation"
203+
fi
204+
205+
# Create home directory if it doesn't exist
206+
sudo mkdir -p /Users/$user
207+
208+
# Create SSH directory
209+
sudo mkdir -p /Users/$user/.ssh
210+
211+
# Remove existing SSH keys if they exist
212+
sudo rm -f /Users/$user/.ssh/id_rsa /Users/$user/.ssh/id_rsa.pub
213+
214+
# Generate new SSH keys
215+
sudo ssh-keygen -t rsa -b 4096 -f /Users/$user/.ssh/id_rsa -N "" -C ""
216+
217+
# Set proper permissions on .ssh directory
218+
sudo chmod 700 /Users/$user/.ssh
219+
220+
# Create/overwrite authorized_keys
221+
sudo chmod 600 /Users/$user/.ssh/authorized_keys 2>/dev/null || true
222+
sudo cat /Users/$user/.ssh/id_rsa.pub | sudo tee /Users/$user/.ssh/authorized_keys > /dev/null
223+
224+
# Set ownership of entire home directory to ensure user has full control
225+
sudo chown -R $user:staff /Users/$user
226+
227+
# Copy private key to ec2-user's directory
228+
sudo cp /Users/$user/.ssh/id_rsa /Users/ec2-user/$user
229+
230+
# Set ownership of the copied private key to ec2-user
231+
sudo chown ec2-user:staff /Users/ec2-user/$user
232+
sudo chmod 600 /Users/ec2-user/$user
233+
234+
--//--
235+
179236
# Static hosts configuration
180237
staticHosts:
181238
ppc64le-static-1:

0 commit comments

Comments
 (0)