Skip to content

Commit

Permalink
Merge pull request #15 from nyu-devops/update-fa23
Browse files Browse the repository at this point in the history
Updates for Fall 2023 Semester
  • Loading branch information
rofrano authored Oct 25, 2023
2 parents 0ac3d27 + c68fabc commit b651a23
Show file tree
Hide file tree
Showing 25 changed files with 69 additions and 307 deletions.
28 changes: 21 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// spell: disable
{
"name": "Kubernetes",
"dockerComposeFile": "docker-compose.yml",
Expand All @@ -6,12 +7,29 @@
"remoteUser": "vscode",
"customizations": {
"vscode": {
"settings": {
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"markdown-preview-github-styles.colorTheme": "light",
"files.exclude": {
"**/.git": true,
"**/.DS_Store": true,
"**/*.pyc": true,
"**/__pycache__": true,
"**/.pytest_cache": true
}
},
"extensions": [
"VisualVisualStudioExptTeam.vscodeintellicodeStudio",
"VisualStudioExptTeam.vscodeintellicode",
"ms-python.python",
"ms-python.pylint",
"ms-python.flake8",
"ms-python.vscode-pylance",
"CucumberOpen.cucumber-official",
"ms-python.black-formatter",
"njpwerner.autodocstring",
"wholroyd.jinja",
"yzhang.markdown-all-in-one",
Expand All @@ -37,10 +55,6 @@
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {},
"ghcr.io/rio/features/k3d:1": {},
"ghcr.io/rio/features/k9s:1": {},
"ghcr.io/rio/features/kustomize:1": {},
"ghcr.io/rio/features/skaffold:2": {}
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {}
}
}
1 change: 0 additions & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ services:
init: true
volumes:
- ..:/app
- ~/.bluemix/apikey.json:/home/vscode/apikey.json
command: sleep infinity
environment:
FLASK_APP: service:app
Expand Down
51 changes: 34 additions & 17 deletions .devcontainer/scripts/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,55 @@
######################################################################
# These scripts are meant to be run in user mode as they modify
# usr settings line .bashrc and .bash_aliases
# Copyright 2022, 2023 John J. Rofrano All Rights Reserved.
######################################################################

echo "**********************************************************************"
echo "Establishing Architecture..."
echo "**********************************************************************"
# Convert inconsistent architectures (x86_64=amd64) (aarch64=arm64)
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')"
echo "Architecture is:" $ARCH

echo "**********************************************************************"
echo "Installing DevSpace..."
echo "Installing K3D Kubernetes..."
echo "**********************************************************************"
curl -L -o devspace "https://github.com/loft-sh/devspace/releases/latest/download/devspace-linux-$ARCH"
sudo install -c -m 0755 devspace /usr/local/bin
curl -s "https://raw.githubusercontent.com/rancher/k3d/main/install.sh" | sudo bash
echo "Creating kc and kns alias for kubectl..."
echo "alias kc='/usr/local/bin/kubectl'" >> $HOME/.bash_aliases
echo "alias kns='kubectl config set-context --current --namespace'" >> $HOME/.bash_aliases
sudo sh -c 'echo "127.0.0.1 cluster-registry" >> /etc/hosts'

echo "**********************************************************************"
echo "Installing YQ..."
echo "Installing K9s..."
echo "**********************************************************************"
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$ARCH
sudo chmod a+x /usr/local/bin/yq
curl -L -o k9s.tar.gz "https://github.com/derailed/k9s/releases/download/v0.27.3/k9s_Linux_$ARCH.tar.gz"
tar xvzf k9s.tar.gz
sudo install -c -m 0755 k9s /usr/local/bin
rm k9s.tar.gz

echo "**********************************************************************"
echo "Installing IBM Cloud CLI..."
echo "Install Kustomize CLI..."
echo "**********************************************************************"
curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
echo "source /usr/local/ibmcloud/autocomplete/bash_autocomplete" >> $HOME/.bashrc
# Install user mode IBM Cloud plugins
ibmcloud plugin install container-registry -r 'IBM Cloud'
ibmcloud plugin install kubernetes-service -r 'IBM Cloud'
echo "Creating aliases for ibmcloud tools..."
echo "alias ic='/usr/local/bin/ibmcloud'" >> $HOME/.bash_aliases
echo "Creating kc and kns alias for kubectl..."
echo "alias kc='/usr/local/bin/kubectl'" >> $HOME/.bash_aliases
echo "alias kns='kubectl config set-context --current --namespace'" >> $HOME/.bash_aliases
curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
sudo mv kustomize /usr/local/bin/kustomize
echo "Creating ku alias for kustomize..."
echo "alias ku='/usr/local/bin/kustomize'" >> $HOME/.bash_aliases

echo "**********************************************************************"
echo "Installing Skaffold..."
echo "**********************************************************************"
curl -Lo skaffold "https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-$ARCH"
sudo install skaffold /usr/local/bin/

# echo "**********************************************************************"
# echo "Installing Knative for $ARCH..."
# echo "**********************************************************************"
# curl -Lo kn "https://github.com/knative/client/releases/download/knative-v1.11.0/kn-linux-$ARCH"
# sudo install kn /usr/local/bin/

echo "**********************************************************************"
echo "Installing YQ..."
echo "**********************************************************************"
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$ARCH
sudo chmod a+x /usr/local/bin/yq
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,10 @@ run: ## Run the service
##@ Kubernetes

.PHONY: cluster
# k3d cluster create --agents 1 --registry-create cluster-registry:0.0.0.0:32000 --port '8080:80@loadbalancer'
cluster: ## Create a K3D Kubernetes cluster with load balancer and registry
$(info Creating Kubernetes cluster with a registry and 1 node...)
k3d registry create registry.local --port 5000
k3d cluster create devops --config k3d-config.yaml
$(info Creating Kubernetes cluster with a registry and 1 worker node...)
k3d registry create registry.local --port 32000
k3d cluster create devops --agents 1 --registry-use k3d-registry.local:32000 --port '8080:80@loadbalancer'

.PHONY: cluster-rm
cluster-rm: ## Remove a K3D Kubernetes cluster
Expand Down
2 changes: 1 addition & 1 deletion deploy/deployment.yaml → k8s/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
restartPolicy: Always
containers:
- name: hitcounter
image: k3d-registry.local:5000/hitcounter:1.0
image: k3d-registry.local:32000/hitcounter:1.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion deploy/service.yaml → k8s/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: Service
metadata:
name: hitcounter
spec:
type: NodePort
type: ClusterIP
selector:
app: hitcounter
ports:
Expand Down
43 changes: 0 additions & 43 deletions kustomize/base/deployment.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions kustomize/base/kustomization.yaml

This file was deleted.

51 changes: 0 additions & 51 deletions kustomize/base/redis.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions kustomize/base/secret.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions kustomize/base/service.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions kustomize/overlays/dev/kustomization.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions kustomize/overlays/dev/patch-deploy.yaml

This file was deleted.

12 changes: 0 additions & 12 deletions kustomize/overlays/dev/patch-svc.yaml

This file was deleted.

18 changes: 0 additions & 18 deletions kustomize/overlays/local/ingress.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions kustomize/overlays/local/kustomization.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions kustomize/overlays/local/patch-svc.yaml

This file was deleted.

Loading

0 comments on commit b651a23

Please sign in to comment.