-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
141 changed files
with
9,304 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
build/ | ||
export/ | ||
Makefile.local | ||
context-windows/out/ | ||
context-windows/*.msi | ||
context-windows/rhsrvany.exe | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# load variables and makefile config | ||
include Makefile.config | ||
|
||
# load possible overrides or non-free definitions | ||
-include Makefile.local | ||
|
||
#------------------------------------------------------------------------------ | ||
# All, alliases | ||
#------------------------------------------------------------------------------ | ||
all: $(patsubst %, packer-%, $(DISTROS)) $(patsubst %, services-%, $(SERVICES)) | ||
@: | ||
|
||
# allow individual distribution targets (e.g., "make debian11") | ||
$(DISTROS): %: packer-% ; | ||
$(SERVICES): %: services-% ; | ||
|
||
#------------------------------------------------------------------------------ | ||
# Packer stage | ||
# - run packer build for given distro | ||
#------------------------------------------------------------------------------ | ||
packer: $(patsubst %, packer-%, $(DISTROS)) | ||
|
||
packer-%: context-linux ${DIR_EXPORT}/%-${VERSION}-${RELEASE}.qcow2 | ||
@${INFO} "Packer ${*} done" | ||
|
||
${DIR_EXPORT}/%-${VERSION}-${RELEASE}.qcow2: | ||
$(eval DISTRO_NAME := $(shell echo ${*} | sed 's/[0-9].*//')) | ||
$(eval DISTRO_VER := $(shell echo ${*} | sed 's/[a-z]*//')) | ||
packer/build.sh ${DISTRO_NAME} ${DISTRO_VER} ${@} | ||
|
||
clean: | ||
-rm -rf ${DIR_EXPORT}/* | ||
|
||
#------------------------------------------------------------------------------ | ||
# context-linux | ||
#------------------------------------------------------------------------------ | ||
context-linux: $(patsubst %, context-linux/out/%, $(LINUX_CONTEXT_PACKAGES)) | ||
@${INFO} "Generate context-linux done" | ||
|
||
context-linux/out/%: | ||
cd context-linux; ./generate-all.sh | ||
|
||
#------------------------------------------------------------------------------ | ||
# help | ||
#------------------------------------------------------------------------------ | ||
help: | ||
@echo 'Available distros:' | ||
@echo ' $(DISTROS)' | ||
@echo | ||
@echo 'Available services:' | ||
@echo ' $(SERVICES)' | ||
@echo | ||
@echo 'Usage examples:' | ||
@echo ' make -- build all distros' | ||
@echo | ||
@echo ' make <distro> -- build just one distro' | ||
@echo ' make context-linux -- build context linux packages' | ||
@echo ' make context-windows -- TODO | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# context version | ||
VERSION ?= 6.6.1 | ||
RELEASE ?= 1 | ||
|
||
# log | ||
VERBOSE ?= 1 | ||
PACKER_LOG ?= 1 | ||
PACKER_HEADLESS ?= false | ||
|
||
DISTROS := alma8 alma9 \ | ||
alpine316 alpine317 \ | ||
alt9 alt10 \ | ||
debian10 debian11 debian12 \ | ||
devuan3 devuan4\ | ||
fedora37 fedora38 \ | ||
freebsd12 freebsd13 \ | ||
ol8 ol9 \ | ||
opensuse15 \ | ||
rocky8 rocky9 \ | ||
ubuntu2004 ubuntu2004min ubuntu2204 ubuntu2204min | ||
|
||
SERVICES := service_OneKE service_wordpress | ||
|
||
# default directories | ||
DIR_BUILD ?= build | ||
DIR_PACKER ?= $(DIR_BUILD)/packer | ||
DIR_CLOUDINIT ?= $(DIR_BUILD)/cloud-init | ||
DIR_EXPORT ?= export | ||
|
||
# create them if not present | ||
$(shell mkdir -p ${DIR_BUILD} ${DIR_PACKER} ${DIR_CLOUDINIT} ${DIR_EXPORT}) | ||
|
||
.SECONDARY: $(patsubst %, $(DIR_EXPORT)/%-$(VERSION)-$(RELEASE).qcow2, $(DISTROS)) | ||
.SECONDARY: $(patsubst %, $(DIR_EXPORT)/%.qcow2, $(DISTROS)) | ||
|
||
.PHONY: context-linux packer help | ||
|
||
# this needs to match context-linux/generate-all.sh products | ||
LINUX_CONTEXT_PACKAGES := one-context_${VERSION}-${RELEASE}.deb \ | ||
one-context-${VERSION}-${RELEASE}.el6.noarch.rpm \ | ||
one-context-${VERSION}-${RELEASE}.el7.noarch.rpm \ | ||
one-context-${VERSION}-${RELEASE}.el8.noarch.rpm \ | ||
one-context-${VERSION}-${RELEASE}.el9.noarch.rpm \ | ||
one-context-${VERSION}-${RELEASE}.suse.noarch.rpm \ | ||
one-context-${VERSION}_${RELEASE}.txz \ | ||
one-context-${VERSION}-alt${RELEASE}.noarch.rpm \ | ||
one-context-${VERSION}-r${RELEASE}.apk \ | ||
one-context-linux-${VERSION}-${RELEASE}.iso | ||
|
||
LINUX_CONTEXT_PACKAGES_FULL := $(patsubst %, context-linux/out/%, $(LINUX_CONTEXT_PACKAGES)) | ||
|
||
|
||
# discover some binaries | ||
QEMU_BINARY ?= $(shell \ | ||
for _qb in /usr/bin/qemu-system-x86_64 \ | ||
/usr/libexec/qemu-kvm \ | ||
/usr/bin/qemu-kvm; do \ | ||
\ | ||
if [ -e "$$_qb" ]; then \ | ||
echo $$_qb && exit; \ | ||
fi; \ | ||
done ) | ||
|
||
# logging func | ||
INFO=sh -c 'if [ $(VERBOSE) = 1 ]; then echo [INFO] $$1; fi' INFO | ||
|
||
# export all variables | ||
export |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DISTROS := alma8 alma9 \ | ||
alpine316 alpine317 \ | ||
alt9 alt10 \ | ||
debian10 debian11 debian12 \ | ||
devuan3 devuan4\ | ||
fedora37 fedora38 \ | ||
freebsd12 freebsd13 \ | ||
ol8 ol9 \ | ||
opensuse15 \ | ||
rocky8 rocky9 \ | ||
ubuntu2004 ubuntu2004min ubuntu2204 ubuntu2204min | ||
|
||
SERVICES := service_OneKE service_wordpress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# one-apps | ||
Toolchain to build OpenNebula appliances | ||
|
||
Requirements: | ||
- make | ||
- Packer | ||
- Qemu Packer Plugin | ||
- cloud-utils | ||
- guestfs-tools | ||
- qemu-img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
service_bootstrap() { ruby -- "${BASH_SOURCE%.*}/appliance.rb" bootstrap; } | ||
|
||
service_cleanup() { ruby -- "${BASH_SOURCE%.*}/appliance.rb" cleanup; } | ||
|
||
service_configure() { ruby -- "${BASH_SOURCE%.*}/appliance.rb" configure; } | ||
|
||
service_install() { ruby -- "${BASH_SOURCE%.*}/appliance.rb" install; } | ||
|
||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
AllCops: | ||
Exclude: | ||
- '*_spec.rb' | ||
|
||
Lint/MissingCopEnableDirective: | ||
Enabled: false | ||
|
||
Layout/FirstArrayElementIndentation: | ||
Enabled: false | ||
|
||
Layout/FirstHashElementIndentation: | ||
Enabled: false | ||
|
||
Layout/HashAlignment: | ||
Enabled: false | ||
|
||
Layout/HeredocIndentation: | ||
Enabled: false | ||
|
||
Layout/IndentationWidth: | ||
Enabled: false | ||
|
||
Layout/MultilineMethodCallIndentation: | ||
Enabled: false | ||
|
||
Metrics/BlockLength: | ||
Enabled: false | ||
|
||
Metrics/MethodLength: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'config.rb' | ||
require_relative 'helpers.rb' | ||
|
||
require_relative 'vnf.rb' | ||
require_relative 'kubernetes.rb' | ||
|
||
require_relative 'multus.rb' | ||
require_relative 'calico.rb' | ||
require_relative 'canal.rb' | ||
require_relative 'cilium.rb' | ||
|
||
require_relative 'metallb.rb' | ||
require_relative 'traefik.rb' | ||
require_relative 'longhorn.rb' | ||
require_relative 'cleaner.rb' | ||
|
||
if caller.empty? | ||
case ARGV[0].to_sym | ||
when :install | ||
install_packages PACKAGES | ||
|
||
with_policy_rc_d_disabled do | ||
install_kubernetes | ||
end | ||
|
||
install_metallb | ||
install_traefik | ||
install_longhorn | ||
install_cleaner | ||
|
||
# NOTE: Longhorn images are pulled separately. | ||
pull_addon_images if ONE_SERVICE_AIRGAPPED | ||
|
||
msg :info, 'Installation completed successfully' | ||
|
||
when :configure | ||
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-cilium' if ONEAPP_K8S_CNI_PLUGIN == 'cilium' | ||
|
||
include_images 'one-longhorn' if ONEAPP_K8S_LONGHORN_ENABLED | ||
include_images 'one-metallb' if ONEAPP_K8S_METALLB_ENABLED | ||
include_images 'one-traefik' if ONEAPP_K8S_TRAEFIK_ENABLED | ||
include_images 'one-cleaner' | ||
end | ||
|
||
node = configure_kubernetes( | ||
configure_cni: ->{ | ||
configure_multus if ONEAPP_K8S_MULTUS_ENABLED | ||
configure_calico if ONEAPP_K8S_CNI_PLUGIN == 'calico' | ||
configure_canal if ONEAPP_K8S_CNI_PLUGIN == 'canal' | ||
configure_cilium if ONEAPP_K8S_CNI_PLUGIN == 'cilium' | ||
}, | ||
configure_addons: ->{ | ||
configure_metallb if ONEAPP_K8S_METALLB_ENABLED | ||
|
||
include_manifests 'one-longhorn' if ONEAPP_K8S_LONGHORN_ENABLED | ||
include_manifests 'one-metallb' if ONEAPP_K8S_METALLB_ENABLED | ||
include_manifests 'one-traefik' if ONEAPP_K8S_TRAEFIK_ENABLED | ||
include_manifests 'one-cleaner' | ||
} | ||
) | ||
|
||
if node[:join_worker] | ||
vnf_ingress_setup_https_backend | ||
vnf_ingress_setup_http_backend | ||
end | ||
|
||
msg :info, 'Configuration completed successfully' | ||
|
||
when :bootstrap | ||
puts 'bootstrap_success' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'base64' | ||
require 'yaml' | ||
|
||
require_relative 'config.rb' | ||
require_relative 'helpers.rb' | ||
|
||
def configure_calico(manifest_dir = K8S_MANIFEST_DIR) | ||
msg :info, 'Configure Calico' | ||
|
||
if ONEAPP_K8S_CNI_CONFIG.nil? | ||
msg :info, 'Create Calico CRD config from user-provided ranges' | ||
|
||
documents = YAML.load_stream <<~MANIFEST | ||
--- | ||
apiVersion: helm.cattle.io/v1 | ||
kind: HelmChartConfig | ||
metadata: | ||
name: rke2-calico | ||
namespace: kube-system | ||
spec: | ||
valuesContent: |- | ||
MANIFEST | ||
else | ||
msg :info, 'Use Calico user-provided config' | ||
documents = YAML.load_stream Base64.decode64 ONEAPP_K8S_CNI_CONFIG | ||
end | ||
|
||
msg :info, 'Generate Calico config manifest' | ||
manifest = YAML.dump_stream *documents | ||
file "#{manifest_dir}/rke2-calico-config.yaml", manifest, overwrite: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'base64' | ||
require 'yaml' | ||
|
||
require_relative 'config.rb' | ||
require_relative 'helpers.rb' | ||
|
||
def configure_canal(manifest_dir = K8S_MANIFEST_DIR) | ||
msg :info, 'Configure Canal' | ||
|
||
if ONEAPP_K8S_CNI_CONFIG.nil? | ||
msg :info, 'Create Canal CRD config from user-provided ranges' | ||
|
||
documents = YAML.load_stream <<~MANIFEST | ||
--- | ||
apiVersion: helm.cattle.io/v1 | ||
kind: HelmChartConfig | ||
metadata: | ||
name: rke2-canal | ||
namespace: kube-system | ||
spec: | ||
valuesContent: |- | ||
MANIFEST | ||
else | ||
msg :info, 'Use Canal user-provided config' | ||
documents = YAML.load_stream Base64.decode64 ONEAPP_K8S_CNI_CONFIG | ||
end | ||
|
||
msg :info, 'Generate Canal config manifest' | ||
manifest = YAML.dump_stream *documents | ||
file "#{manifest_dir}/rke2-canal-config.yaml", manifest, overwrite: true | ||
end |
Oops, something went wrong.