Skip to content

Commit

Permalink
Creating v4.5.8 branch to use with multi CAs (#312)
Browse files Browse the repository at this point in the history
* Adjustments to make 4.5.5 work with multiple CAs

* base alpine image and arg file example added

---------

Co-authored-by: Vadim Zharov <[email protected]>
  • Loading branch information
vadimzharov and Vadim Zharov authored Nov 18, 2024
1 parent 87f7f90 commit e078cd7
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
25 changes: 25 additions & 0 deletions .arg.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
BASE_IMAGE=registry.spectrocloud.dev/kairos-rhel9:9.4-6
SPECTRO_LUET_REPO=us-docker.spectrocloud.dev/palette-images/edge
SPECTRO_PUB_REPO=us-docker.spectrocloud.dev/palette-images
ALPINE_IMG=registry.spectrocloud.dev/alpine:3.20
SPECTRO_THIRD_PARTY_IMAGE=gcr.spectrocloud.dev/spectro-images-public/builders/spectro-third-party

HTTPS_PROXY=http://infra-proxy.spectrocloud.dev
HTTP_PROXY=http://infra-proxy.spectrocloud.dev
NO_PROXY="*.spectrocloud.dev"
PROXY_CERT_PATH=/root/ca-cert/
OSBUILDER_VERSION=v0.300.3
OSBUILDER_IMAGE=quay.spectrocloud.dev/kairos/osbuilder-tools:$OSBUILDER_VERSION

CUSTOM_TAG=rhel9-4
IMAGE_REGISTRY=registry.spectrocloud.dev
OS_DISTRIBUTION=rhel
IMAGE_REPO=kairos
OS_VERSION=9
K8S_DISTRIBUTION=kubeadm
ISO_NAME=palette-edge-installer
ARCH=amd64
UPDATE_KERNEL=false
CLUSTERCONFIG=spc.tgz
CIS_HARDENING=false
EDGE_CUSTOM_CONFIG=.edge-custom-config.yaml
6 changes: 5 additions & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ARG RKE2_PROVIDER_VERSION=v4.5.0
ARG NODEADM_PROVIDER_VERSION=v4.5.0

# Variables used in the builds. Update for ADVANCED use cases only. Modify in .arg file or via CLI arguments.
ARG SPECTRO_THIRD_PARTY_IMAGE=$SPECTRO_THIRD_PARTY_IMAGE
ARG OS_DISTRIBUTION
ARG OS_VERSION
ARG K8S_VERSION
Expand Down Expand Up @@ -230,7 +231,7 @@ kairos-agent:

install-k8s:
FROM --platform=linux/${ARCH} $ALPINE_IMG
DO +BASE_ALPINE
# DO +BASE_ALPINE
COPY (+third-party/luet --binary=luet) /usr/bin/luet

IF [ "$K8S_DISTRIBUTION" = "kubeadm" ] || [ "$K8S_DISTRIBUTION" = "kubeadm-fips" ] || [ "$K8S_DISTRIBUTION" = "nodeadm" ]
Expand Down Expand Up @@ -856,8 +857,11 @@ OS_RELEASE:

download-third-party:
ARG TARGETPLATFORM
ARG SPECTRO_THIRD_PARTY_IMAGE_PATH=${SPECTRO_THIRD_PARTY_IMAGE}
ARG binary

FROM --platform=$TARGETPLATFORM ${SPECTRO_THIRD_PARTY_IMAGE}

ARG TARGETARCH
SAVE ARTIFACT /binaries/${binary}/latest/$BIN_TYPE/$TARGETARCH/${binary} ${binary}
SAVE ARTIFACT /binaries/${binary}/latest/$BIN_TYPE/$TARGETARCH/${binary}.version ${binary}.version
Expand Down
4 changes: 4 additions & 0 deletions alpine-builder-image/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM us-docker.pkg.dev/palette-images/edge/canvos/alpine:3.20
COPY certs/ca1.crt /usr/local/share/ca-certificates/
COPY certs/ca2.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates
4 changes: 2 additions & 2 deletions earthly-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh
# uncomment the line below to enable debug mode
set -ex
cp /workspace/sc.crt /usr/local/share/ca-certificates/sc.crt
update-ca-certificates
#cp /workspace/sc.crt /usr/local/share/ca-certificates/sc.crt
#update-ca-certificates

# reference: https://github.com/earthly/earthly/blob/main/earthly-entrypoint.sh
EARTHLY_DEBUG=${EARTHLY_DEBUG:-false}
Expand Down
6 changes: 3 additions & 3 deletions earthly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ function build_with_proxy() {
-e NO_PROXY=$NO_PROXY \
-e no_proxy=$NO_PROXY \
-e EARTHLY_GIT_CONFIG=$gitconfig \
-v "$PROXY_CERT_PATH:/usr/local/share/ca-certificates/sc.crt:ro" \
-v "$PROXY_CERT_PATH:/usr/local/share/ca-certificates:ro" \
-v earthly-tmp:/tmp/earthly:rw \
-p 8372:8372 \
$SPECTRO_PUB_REPO/third-party/edge/earthly/buildkitd:$EARTHLY_VERSION
# Update the CA certificates in the container
docker exec -it earthly-buildkitd update-ca-certificates

docker exec -it earthly-buildkitd cat /etc/ssl/certs/ca-certificates.crt > ca-certificates-bundle.crt
# Run Earthly in Docker to create artifacts Variables are passed from the .arg file
docker run --privileged \
-v ~/.docker/config.json:/root/.docker/config.json \
Expand All @@ -47,7 +47,7 @@ function build_with_proxy() {
-e NO_PROXY=$NO_PROXY \
-e no_proxy=$NO_PROXY \
-v "$(pwd)":/workspace \
-v "$PROXY_CERT_PATH:/workspace/sc.crt:ro" \
-v ${PWD}/ca-certificates-bundle.crt:/etc/ssl/certs/ca-certificates.crt \
--entrypoint /workspace/earthly-entrypoint.sh \
$SPECTRO_PUB_REPO/third-party/edge/earthly/earthly:$EARTHLY_VERSION --allow-privileged "$@"
}
Expand Down

0 comments on commit e078cd7

Please sign in to comment.