diff --git a/.github/workflows/lite-image-manual.yml b/.github/workflows/lite-image-manual.yml deleted file mode 100644 index 8b5831b0e2..0000000000 --- a/.github/workflows/lite-image-manual.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Manually push - -on: - workflow_dispatch: - inputs: - flyte_version: - description: 'flyte version' - required: true - default: 'latest' - type: string - -jobs: - sandbox-lite-build-dind: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: "0" - - name: Set flyte version to release - id: set_version - run: | - echo ::set-output name=flyte_version::$(echo ${{ github.event.inputs.flyte_version }}) - - name: Prepare DIND Image Names - id: dind-names - uses: docker/metadata-action@v3 - with: - # list of Docker images to use as base name for tags - images: | - ghcr.io/${{ github.repository_owner }}/flyte-sandbox-lite - tags: | - ${{ steps.set_version.outputs.flyte_version }} - type=sha,format=long, prefix=dind- - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-single-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-single-buildx - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: "${{ secrets.FLYTE_BOT_USERNAME }}" - password: "${{ secrets.FLYTE_BOT_PAT }}" - - name: Build and push DIND Image - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/arm64, linux/amd64 - push: true - target: dind - tags: ${{ steps.dind-names.outputs.tags }} - build-args: "FLYTE_VERSION=${{ steps.set_version.outputs.flyte_version }}" - file: Dockerfile.sandbox-lite - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new - - # Temp fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/.github/workflows/sandbox.yml b/.github/workflows/sandbox.yml index dc78d4b559..5b9a6056a4 100644 --- a/.github/workflows/sandbox.yml +++ b/.github/workflows/sandbox.yml @@ -62,60 +62,3 @@ jobs: tags: ${{ steps.dind-names.outputs.tags }} build-args: "FLYTE_VERSION=${{ steps.set_version.outputs.flyte_version }}" file: docker/sandbox/Dockerfile - - trigger-sandbox-lite-build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: "0" - - name: Setup Golang caches - uses: actions/cache@v3 - with: - path: | - /root/.cache/go-build - /root/go/pkg/mod - key: ${{ runner.os }}-golang-${{ hashFiles('go.sum') }} - restore-keys: | - ${{ runner.os }}-golang- - - name: Set flyte version to release - id: set_version - run: | - if [ ${{ github.event_name}} = "release" ]; then - echo ::set-output name=flyte_version::$(echo ${{ github.event.release.tag_name }}) - else - echo ::set-output name=flyte_version::latest - fi - - name: Prepare DIND Image Names - id: dind-names - uses: docker/metadata-action@v3 - with: - # list of Docker images to use as base name for tags - images: | - ghcr.io/${{ github.repository_owner }}/flyte-sandbox-lite - tags: | - ${{ steps.set_version.outputs.flyte_version }} - type=sha,format=long - - name: Set up QEMU - uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - name: Login to GitHub Container Registry - if: ${{ github.event_name == 'release' }} - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: "${{ secrets.FLYTE_BOT_USERNAME }}" - password: "${{ secrets.FLYTE_BOT_PAT }}" - - name: Build and push DIND Image - uses: docker/build-push-action@v2 - with: - context: . - platforms: linux/arm64, linux/amd64 - push: ${{ github.event_name == 'release' }} - target: dind - tags: ${{ steps.dind-names.outputs.tags }} - build-args: "FLYTE_VERSION=${{ steps.set_version.outputs.flyte_version }}" - file: Dockerfile.sandbox-lite diff --git a/.gitignore b/.gitignore index a8e78b52d6..301bf266a8 100644 --- a/.gitignore +++ b/.gitignore @@ -20,8 +20,6 @@ __pycache__/ /charts/flyteagent/Chart.lock /charts/flyte-deps/Chart.lock /charts/flyte-core/Chart.lock -/docker/sandbox-lite/storage/charts -/docker/sandbox-lite/storage/Chart.lock **/*.bak- .python-version dist/ 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-bundled/README.md b/docker/sandbox-bundled/README.md deleted file mode 100644 index 17ca62b002..0000000000 --- a/docker/sandbox-bundled/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Flyte Deployment Sandbox - -First make images -``` -ytong@Yees-MBP:~/go/src/github.com/flyteorg/flyte/docker/sandbox-ultra [flyte-sandbox] (cicd-sandbox-lite) $ make images -``` - -then build the k3s image. -``` -ytong@Yees-MBP:~/go/src/github.com/flyteorg/flyte/docker/sandbox-ultra [] (cicd-sandbox-lite) $ docker buildx build --file images/dockerfiles/k3s/Dockerfile --platform linux/arm64,linux/amd64 --push --tag ghcr.io/flyteorg/flyte-sandbox-lite:ultra7 . -``` 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