Skip to content

Commit

Permalink
F #-: Update OneKE 1.27 and add OneKE 1.27a (airgapped)
Browse files Browse the repository at this point in the history
  • Loading branch information
sk4zuzu committed Dec 11, 2023
1 parent 4f897bc commit cbcf2df
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 18 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ packer-service_wordpress: packer-alma8 ${DIR_EXPORT}/service_wordpress.qcow2
packer-service_OneKE: packer-ubuntu2204 ${DIR_EXPORT}/service_OneKE.qcow2
@${INFO} "Packer service_OneKE done"

# airgapped version
packer-service_OneKEa: PKR_VAR_airgapped := YES
packer-service_OneKEa: packer-ubuntu2204 ${DIR_EXPORT}/service_OneKEa.qcow2
@${INFO} "Packer service_OneKEa done"

# run packer build for given distro or service
${DIR_EXPORT}/%.qcow2:
$(eval DISTRO_NAME := $(shell echo ${*} | sed 's/[0-9].*//'))
Expand Down
2 changes: 1 addition & 1 deletion Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ DISTROS := alma8 alma9 \
rocky8 rocky9 \
ubuntu2004 ubuntu2004min ubuntu2204 ubuntu2204min

SERVICES := service_vnf service_wordpress service_OneKE
SERVICES := service_vnf service_wordpress service_OneKE service_OneKEa

.DEFAULT_GOAL := help

Expand Down
6 changes: 6 additions & 0 deletions appliances/OneKE/appliance/appliance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
if caller.empty?
case ARGV[0].to_sym
when :install
msg :debug, "ONE_SERVICE_AIRGAPPED=#{ONE_SERVICE_AIRGAPPED}"

install_packages PACKAGES

with_policy_rc_d_disabled do
Expand All @@ -36,13 +38,17 @@
msg :info, 'Installation completed successfully'

when :configure
msg :debug, "ONE_SERVICE_AIRGAPPED=#{ONE_SERVICE_AIRGAPPED}"

prepare_dedicated_storage unless ONEAPP_STORAGE_DEVICE.nil?

configure_vnf

if ONE_SERVICE_AIRGAPPED
include_images 'rke2-images-core'
include_images 'rke2-images-multus' if ONEAPP_K8S_MULTUS_ENABLED
include_images 'rke2-images-calico' if ONEAPP_K8S_CNI_PLUGIN == 'calico'
include_images 'rke2-images-canal' if ONEAPP_K8S_CNI_PLUGIN == 'canal'
include_images 'rke2-images-cilium' if ONEAPP_K8S_CNI_PLUGIN == 'cilium'

include_images 'one-longhorn' if ONEAPP_K8S_LONGHORN_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion appliances/OneKE/appliance/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def env(name, default)
end

ONE_SERVICE_VERSION = env :ONE_SERVICE_VERSION, '1.27'
ONE_SERVICE_AIRGAPPED = env :ONE_SERVICE_AIRGAPPED, 'YES'
ONE_SERVICE_AIRGAPPED = env :ONE_SERVICE_AIRGAPPED, 'NO'
ONE_SERVICE_SETUP_DIR = env :ONE_SERVICE_SETUP_DIR, '/opt/one-appliance'

ONE_SERVICE_RKE2_RELEASE = env :ONE_SERVICE_RKE2_RELEASE, "#{ONE_SERVICE_VERSION}.2"
Expand Down
36 changes: 23 additions & 13 deletions appliances/OneKE/appliance/kubernetes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,29 @@ def install_kubernetes(airgap_dir = ONE_AIRGAP_DIR)
curl -fsSL '#{rke2_release_url}/rke2.linux-amd64.tar.gz' | tar -xz -f- -C /usr/local/
SCRIPT

msg :info, "Download RKE2 airgapped image archives: #{ONE_SERVICE_RKE2_VERSION}"
bash <<~SCRIPT
curl -fsSL '#{rke2_release_url}/rke2-images-core.linux-amd64.tar.zst' \
| install -o 0 -g 0 -m u=rw,go=r -D /dev/fd/0 '#{airgap_dir}/rke2-images-core/rke2-images-core.linux-amd64.tar.zst'
SCRIPT
bash <<~SCRIPT
curl -fsSL '#{rke2_release_url}/rke2-images-multus.linux-amd64.tar.zst' \
| install -o 0 -g 0 -m u=rw,go=r -D /dev/fd/0 '#{airgap_dir}/rke2-images-multus/rke2-images-multus.linux-amd64.tar.zst'
SCRIPT
bash <<~SCRIPT
curl -fsSL '#{rke2_release_url}/rke2-images-cilium.linux-amd64.tar.zst' \
| install -o 0 -g 0 -m u=rw,go=r -D /dev/fd/0 '#{airgap_dir}/rke2-images-cilium/rke2-images-cilium.linux-amd64.tar.zst'
SCRIPT
if ONE_SERVICE_AIRGAPPED
msg :info, "Download RKE2 airgapped image archives: #{ONE_SERVICE_RKE2_VERSION}"
bash <<~SCRIPT
curl -fsSL '#{rke2_release_url}/rke2-images-core.linux-amd64.tar.zst' \
| install -o 0 -g 0 -m u=rw,go=r -D /dev/fd/0 '#{airgap_dir}/rke2-images-core/rke2-images-core.linux-amd64.tar.zst'
SCRIPT
bash <<~SCRIPT
curl -fsSL '#{rke2_release_url}/rke2-images-multus.linux-amd64.tar.zst' \
| install -o 0 -g 0 -m u=rw,go=r -D /dev/fd/0 '#{airgap_dir}/rke2-images-multus/rke2-images-multus.linux-amd64.tar.zst'
SCRIPT
bash <<~SCRIPT
curl -fsSL '#{rke2_release_url}/rke2-images-calico.linux-amd64.tar.zst' \
| install -o 0 -g 0 -m u=rw,go=r -D /dev/fd/0 '#{airgap_dir}/rke2-images-calico/rke2-images-calico.linux-amd64.tar.zst'
SCRIPT
bash <<~SCRIPT
curl -fsSL '#{rke2_release_url}/rke2-images-canal.linux-amd64.tar.zst' \
| install -o 0 -g 0 -m u=rw,go=r -D /dev/fd/0 '#{airgap_dir}/rke2-images-canal/rke2-images-canal.linux-amd64.tar.zst'
SCRIPT
bash <<~SCRIPT
curl -fsSL '#{rke2_release_url}/rke2-images-cilium.linux-amd64.tar.zst' \
| install -o 0 -g 0 -m u=rw,go=r -D /dev/fd/0 '#{airgap_dir}/rke2-images-cilium/rke2-images-cilium.linux-amd64.tar.zst'
SCRIPT
end

msg :info, "Install Helm binary: #{ONE_SERVICE_HELM_VERSION}"
bash <<~SCRIPT
Expand Down
7 changes: 4 additions & 3 deletions packer/service_OneKE/OneKE.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,14 @@ build {
"chmod 0640 /etc/one-appliance/service.d/*",
"/etc/one-appliance/service install",
]
environment_vars = [ "ONE_SERVICE_AIRGAPPED=${var.airgapped}" ]
}

provisioner "shell" {
scripts = [
"${var.input_dir}/82-configure-context.sh",
"83-disable-docs.sh"
]
"${var.input_dir}/82-configure-context.sh",
"${var.input_dir}/83-disable-docs.sh",
]
}

post-processor "shell-local" {
Expand Down
5 changes: 5 additions & 0 deletions packer/service_OneKE/variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ variable "output_dir" {
type = string
}

variable "airgapped" {
type = string
default = "NO"
}

variable "headless" {
type = bool
default = false
Expand Down
1 change: 1 addition & 0 deletions packer/service_OneKEa

0 comments on commit cbcf2df

Please sign in to comment.