Skip to content

Commit

Permalink
Added sandbox deployment
Browse files Browse the repository at this point in the history
Signed-off-by: Yuvraj <[email protected]>
  • Loading branch information
Yuvraj committed May 6, 2022
1 parent ae0a26c commit abc1f5c
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 139 deletions.
96 changes: 96 additions & 0 deletions charts/flyte-core/values-sandbox.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

flyteadmin:
service:
annotations:
projectcontour.io/upstream-protocol.h2c: grpc
type: ClusterIP
loadBalancerSourceRanges: []

datacatalog:
service:
annotations:
projectcontour.io/upstream-protocol.h2c: grpc
type: NodePort

flyteconsole:
ga:
enabled: true
tracking_id: "G-0QW4DJWJ20"

deployRedoc: true

common:
databaseSecret:
# -- Specify name of K8s Secret which contains Database password. Leave it empty if you don't need this Secret
name: ""

# -- Specify your Secret (with sensitive data) or pseudo-manifest (without sensitive data). See https://github.com/godaddy/kubernetes-external-secrets
secretManifest: {}
ingress:
host: ""
webpackHMR: true

db:
datacatalog:
database:
port: 5432
username: postgres
host: postgres
dbname: "datacatalog"
admin:
database:
port: 5432
username: postgres
host: postgres
dbname: "flyteadmin"

configmap:
console:
CONFIG_DIR: /etc/flyte/config
DISABLE_AUTH: "1"


# -- Kubernetes specific Flyte configuration
k8s:
plugins:
# -- Configuration section for all K8s specific plugins [Configuration structure](https://pkg.go.dev/github.com/lyft/flyteplugins/go/tasks/pluginmachinery/flytek8s/config)
k8s:
# DEFAULT_ENV_VAR: VALUE
default-cpus: 100m
default-env-vars:
- FLYTE_AWS_ENDPOINT: "http://minio.flyte.svc.cluster.local:9000"
- FLYTE_AWS_ACCESS_KEY_ID: minio
- FLYTE_AWS_SECRET_ACCESS_KEY: flyte
default-memory: 200Mi

remoteData:
remoteData:
region: "us-east-1"
scheme: "local"
signedUrls:
durationMinutes: 3

# -- Resource manager configuration
resource_manager:
# -- resource manager configuration
propeller:
resourcemanager:
type: noop
redis: null

task_logs:
plugins:
logs:
kubernetes-enabled: true
kubernetes-template-uri: 'http://localhost:30082/#/log/{{ "{{" }} .namespace {{ "}}" }}/{{ "{{" }} .podName {{ "}}" }}/pod?namespace={{ "{{" }} .namespace {{ "}}" }}'
# -- One option is to enable cloudwatch logging for EKS, update the region and log group accordingly
cloudwatch-enabled: false

workflow_notifications:
enabled: false
config: {}

redis:
# --- enable or disable Redis Statefulset installation
enabled: false

1 change: 1 addition & 0 deletions docker/sandbox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ RUN wget -q -O - https://raw.githubusercontent.com/flyteorg/flytectl/master/inst
# Copy flyte chart
COPY charts/flyte/ /flyteorg/share/flyte
COPY charts/flyte-core/ /flyteorg/share/flyte-core
COPY charts/flyte-deps/ /flyteorg/share/flyte-deps

# Copy scripts
COPY docker/sandbox/kubectl docker/sandbox/cgroup-v2-hack.sh docker/sandbox/wait-for-flyte.sh /flyteorg/bin/
Expand Down
29 changes: 23 additions & 6 deletions docker/sandbox/flyte-entrypoint-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,48 @@ K3S_PID=$!
timeout 600 sh -c "until k3s kubectl explain deployment &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for the Kubernetes cluster to start"; exit 1 )
echo "Done."

echo "Deploying Flyte..."
FLYTE_VERSION=${FLYTE_VERSION:-latest}
if [[ $FLYTE_VERSION = "latest" ]]
then
FLYTE_VERSION=$(curl --silent "https://api.github.com/repos/flyteorg/flyte/releases/latest" | jq -r .tag_name)
fi

# Deploy flyte
echo "Deploying Flyte..."
helm repo add flyteorg https://flyteorg.github.io/flyte

echo "Deploying Flyte-deps..."
version=""
charts="/flyteorg/share/flyte-deps"

if [[ $FLYTE_TEST = "release" ]]
then
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-deps $charts --kubeconfig /etc/rancher/k3s/k3s.yaml --install $version --set webhook.enabled=false,contour.enabled=true --wait

version=""
charts="/flyteorg/share/flyte"
charts="/flyteorg/share/flyte-core"

if [[ $FLYTE_TEST = "release" ]]
then
helm repo add flyteorg https://flyteorg.github.io/flyte
helm fetch flyteorg/flyte --version=$FLYTE_VERSION
version="--version $FLYTE_VERSION"
charts="flyteorg/flyte"
charts="flyteorg/flyte-core"
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 $version
helm upgrade -n flyte --create-namespace flyte-core $charts --kubeconfig /etc/rancher/k3s/k3s.yaml --install $version -f /flyteorg/share/flyte-core/values-sandbox.yaml

wait-for-flyte.sh

Expand Down
6 changes: 2 additions & 4 deletions docker/sandbox/wait-for-flyte.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@ timeout $FLYTE_TIMEOUT sh -c "until k3s kubectl rollout status deployment dataca
timeout $FLYTE_TIMEOUT sh -c "until k3s kubectl rollout status deployment flyteadmin -n flyte &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for the flyteadmin rollout to be created"; exit 1 )
timeout $FLYTE_TIMEOUT sh -c "until k3s kubectl rollout status deployment flyteconsole -n flyte &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for the flyteconsole rollout to be created"; exit 1 )
timeout $FLYTE_TIMEOUT sh -c "until k3s kubectl rollout status deployment flytepropeller -n flyte &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for the flytepropeller rollout to be created"; exit 1 )
timeout $FLYTE_TIMEOUT sh -c "until k3s kubectl rollout status deployment flyte-deps-contour-contour -n flyte &> /dev/null; do sleep 1; done" || ( echo >&2 "Timed out while waiting for the flytepropeller rollout to be created"; exit 1 )

# Wait for flyte deployment
k3s kubectl wait --for=condition=available deployment/datacatalog deployment/flyteadmin deployment/flyteconsole deployment/flytepropeller -n flyte --timeout=10m || ( echo >&2 "Timed out while waiting for the Flyte deployment to start"; exit 1 )

# Wait for envoy proxy to become ready
timeout $FLYTE_TIMEOUT sh -c 'until [[ $(k3s kubectl get daemonset flyte-contour-envoy -n flyte -o jsonpath="{.status.numberReady}") -eq 1 ]]; do sleep 1; done' || ( echo >&2 "Timed out while waiting for the Flyte envoy proxy to start"; exit 1 )
k3s kubectl wait --for=condition=available deployment/datacatalog deployment/flyteadmin deployment/flyteconsole deployment/flytepropeller deployment/flyte-deps-contour-contour -n flyte --timeout=10m || ( echo >&2 "Timed out while waiting for the Flyte deployment to start"; exit 1 )

echo "Flyte is ready! Flyte UI is available at http://localhost:30081/console."
32 changes: 13 additions & 19 deletions rsts/deployment/plugin_setup/k8s/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -476,18 +476,9 @@ This guide gives an overview of setting up the K8s Operator backend plugin in yo
5. Upgrade the Flyte Helm release.

.. tabbed:: Sandbox

.. code-block:: bash
helm upgrade flyte flyteorg/flyte -f values-override.yaml -n flyte
.. tabbed:: AWS/GCP

.. code-block:: bash
helm upgrade flyte flyteorg/flyte-core -f values-override.yaml -n flyte
.. code-block:: bash
helm upgrade flyte flyteorg/flyte-core -f https://raw.githubusercontent.com/flyteorg/flyte/master/charts/flyte-core/values-sandbox.yaml -f values-override.yaml -n flyte
6. Register the plugin example.
Expand All @@ -496,26 +487,26 @@ This guide gives an overview of setting up the K8s Operator backend plugin in yo

.. code-block:: bash
flytectl register files --config ~/.flyte/config.yaml https://github.com/flyteorg/flytesnacks/releases/download/v0.2.225/snacks-cookbook-integrations-kubernetes-kfpytorch.tar.gz --archive -p flytesnacks -d development --version latest
flytectl register files --config ~/.flyte/config.yaml https://github.com/flyteorg/flytesnacks/releases/download/v0.3.75/snacks-cookbook-integrations-kubernetes-kfpytorch.tar.gz --archive -p flytesnacks -d development --version latest
.. tabbed:: TensorFlow Operator

.. code-block:: bash
# TODO: https://github.com/flyteorg/flyte/issues/1757
flytectl register files --config ~/.flyte/config.yaml https://github.com/flyteorg/flytesnacks/releases/download/v0.2.225/<TODO>.tar.gz --archive -p flytesnacks -d development --version latest
flytectl register files --config ~/.flyte/config.yaml https://github.com/flyteorg/flytesnacks/releases/download/v0.3.75/snacks-cookbook-integrations-kubernetes-kftensorflow.tar.gz --archive -p flytesnacks -d development --version latest
.. tabbed:: MPI Operator

.. code-block:: bash
flytectl register files --config ~/.flyte/config.yaml https://github.com/flyteorg/flytesnacks/releases/download/v0.2.226/snacks-cookbook-integrations-kubernetes-kfmpi.tar.gz --archive -p flytesnacks -d development --version latest
flytectl register files --config ~/.flyte/config.yaml https://github.com/flyteorg/flytesnacks/releases/download/v0.3.75/snacks-cookbook-integrations-kubernetes-kfmpi.tar.gz --archive -p flytesnacks -d development --version latest
.. tabbed:: Spark Operator

.. code-block:: bash
flytectl register files --config ~/.flyte/config.yaml https://github.com/flyteorg/flytesnacks/releases/download/v0.2.226/snacks-cookbook-integrations-kubernetes-k8s_spark.tar.gz --archive -p flytesnacks -d development --version latest
flytectl register files --config ~/.flyte/config.yaml https://github.com/flyteorg/flytesnacks/releases/download/v0.3.75/snacks-cookbook-integrations-kubernetes-k8s_spark.tar.gz --archive -p flytesnacks -d development --version latest
7. Launch an execution
Expand All @@ -524,6 +515,7 @@ This guide gives an overview of setting up the K8s Operator backend plugin in yo

* Navigate to the Flyte Console's UI (e.g. `sandbox <http://localhost:30081/console>`_) and find the relevant workflow
* Click on `Launch` to open up a launch form
* Give **spark** as the service account if launching a spark example
* Submit the form to launch an execution

.. tabbed:: Flytectl
Expand All @@ -534,7 +526,7 @@ This guide gives an overview of setting up the K8s Operator backend plugin in yo

.. code-block:: bash
flytectl get launchplan --config ~/.flyte/config.yaml --project flytesnacks --domain development kfpytorch.pytorch_mnist.pytorch_training_wf --latest --execFile exec_spec.yaml --config ~/.flyte/config.yaml
flytectl get launchplan --config ~/.flyte/config.yaml --project flytesnacks --domain development kfpytorch.pytorch_mnist.pytorch_training_wf --latest --execFile exec_spec.yaml
* Launch! 🚀

Expand All @@ -548,7 +540,7 @@ This guide gives an overview of setting up the K8s Operator backend plugin in yo

.. code-block:: bash
flytectl get launchplan --config ~/.flyte/config.yaml --project flytesnacks --domain development <TODO: https://github.com/flyteorg/flyte/issues/1757> --latest --execFile exec_spec.yaml --config ~/.flyte/config.yaml
flytectl get launchplan --config ~/.flyte/config.yaml --project flytesnacks --domain development <TODO: https://github.com/flyteorg/flyte/issues/1757> --latest --execFile exec_spec.yaml
* Launch! 🚀

Expand All @@ -562,7 +554,7 @@ This guide gives an overview of setting up the K8s Operator backend plugin in yo

.. code-block:: bash
flytectl get launchplan --config ~/.flyte/config.yaml --project flytesnacks --domain development kfmpi.mpi_mnist.horovod_training_wf --latest --execFile exec_spec.yaml --config ~/.flyte/config.yaml
flytectl get launchplan --config ~/.flyte/config.yaml --project flytesnacks --domain development kfmpi.mpi_mnist.horovod_training_wf --latest --execFile exec_spec.yaml
* Launch! 🚀

Expand All @@ -576,7 +568,9 @@ This guide gives an overview of setting up the K8s Operator backend plugin in yo

.. code-block:: bash
flytectl get launchplan --config ~/.flyte/config.yaml --project flytesnacks --domain development k8s_spark.pyspark_pi.my_spark --latest --execFile exec_spec.yaml --config ~/.flyte/config.yaml
flytectl get launchplan --config ~/.flyte/config.yaml --project flytesnacks --domain development k8s_spark.pyspark_pi.my_spark --latest --execFile exec_spec.yaml
* Fill in the ``kubeServiceAcct`` as **spark** in the ``exec_spec.yaml`` file

* Launch! 🚀

Expand Down
13 changes: 2 additions & 11 deletions rsts/deployment/plugin_setup/webapi/snowflake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,9 @@ Replace ``<JWT_TOKEN>`` with your JWT token.

6. Upgrade the Flyte Helm release.

.. tabbed:: Sandbox

.. code-block:: bash
helm upgrade -n flyte -f values-override.yaml flyteorg/flyte --kubeconfig=~/.flyte/k3s/k3s.yaml
.. tabbed:: AWS/GCP

.. code-block:: bash
helm upgrade -n flyte -f values-override.yaml flyteorg/flyte-core
.. code-block:: bash
helm upgrade -n flyte -f https://raw.githubusercontent.com/flyteorg/flyte/master/charts/flyte-core/values-sandbox.yaml -f values-override.yaml flyteorg/flyte-core
7. Register the Snowflake plugin example.

Expand Down
Loading

0 comments on commit abc1f5c

Please sign in to comment.