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

todo #2

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
25 changes: 7 additions & 18 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
#!/bin/bash

# Set variables
REGISTRY_URL="ghcr.io/biolytics-ai/k8s-dev-env" # Change this to your Docker registry URL
IMAGE_NAME="vscode-bastion-devcontainer"
IMAGE_TAG="latest" # or use $(git rev-parse --short HEAD) for git commit hash based tags
NAMESPACE="biolyticsai-dev"

# Path to directories containing Kubernetes configs
K8S_CONFIG_PATH="." # Path where Kubernetes YAML files are located

# Replace image name in the Kubernetes deployment file with the newly built image
echo "Updating Kubernetes deployment with new image..."
sed -i "s|your-registry/your-image-name:tag|$REGISTRY_URL/$IMAGE_NAME:$IMAGE_TAG|g" $K8S_CONFIG_PATH/dev-environment-deployment.yaml

# Apply Persistent Volume Claim (if needed)
# echo "Applying Persistent Volume Claim..."
# kubectl apply -f $K8S_CONFIG_PATH/dev-environment-pvc.yaml
echo "Applying Persistent Volume Claim..."
kubectl apply -f dev-environment-pvc.yaml

# Apply Kubernetes deployment
echo "Deploying to Kubernetes..."
kubectl apply -f $K8S_CONFIG_PATH/dev-environment-deployment.yaml
kubectl apply -f dev-environment-deployment.yaml

# Apply Kubernetes service
echo "Applying Kubernetes service..."
kubectl apply -f $K8S_CONFIG_PATH/dev-environment-service.yaml
kubectl apply -f dev-environment-service.yaml

kubectl apply -f dev-environment-service-ingress.yml

echo "Deployment completed successfully!"
echo "Deployment completed successfully!"
10 changes: 10 additions & 0 deletions dev-environment-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: dev-environment
namespace: biolytics-dev # Match the PVC's namespace
spec:
replicas: 1
selector:
Expand All @@ -17,3 +18,12 @@ spec:
image: ghcr.io/biolytics-ai/k8s-dev-env/vscode-bastion-devcontainer:latest
ports:
- containerPort: 8080
securityContext:
runAsUser: 0
volumeMounts:
- name: vscode-data
mountPath: /data
volumes:
- name: vscode-data
persistentVolumeClaim:
claimName: dev-environment-pvc # Use the PVC here
4 changes: 2 additions & 2 deletions dev-environment-pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dev-environment-pvc
namespace: biolyticsai-dev
namespace: biolytics-dev
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
storageClassName: standard
storageClassName: openebs-hostpath # or openebs-device
19 changes: 19 additions & 0 deletions dev-environment-service-ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dev-environment-ingress
namespace: biolytics-dev
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: biolyticsai.ai.gerimedica.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: dev-environment-service
port:
number: 8080
5 changes: 3 additions & 2 deletions dev-environment-service.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: dev-environment
namespace: biolyticsai-dev
name: dev-environment-service
namespace: biolytics-dev
spec:
type: ClusterIP
ports:
- port: 8080
targetPort: 8080
protocol: TCP
selector:
app: dev-environment
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,11 @@ This configuration ensures that sensitive credentials and configurations used to
## todo: Persistent Storage (Optional)

For a more persistent setup, consider adding a Persistent Volume Claim (PVC) to your deployment to retain your workspace data across container restarts.

# todo

Configure gitlab-ci.yml to automate Docker builds and push to the Harbor registry.
Create and apply Kubernetes configuration files (dev-environment-deployment.yaml, dev-environment-service.yaml, dev-environment-pvc.yaml).
Document the process and configurations in readme.md to guide developers on how to connect and use the environment.
Ensure all Kubernetes configurations and Dockerfiles are committed and reviewed via a pull request.
Set up a Git strategy (submodules or scripts) that allows pushing code updates to both GitLab (using VPN) and GitHub to ensure that both repositories stay synchronized.
Loading