diff --git a/Dockerfile.sandbox-lite b/Dockerfile.sandbox-lite deleted file mode 100644 index 095c83b6e1..0000000000 --- a/Dockerfile.sandbox-lite +++ /dev/null @@ -1,115 +0,0 @@ -# syntax=docker/dockerfile:1.3 - - -ARG FLYTE_VERSION="latest" -FROM ghcr.io/flyteorg/flyteconsole-release:${FLYTE_VERSION} AS flyteconsole - -FROM --platform=${BUILDPLATFORM} golang:1.19.0-alpine3.16 AS go_builder - -ARG TARGETARCH -ENV GOARCH=${TARGETARCH} -ENV GOOS=linux - -# Install dependencies -RUN apk add --no-cache build-base - -COPY go.mod go.sum /app/flyte/ -WORKDIR /app/flyte - -COPY datacatalog datacatalog -COPY flyteadmin flyteadmin -COPY flytecopilot flytecopilot -COPY flyteidl flyteidl -COPY flyteplugins flyteplugins -COPY flytepropeller flytepropeller -COPY flytestdlib flytestdlib - -RUN go mod download - -COPY --from=flyteconsole /app/ cmd/single/dist - -COPY cmd/ /app/flyte/cmd/ -RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/go/pkg/mod go build -tags console -v -o /flyte cmd/main.go - -FROM alpine:3.15 AS base - -# Install dependencies -RUN apk add --no-cache openssl - -# Make directory to store artifacts -RUN mkdir -p /flyteorg/bin /flyteorg/share - -# Install k3s -ARG K3S_VERSION="v1.21.1%2Bk3s1" -ARG TARGETARCH - -RUN case $TARGETARCH in \ - amd64) export SUFFIX=;; \ - arm64) export SUFFIX=-arm64;; \ - aarch64) export SUFFIX=-arm64;; \ - # TODO: Check if we need to add case fail - esac; \ - wget -q -O /flyteorg/bin/k3s https://github.com/k3s-io/k3s/releases/download/${K3S_VERSION}/k3s${SUFFIX} \ - && chmod +x /flyteorg/bin/k3s - -# Install Helm -ARG HELM_VERSION="v3.6.3" - -RUN wget -q -O /flyteorg/bin/get_helm.sh https://raw.githubusercontent.com/helm/helm/${HELM_VERSION}/scripts/get-helm-3 && \ - chmod 700 /flyteorg/bin/get_helm.sh && \ - sh /flyteorg/bin/get_helm.sh --version ${HELM_VERSION} && \ - mv /usr/local/bin/helm /flyteorg/bin/helm && \ - rm /flyteorg/bin/get_helm.sh - -# Install flytectl -RUN wget -q -O - https://raw.githubusercontent.com/flyteorg/flytectl/master/install.sh | BINDIR=/flyteorg/bin sh -s - -# Install buildkit-cli-for-kubectl -COPY --from=go_builder /flyte /flyteorg/bin/ - -# Copy flyte chart -COPY charts/flyte-deps/ /flyteorg/share/flyte-deps - -# Copy scripts -COPY docker/sandbox/kubectl docker/sandbox/cgroup-v2-hack.sh /flyteorg/bin/ - -# Copy Flyte config -COPY flyte.yaml /flyteorg/share/flyte.yaml - -FROM docker:20.10.14-dind-alpine3.15 AS dind - -# Install dependencies -RUN apk add --no-cache bash git make tini curl jq - -# Copy artifacts from base -COPY --from=base /flyteorg/ /flyteorg/ - -# Copy entrypoints -COPY docker/sandbox-lite/flyte-entrypoint-dind.sh /flyteorg/bin/flyte-entrypoint.sh - -# Copy cluster resource templates -COPY docker/sandbox-lite/templates/ /etc/flyte/clusterresource/templates/ - -ENV FLYTE_VERSION "${FLYTE_VERSION}" - -ARG FLYTE_TEST="release" -ENV FLYTE_TEST "${FLYTE_TEST}" -ENV FLYTE_DEV "False" - -RUN addgroup -S docker - -# Update PATH variable -ENV PATH "/flyteorg/bin:${PATH}" -ENV POD_NAMESPACE "flyte" - -# Declare volumes for k3s -VOLUME /var/lib/kubelet -VOLUME /var/lib/rancher/k3s -VOLUME /var/lib/cni -VOLUME /var/log - -# Expose Flyte ports -# 30080 for console, 30081 for gRPC, 30082 for k8s dashboard, 30084 for minio api, 30088 for minio console -EXPOSE 30080 30081 30082 30084 30088 30089 - -ENTRYPOINT ["tini", "flyte-entrypoint.sh"] diff --git a/docker/sandbox-lite/flyte-entrypoint-dind.sh b/docker/sandbox-lite/flyte-entrypoint-dind.sh deleted file mode 100755 index 0585624970..0000000000 --- a/docker/sandbox-lite/flyte-entrypoint-dind.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh - -set -euo pipefail - -# Apply cgroup v2 hack -cgroup-v2-hack.sh - -trap 'pkill -P $$' EXIT -FLYTE_TIMEOUT=${FLYTE_TIMEOUT:-600} - -monitor() { - while : ; do - for pid in $@ ; do - kill -0 $pid &> /dev/null || exit 1 - done - - sleep 1 - done -} - -# Start docker daemon -echo "Starting Docker daemon..." -file="/var/run/docker.pid" -if [ -f "$file" ] ; then - rm "$file" -fi -dockerd &> /var/log/dockerd.log & -DOCKERD_PID=$! -timeout "$FLYTE_TIMEOUT" sh -c "until docker info &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for dockerd to start"; exit 1 ) -echo "Done." - -# Start k3s -echo "Starting k3s cluster..." -KUBERNETES_API_PORT=${KUBERNETES_API_PORT:-6443} -k3s server --docker --no-deploy=traefik --no-deploy=servicelb --no-deploy=local-storage --no-deploy=metrics-server --https-listen-port=${KUBERNETES_API_PORT} &> /var/log/k3s.log & -K3S_PID=$! -timeout "$FLYTE_TIMEOUT" sh -c "until k3s kubectl get node $HOSTNAME &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for the Kubernetes cluster to start"; exit 1 ) -k3s kubectl wait node $HOSTNAME --for condition=Ready --timeout ${FLYTE_TIMEOUT}s &> /dev/null || ( echo >&2 "Timed out while waiting for the Kubernetes cluster to be ready"; exit 1 ) -echo "Done." - -# Deploy flyte -echo "Deploying Flyte..." -charts="/flyteorg/share/flyte-deps" -version="" - -if [[ $FLYTE_TEST = "release" ]] -then - helm repo add flyteorg https://flyteorg.github.io/flyte - helm fetch flyteorg/flyte-deps --version=$FLYTE_VERSION - version="--version $FLYTE_VERSION" - charts="flyteorg/flyte-deps" -fi - -if [[ $FLYTE_TEST = "local" ]] -then - helm dep update $charts -fi -helm upgrade -n flyte --create-namespace flyte $charts --kubeconfig /etc/rancher/k3s/k3s.yaml --install --wait - -timeout "$FLYTE_TIMEOUT" sh -c "until k3s kubectl get namespace flyte &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for the Flyte namespace to be created"; exit 1 ) -timeout "$FLYTE_TIMEOUT" sh -c "until k3s kubectl rollout status deployment minio -n flyte &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for the minio rollout to be created"; exit 1 ) -timeout "$FLYTE_TIMEOUT" sh -c "until k3s kubectl rollout status deployment postgres -n flyte &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for the postgres rollout to be created"; exit 1 ) - -k3s kubectl wait --for=condition=available deployment/minio deployment/postgres -n flyte --timeout=5m || ( echo >&2 "Timed out while waiting for the Flyte deployment to start"; exit 1 ) -# Create directory to store certificate -mkdir -p /tmp/k8s-webhook-server/serving-certs - -# With flytectl sandbox --source flag, we mount the root volume to user source dir that will create helm & k8s cache specific directory. -# In Linux, These file belongs to root user that is different then current user -# In this case during fast serialization, Pyflyte will through error because of permission denied -rm -rf /root/.cache /root/.kube /root/.config - -if [[ $FLYTE_DEV = "True" ]] -then - # Namespaces must be manually created since cluster resource manager is disabled by default - k3s kubectl create ns flytesnacks-development - # Monitor running processes. Exit when the first process exits. - monitor ${DOCKERD_PID} ${K3S_PID} -else - flyte start --config /flyteorg/share/flyte.yaml & - FLYTE_PID=$! - # Monitor running processes. Exit when the first process exits. - monitor ${DOCKERD_PID} ${K3S_PID} ${FLYTE_PID} -fi diff --git a/docker/sandbox-lite/templates/namespace.yaml b/docker/sandbox-lite/templates/namespace.yaml deleted file mode 100644 index 90b53893ac..0000000000 --- a/docker/sandbox-lite/templates/namespace.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: {{ namespace }} -spec: - finalizers: - - kubernetes \ No newline at end of file diff --git a/docker/sandbox-lite/templates/project_resource_quota.yaml b/docker/sandbox-lite/templates/project_resource_quota.yaml deleted file mode 100644 index 12e7711503..0000000000 --- a/docker/sandbox-lite/templates/project_resource_quota.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: v1 -kind: ResourceQuota -metadata: - name: project-quota - namespace: {{ namespace }} -spec: - hard: - limits.cpu: {{ projectQuotaCpu }} - limits.memory: {{ projectQuotaMemory }} \ No newline at end of file