Skip to content
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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Image for a Python 3 development environment
##################################################
# cSpell: disable
FROM quay.io/rofrano/nyu-devops-base:sp26
FROM quay.io/rofrano/nyu-devops-base:su26

ARG USERNAME=vscode
USER root
Expand Down
9 changes: 9 additions & 0 deletions .devcontainer/devcontainer-lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "2.17.0",
"resolved": "ghcr.io/devcontainers/features/docker-in-docker@sha256:25b9f05705ffba7dbe503230ac76081419306f8c8bc88e0ce78c4ecd99a0c78c",
"integrity": "sha256:25b9f05705ffba7dbe503230ac76081419306f8c8bc88e0ce78c4ecd99a0c78c"
}
}
}
8 changes: 4 additions & 4 deletions .devcontainer/scripts/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,25 @@ sudo install -c -m 0755 devspace /usr/local/bin
echo "**********************************************************************"
echo "Installing Stern..."
echo "**********************************************************************"
curl -L -o stern.tar.gz "https://github.com/stern/stern/releases/download/v1.33.1/stern_1.33.1_linux_$ARCH.tar.gz"
curl -L -o stern.tar.gz "https://github.com/stern/stern/releases/download/v1.34.0/stern_1.34.0_linux_$ARCH.tar.gz"
tar xvzf stern.tar.gz
sudo install -c -m 0755 stern /usr/local/bin
rm stern.tar.gz LICENSE

echo "**********************************************************************"
echo "Installing Knative CLI..."
echo "**********************************************************************"
curl -L -o kn "https://github.com/knative/client/releases/download/knative-v1.21.0/kn-linux-$ARCH"
curl -L -o kn "https://github.com/knative/client/releases/download/knative-v1.22.0/kn-linux-$ARCH"
sudo install -c -m 0755 kn /usr/local/bin
rm kn

echo "**********************************************************************"
echo "Installing Tekton CLI..."
echo "**********************************************************************"
if [ $ARCH == amd64 ]; then
curl -L https://github.com/tektoncd/cli/releases/download/v0.43.1/tkn_0.43.1_Linux_x86_64.tar.gz --output tekton.tar.gz
curl -L https://github.com/tektoncd/cli/releases/download/v0.45.0/tkn_0.45.0_Linux_x86_64.tar.gz --output tekton.tar.gz
else
curl -L https://github.com/tektoncd/cli/releases/download/v0.43.1/tkn_0.43.1_Linux_aarch64.tar.gz --output tekton.tar.gz
curl -L https://github.com/tektoncd/cli/releases/download/v0.45.0/tkn_0.45.0_Linux_aarch64.tar.gz --output tekton.tar.gz
fi;
tar xvzf tekton.tar.gz tkn
sudo install -c -m 0755 tkn /usr/local/bin
Expand Down
29 changes: 18 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# These can be overidden with env vars.
# These can be overridden with env vars.
REGISTRY ?= cluster-registry:5000
IMAGE_NAME ?= petshop
IMAGE_TAG ?= 1.0
Expand Down Expand Up @@ -54,9 +54,16 @@ secret: ## Generate a secret hex key
##@ Kubernetes

.PHONY: cluster
cluster: ## Create a K3D Kubernetes cluster with load balancer and registry
$(info Creating Kubernetes cluster $(CLUSTER) with a registry and 2 worker nodes...)
k3d cluster create $(CLUSTER) --agents 2 --registry-create cluster-registry:0.0.0.0:5000 --port '8080:80@loadbalancer'
cluster: ## Create or reuse a K3D Kubernetes cluster with 2 worker nodes
@if k3d cluster list | awk 'NR > 1 {print $$1}' | grep -Fxq '$(CLUSTER)'; then \
echo "Kubernetes cluster $(CLUSTER) already exists; reusing it..."; \
else \
echo "Creating Kubernetes cluster $(CLUSTER) with 2 worker nodes..."; \
k3d cluster create $(CLUSTER) --agents 2 --registry-create cluster-registry:0.0.0.0:5000 --port '8080:80@loadbalancer'; \
fi
@mkdir -p $(HOME)/.kube
@k3d kubeconfig get $(CLUSTER) > $(HOME)/.kube/config
@echo "kubectl context configured for cluster $(CLUSTER)"

.PHONY: cluster-rm
cluster-rm: ## Remove a K3D Kubernetes cluster
Expand All @@ -79,12 +86,6 @@ tekton-clean: ## Clean up all PipelineRuns and TaskRuns
tkn pipelinerun ls
tkn pipelinerun rm --all -f

.PHONY: clustertasks
clustertasks: ## Create Tekton Cluster Tasks
$(info Creating Tekton Cluster Tasks...)
wget -qO - https://raw.githubusercontent.com/tektoncd/catalog/main/task/openshift-client/0.2/openshift-client.yaml | sed 's/kind: Task/kind: ClusterTask/g' | kubectl create -f -
wget -qO - https://raw.githubusercontent.com/tektoncd/catalog/main/task/buildah/0.4/buildah.yaml | sed 's/kind: Task/kind: ClusterTask/g' | kubectl create -f -

.PHONY: knative
knative: ## Install Knative
$(info Installing Knative in the Cluster...)
Expand All @@ -98,10 +99,16 @@ import: ## Import the image into the local K3D cluster
$(info Importing $(IMAGE) into k3d cluster $(CLUSTER)...)
k3d image import --cluster $(CLUSTER) $(IMAGE)

.PHONY: postgresql
postgresql: ## Deploys the PostgreSQL database on local Kubernetes
$(info Deploying PostgreSQL locally...)
oc apply -f k8s/postgresql

.PHONY: deploy
deploy: ## Deploy the service on local Kubernetes
$(info Deploying service locally...)
kubectl apply -f k8s/
oc apply -f k8s/
oc rollout status deployment/petshop

############################################################
# COMMANDS FOR BUILDING THE IMAGE
Expand Down
14 changes: 7 additions & 7 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@ name = "pypi"
[packages]
flask = "==3.1.3"
flask-sqlalchemy = "==3.1.1"
psycopg = {extras = ["binary"], version = "==3.3.2"}
psycopg = {extras = ["binary"], version = "==3.3.4"}
retry2 = "~=0.9.5"
python-dotenv = "~=1.2.1"
gunicorn = "~=25.0.0"
python-dotenv = "~=1.2.2"

[dev-packages]
# Code Quality
pylint = "~=4.0.4"
pylint = "~=4.0.5"
flake8 = "~=7.3.0"
black = "~=26.3.1"
black = "~=26.5.1"

# Test-Driven Development
pytest = "~=9.0.2"
pytest = "~=9.0.3"
pytest-pspec = "~=0.0.4"
pytest-cov = "~=7.0.0"
pytest-cov = "~=7.1.0"
factory-boy = "~=3.3.3"
coverage = "~=7.13.2"
coverage = "~=7.14.1"

# Utility
honcho = "~=2.0.0"
Expand Down
Loading
Loading