Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm direct example / renaming #9

Merged
merged 16 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ RUN pip3 --disable-pip-version-check --no-cache-dir install -U \
'poetry==1.6.1' \
'pre-commit==3.6.0' \
'pip==23.2.1'
RUN npm install -g @devcontainers/[email protected]
ENV DEBIAN_FRONTEND=noninteractive
RUN sudo apt-get update -y && sudo apt-get install -y \
iputils-ping \
traceroute \
kmod \
vim
ENV PATH="/home/vscode/.local/bin/:$PATH"
ENV EDITOR=vim
ENV PATH="/home/vscode/.local/bin/:$PATH"
ENV EDITOR=vim
ENV HOMEBREW_NO_AUTO_UPDATE=1
ENV HOMEBREW_NO_INSTALL_UPGRADE=1
3 changes: 3 additions & 0 deletions .devcontainer/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/python-3/.devcontainer/base.Dockerfile
ARG VARIANT="3.11"
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} as devcontainer
27 changes: 27 additions & 0 deletions .devcontainer/ci/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"remoteUser": "vscode",
"build": {
"dockerfile": "Dockerfile",
"target": "devcontainer",
"context": "..",
"args": {
"VARIANT": "3.11",
"INSTALL_NODE": "true",
"NODE_VERSION": "18.7"
}
},
"runArgs": [
"--network=host",
],
"features": {
"ghcr.io/devcontainers/features/terraform:1": {
"version": "1.6.2"
},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"helm": "3.14.0",
"version": "1.27"
},
"ghcr.io/rio/features/k3d:1": {},
}
}
25 changes: 2 additions & 23 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"postCreateCommand": "make post-create",
"postStartCommand": "make post-start",
"remoteUser": "vscode",
"customizations": {
"vscode": {
Expand All @@ -9,10 +7,7 @@
"python.pythonPath": "/usr/local/bin/python"
},
"extensions": [
"ms-python.python",
"mutantdino.resourcemonitor",
"github.copilot",
"github.copilot-chat"
]
}
},
Expand All @@ -31,9 +26,9 @@
"version": "1.6.2"
},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers-contrib/features/kind:1": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "1.25.6"
"helm": "3.14.0",
"version": "1.27"
},
"ghcr.io/rio/features/k3d:1": {},
"ghcr.io/devcontainers-contrib/features/terraform-docs:1": {
Expand All @@ -47,20 +42,4 @@
"ghcr.io/devcontainers-contrib/features/argo-cd:1": {
},
},
"mounts": [
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.aws,target=/home/vscode/.aws,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.ssh,target=/home/vscode/.ssh,type=bind,consistency=cached",
// "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.zsh_history,target=/home/vscode/.zsh_history,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshrc,target=/home/vscode/.zshrc,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.zshenv,target=/home/vscode/.zshenv,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.terraform.d,target=/home/vscode/.terraform.d,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.config/infracost,target=/home/vscode/.config/infracost,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.config/gcloud,target=/home/vscode/.config/gcloud,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.config/starship.toml,target=/home/vscode/.config/starship.toml,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.kube,target=/home/vscode/.kube,type=bind,consistency=cached",
// "source=${localEnv:HOME}${localEnv:USERPROFILE}/.gitconfig,target=/home/vscode/.gitconfig,type=bind,consistency=cached",
]
}
8 changes: 5 additions & 3 deletions .devcontainer/vm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ RUN pip3 --disable-pip-version-check --no-cache-dir install -U \
'poetry==1.6.1' \
'pre-commit==3.6.0' \
'pip==23.2.1'
RUN npm install -g @devcontainers/cli@v0.30.0
RUN npm install -g @devcontainers/cli@v0.57.0
ENV DEBIAN_FRONTEND=noninteractive
RUN sudo apt-get update -y && sudo apt-get install -y \
iputils-ping \
traceroute \
kmod \
vim
ENV PATH="/home/vscode/.local/bin/:$PATH"
ENV EDITOR=vim
ENV PATH="/home/vscode/.local/bin/:$PATH"
ENV EDITOR=vim
ENV HOMEBREW_NO_AUTO_UPDATE=1
ENV HOMEBREW_NO_INSTALL_UPGRADE=1
23 changes: 5 additions & 18 deletions .devcontainer/vm/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,27 @@
"NODE_VERSION": "18.7"
}
},
"runArgs": [ // maybe remove this
"runArgs": [
"--network=host",
],
"features": {
"ghcr.io/devcontainers-contrib/features/cloudflared:1": {},
"ghcr.io/devcontainers/features/go:1": {
},
"ghcr.io/devcontainers/features/aws-cli": {
"version": "2.6.3"
"ghcr.io/meaningful-ooo/devcontainer-features/homebrew:2": {
"shallowClone": true
},
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {
"omzPlugins": "zsh-syntax-highlighting zsh-autosuggestions"
},
"ghcr.io/devcontainers-contrib/features/starship-homebrew:1": {},
"ghcr.io/devcontainers-contrib/features/aws-cdk:2": {
"version": "2.59.0"
},
"ghcr.io/devcontainers/features/azure-cli:1": {},
"ghcr.io/devcontainers/features/terraform:1": {
"version": "1.6.2"
},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers-contrib/features/kind:1": {},
"ghcr.io/devcontainers-contrib/features/packer-asdf:2": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "1.25.6"
"helm": "3.14.0",
"version": "1.27"
},
"ghcr.io/rio/features/k3d:1": {},
// "ghcr.io/devcontainers/features/nix:1": {},
"ghcr.io/devcontainers-contrib/features/infracost:1": {
"version": "0.10.30"
},
"ghcr.io/dhoeric/features/google-cloud-cli:1": {
},
"ghcr.io/devcontainers-contrib/features/terraform-docs:1": {
},
"ghcr.io/devcontainers/features/github-cli:1": {
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: test
on:
# schedule:
# - cron: 0 13 * * 1 # Every Monday at 1PM UTC (9AM EST)
pull_request:
jobs:
run-example:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: npm install -g @devcontainers/[email protected]
- run: devcontainer up --workspace-folder=. --config .devcontainer/ci/devcontainer.json
- run: devcontainer exec --workspace-folder=. --config .devcontainer/ci/devcontainer.json ./scripts/test.sh
test-codespace:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- run: npm install -g @devcontainers/[email protected]
- run: devcontainer up --workspace-folder=.
17 changes: 9 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ SHELLOPTS := $(if $(SHELLOPTS),$(SHELLOPTS):, )xtrace pipefail errexit nounset

.PHONY: post-create
post-create:
@echo "post-create"
brew install helm-docs
./scripts/setup-krew.sh
./scripts/post-create.sh

.PHONY: post-start
post-start:
Expand Down Expand Up @@ -41,14 +39,17 @@ k3d-delete:
k3d cluster delete dev

TIMESTAMP := $(shell date -u "+%Y-%m-%d-T%H-%M-%S")
VERSION := 0.1-$(TIMESTAMP)

GIT_TAG := $(shell git describe --tags `git rev-list --tags --max-count=1` | sed 's/^v//')
VERSION ?= $(if $(filter $(PROD),true),$(GIT_TAG),$(GIT_TAG)-dev+$(TIMESTAMP))
build-chart:
rm -rf helm/treebeard-kubeflow-*.tgz
helm package helm/treebeard-kubeflow -d helm --version $(VERSION)
rm -rf helm/*.tgz
helm package helm/kubeflow-core -d helm --version $(VERSION)
yq eval '.targetRevision = "$(VERSION)"' -i helm/kubeflow/values.yaml
helm package helm/kubeflow -d helm --version $(VERSION)

push-chart: build-chart
helm push helm/treebeard-kubeflow-*.tgz oci://ghcr.io/treebeardtech/helm
helm push helm/kubeflow-core-$(VERSION).tgz oci://ghcr.io/treebeardtech/helm
helm push helm/kubeflow-$(VERSION).tgz oci://ghcr.io/treebeardtech/helm

helm-repo-login:
echo $(GHCR_PAT) | docker login ghcr.io -u alex-treebeard --password-stdin
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<br />

<a target="_blank" href="https://artifacthub.io/packages/helm/treebeard-kubeflow/treebeard-kubeflow">
<img src="https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/kubeflow-helm" />
<img src="https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/kubeflow" />
</a>
<a target="_blank" href="https://registry.terraform.io/modules/treebeardtech/kubeflow/helm/latest">
<img src="https://img.shields.io/badge/terraform-module-blue?logo=terraform" />
Expand Down Expand Up @@ -49,13 +49,19 @@ We provide a terraform and helm-based interface for managing Kubeflow via GitOps

<img src="https://raw.githubusercontent.com/treebeardtech/terraform-helm-kubeflow/main/docs/arch.png" width="650" height="100%">

### Packages

1. Terraform module: A simple entrypoint for those new to Argo and looking for a 1-click experience
2. kubeflow chart: A high-level helm entrypoint for setting up Kubeflow Argo Apps
3. kubeflow-core chart: A lower-level argo apps chart which can be invoked in the "argo app-of-apps" pattern.

### System Requirements

The default configuration of Kubeflow provided is designed to run on a cluster with 2cpus and 8G memory.

## Getting Started

Note that as all of our examples are implemented in Terraform, we recommend using the Terraform module to start off. The [helm super-chart](https://github.com/treebeardtech/kubeflow-helm/tree/main/helm/treebeard-kubeflow) is likely to be a more viable interface as you move into production.
Note that as all of our examples are implemented in Terraform, we recommend using the Terraform module to start off. The [helm super-chart](https://github.com/treebeardtech/kubeflow/tree/main/helm/treebeard-kubeflow) is likely to be a more viable interface as you move into production.

We recommend trying out this module in a development environment first.

Expand All @@ -69,6 +75,12 @@ To do so, follow the [k3s tutorial](examples/k3s).

## Guides

### Install via helm CLI

```sh
helm install kf oci://ghcr.io/treebeardtech/helm/treebeard-kubeflow --version x.y.z
```

In order to integrate Kubeflow with your production systems there are some changes you
may want to make:

Expand Down
2 changes: 1 addition & 1 deletion examples/eks-https-loadbalancer/kubeflow.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module "treebeardkf" {
count = var.enable_treebeardkf ? 1 : 0
source = "../.."
bootstrap_values = [
kubeflow_values = [
<<EOF
sources:
- repoURL: 'https://github.com/treebeardtech/treebeard-kubeflow-gitops'
Expand Down
3 changes: 3 additions & 0 deletions examples/helm-direct/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Helm-Direct

This is an example of how you can directly use helm to bootstrap Kubeflow on ArgoCD.
49 changes: 49 additions & 0 deletions examples/helm-direct/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@

terraform {
required_providers {
helm = {
source = "hashicorp/helm"
version = "~> 2.12.1"
}
}
backend "local" {
}
}

variable "kubeconfig" {
type = string
}

provider "helm" {
kubernetes {
config_path = var.kubeconfig
}
}

resource "helm_release" "argo_cd" {
name = "argocd"
namespace = "argocd"
chart = "argo-cd"
repository = "https://argoproj.github.io/argo-helm"
version = "6.4.1"
create_namespace = true
values = [
<<EOF
dex:
enabled: false
EOF
]
}

resource "helm_release" "kubeflow" {
name = "kubeflow"
namespace = "argocd"
chart = "${path.module}/../../helm/kubeflow"
values = [
<<EOF
EOF
]
depends_on = [
helm_release.argo_cd
]
}
2 changes: 1 addition & 1 deletion examples/k3s-existing-istio/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ resource "null_resource" "completed" {

module "treebeardkf" {
source = "../.."
bootstrap_values = [
kubeflow_values = [
<<EOF
valuesObject:
certManager:
Expand Down
5 changes: 2 additions & 3 deletions examples/k3s-gitops/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ locals {

module "treebeardkf" {
source = "../.."
bootstrap_values = [
kubeflow_values = [
<<EOF
sources:
- repoURL: 'https://github.com/treebeardtech/treebeard-kubeflow-gitops'
Expand All @@ -37,8 +37,7 @@ valueFiles:
valuesObject:
# example of inline config where terraform vars can be injected
debug: ${local.debug}
syncPolicy: null

# syncPolicy: null # uncomment to debug
EOF
]
depends_on = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
apiVersion: v2
name: treebeard-kubeflow
name: kubeflow-core
version: 0.1-0
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# kubeflow-helm
# kubeflow-core

This chart installs argo apps and other installation utilities for Kubeflow.

It should be invoked using Kubeflow Helm, although advanced users may directly build on it.

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: Secret
metadata:
name: kubeflow-helm-debug
name: kubeflow-debug
type: Opaque
stringData:
helm-values: |
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion helm/bootstrap/Chart.yaml → helm/kubeflow/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
apiVersion: v2
name: bootstrap
name: kubeflow
version: 0.1.0
Loading
Loading