Skip to content

Commit

Permalink
[ci skip] 2024.11.27-32732
Browse files Browse the repository at this point in the history
  • Loading branch information
cybozu-neco committed Nov 27, 2024
2 parents 4a6a84b + 51720d0 commit b803f93
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 16 deletions.
2 changes: 1 addition & 1 deletion artifacts.go

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

3 changes: 3 additions & 0 deletions artifacts_ignore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ images:
versions: ["6.12.0.1"]
- repository: ghcr.io/cybozu/squid-exporter
versions: ["1.0.7"]
osImage:
- channel: stable
versions: ["4081.2.0"]
9 changes: 9 additions & 0 deletions etc/cke-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ nodes:
- key: cke.cybozu.com/role
value: storage
effect: NoSchedule
- user: cybozu
control_plane: false
labels:
cke.cybozu.com/role: "ss2"
cke.cybozu.com/weight: "1"
taints:
- key: cke.cybozu.com/role
value: storage
effect: NoSchedule
service_subnet: 10.68.0.0/16
dns_service: internet-egress/unbound
control_plane_tolerations: ["node.cilium.io/agent-not-ready"]
Expand Down
7 changes: 7 additions & 0 deletions etc/neco-rebooter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,12 @@ rebootTimes:
times:
allow:
- "* 0-23 * * 1-5"
- name: ss2
labelSelector:
matchLabels:
cke.cybozu.com/role: ss2
times:
allow:
- "* 0-23 * * 1-5"
timeZone: Asia/Tokyo
groupLabelKey: topology.kubernetes.io/zone
30 changes: 30 additions & 0 deletions ignition-template/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,36 @@
]
}
},
"ss2": {
"base": {
"include": "../../common/common.yml",
"files": [
"/etc/udev/crypt-base-path",
"/etc/udev/rules.d/99-neco.rules"
]
},
"gcp0": {
"include": "../../common/common-gcp0.yml",
"files": [
"/etc/udev/crypt-base-path",
"/etc/udev/rules.d/99-neco.rules"
]
},
"stage0": {
"include": "../../common/common-stage0.yml",
"files": [
"/etc/udev/crypt-base-path",
"/etc/udev/rules.d/99-neco.rules"
]
},
"stage1": {
"include": "../../common/common-stage1.yml",
"files": [
"/etc/udev/crypt-base-path",
"/etc/udev/rules.d/99-neco.rules"
]
}
},
"common": {
"common": {
"passwd": "passwd.yml",
Expand Down
4 changes: 3 additions & 1 deletion ignition-template/site-env/main.libsonnet
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
local boot_template = import 'boot/main.libsonnet';
local cs_template = import 'cs/main.libsonnet';
local ss_template = import 'ss/main.libsonnet';
local ss2_template = import 'ss2/main.libsonnet';
local utility = import '../utility.libsonnet';
function(settings)
utility.prefix_file_names('boot', boot_template(settings)) +
utility.prefix_file_names('cs', cs_template(settings)) +
utility.prefix_file_names('ss', ss_template(settings))
utility.prefix_file_names('ss', ss_template(settings)) +
utility.prefix_file_names('ss2', ss2_template(settings))
5 changes: 5 additions & 0 deletions ignition-template/site-env/ss2/main.libsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
local config_template = import '../../config.libsonnet';
local utility = import '../../utility.libsonnet';

function(settings)
utility.union_map(std.map(function(x) { [if x=="base" then 'site.yml' else 'site-'+x +'.yml']: config_template(settings.ss2[x]) }, utility.get_ss2(settings)))
4 changes: 4 additions & 0 deletions ignition-template/utility.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
// get_ss retrives the array of ss from settings.
get_ss(settings)::
std.objectFields(settings.ss),

// get_ss2 retrives the array of ss2 from settings.
get_ss2(settings)::
std.objectFields(settings.ss2),

// get_common retrives the array of common from settings.
get_common(settings)::
Expand Down
20 changes: 10 additions & 10 deletions ignitions/common/files/opt/sbin/setup-var
Original file line number Diff line number Diff line change
Expand Up @@ -83,22 +83,22 @@ if ls /dev/mapper/crypt-vd* >/dev/null 2>&1; then
# See https://github.com/cybozu-go/neco/blob/cf1fbc99aeb62d37e37c5c2c69f12e319622b6cd/ignitions/roles/ss/files/etc/udev/rules.d/99-neco.rules#L4
PVS=$(ls /dev/mapper/crypt-vd[abc])
prepare_lv
elif ls /dev/mapper/crypt-nvme* >/dev/null 2>&1; then
# for compute node
PVS=$(ls /dev/mapper/crypt-nvme*)
CONTAINERD_SIZE=1t
DOCKER_SIZE=50g
KUBELET_SIZE=100g
COREDUMP_SIZE=50g
prepare_lv
else
# for storage node
elif [ -n "$(find_boss)" ]; then
# for ss, ss2 node
PVS=$(find_boss)
CONTAINERD_SIZE=50g
DOCKER_SIZE=50g
KUBELET_SIZE=10g
COREDUMP_SIZE=20g
prepare_lv
else
# for cs node
PVS=$(ls /dev/mapper/crypt-nvme*)
CONTAINERD_SIZE=1t
DOCKER_SIZE=50g
KUBELET_SIZE=100g
COREDUMP_SIZE=50g
prepare_lv
fi

for label in $LVLIST; do
Expand Down
37 changes: 37 additions & 0 deletions ignitions/roles/ss2/files/etc/udev/crypt-base-path
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh

SCRIPT_NAME=$(basename $0)
NAME=$1
UUID=$2

output_log() {
logger "$SCRIPT_NAME $NAME $1"
}

CRYPT_DEV=$(dmsetup deps -u $UUID -o devname | sed -e 's/.*(\(.*\))/\1/')
UDEV_LINKS=$(udevadm info -q symlink -n /dev/$CRYPT_DEV)

output_log "CRYPT_DEV: $CRYPT_DEV DISK_DEV:$DISK_DEV"
output_log "UDEV_LINKS:$UDEV_LINKS"

for symlink in $UDEV_LINKS; do
case ${symlink} in
disk/by-path/virtio-*)
;;
disk/by-path/*-ata-*)
;;
disk/by-path/*)
output_log "find a symlink:$symlink"
CRYPT_BASE_PATH=${symlink#disk/by-path/}
;;
esac
done

if [ -z "$CRYPT_BASE_PATH" ]; then
output_log "could not find symlinks"
exit 1
fi

mkdir -p /dev/crypt-disk/by-path/
echo "CRYPT_BASE_PATH=$CRYPT_BASE_PATH"
exit 0
8 changes: 8 additions & 0 deletions ignitions/roles/ss2/files/etc/udev/rules.d/99-neco.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
KERNEL!="dm-*", GOTO="neco_end"
ENV{DM_NAME}!="crypt-*", GOTO="neco_end"
# Skip the qemu's system disks
ENV{DM_NAME}=="crypt-vda|crypt-vdb|crypt-vdc", GOTO="neco_end"

IMPORT{program}="/etc/udev/crypt-base-path $name $env{DM_UUID}", SYMLINK+="crypt-disk/by-path/$env{CRYPT_BASE_PATH}"

LABEL="neco_end"
5 changes: 5 additions & 0 deletions ignitions/roles/ss2/site-gcp0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is automatically generated from a template. Please do not edit.
include: ../../common/common-gcp0.yml
files:
- /etc/udev/crypt-base-path
- /etc/udev/rules.d/99-neco.rules
5 changes: 5 additions & 0 deletions ignitions/roles/ss2/site-stage0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is automatically generated from a template. Please do not edit.
include: ../../common/common-stage0.yml
files:
- /etc/udev/crypt-base-path
- /etc/udev/rules.d/99-neco.rules
5 changes: 5 additions & 0 deletions ignitions/roles/ss2/site-stage1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is automatically generated from a template. Please do not edit.
include: ../../common/common-stage1.yml
files:
- /etc/udev/crypt-base-path
- /etc/udev/rules.d/99-neco.rules
5 changes: 5 additions & 0 deletions ignitions/roles/ss2/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is automatically generated from a template. Please do not edit.
include: ../../common/common.yml
files:
- /etc/udev/crypt-base-path
- /etc/udev/rules.d/99-neco.rules
13 changes: 9 additions & 4 deletions pkg/generate-sabakan-machines/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var rootCmd = &cobra.Command{
Short: "generate machines.json",
Long: `Generate machines.json from the CSV file for use with the 'sabactl create' command.
Example:
generate-sabakan-machines input.csv --machine-type-boot=r6525-boot-1 --machine-type-cs=r6525-cs-1 --machine-type-ss=r7525-ss-1
generate-sabakan-machines input.csv --machine-type-boot=r6525-boot-1 --machine-type-cs=r6525-cs-1 --machine-type-ss=r7525-ss-1 --machine-type-ss2=r7525-ss-2
`,
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -66,6 +66,8 @@ Example:
machineType = *machineTypeCS
case "ss":
machineType = *machineTypeSS
case "ss2":
machineType = *machineTypeSS2
default:
return errors.New("unknown role " + role)
}
Expand Down Expand Up @@ -124,16 +126,19 @@ var (
machineTypeBoot *string
machineTypeCS *string
machineTypeSS *string
machineTypeSS2 *string
bmcType *string
)

func init() {
machineTypeBoot = rootCmd.Flags().StringP("machine-type-boot", "b", "", "The machine-type name of Boot")
machineTypeCS = rootCmd.Flags().StringP("machine-type-cs", "c", "", "The machine-type name of CS")
machineTypeSS = rootCmd.Flags().StringP("machine-type-ss", "s", "", "The machine-type name of SS")
machineTypeBoot = rootCmd.Flags().String("machine-type-boot", "", "The machine-type name of Boot")
machineTypeCS = rootCmd.Flags().String("machine-type-cs", "", "The machine-type name of CS")
machineTypeSS = rootCmd.Flags().String("machine-type-ss", "", "The machine-type name of SS")
machineTypeSS2 = rootCmd.Flags().String("machine-type-ss2", "", "The machine-type name of SS2")
bmcType = rootCmd.Flags().String("bmc-type", "iDRAC", "The name of BMC")

rootCmd.MarkFlagRequired("machine-type-boot")
rootCmd.MarkFlagRequired("machine-type-cs")
rootCmd.MarkFlagRequired("machine-type-ss")
rootCmd.MarkFlagRequired("machine-type-ss2")
}

0 comments on commit b803f93

Please sign in to comment.