From 12b07f0b229d25994207ca74ca8cd466a6f93696 Mon Sep 17 00:00:00 2001 From: hugolytics Date: Wed, 1 May 2024 13:40:11 +0200 Subject: [PATCH 1/4] todo --- readme.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/readme.md b/readme.md index be0bd0b..b718ae9 100644 --- a/readme.md +++ b/readme.md @@ -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. From e31c61bf8b8d2c04d0891868ff002235ddfbeac4 Mon Sep 17 00:00:00 2001 From: hugolytics Date: Wed, 26 Jun 2024 16:12:32 +0200 Subject: [PATCH 2/4] chore: Update Kubernetes deployment and service configurations --- deploy.sh | 25 +++++++------------------ dev-environment-deployment.yaml | 9 +++++++++ dev-environment-service-ingress.yml | 19 +++++++++++++++++++ dev-environment-service.yaml | 3 ++- 4 files changed, 37 insertions(+), 19 deletions(-) create mode 100644 dev-environment-service-ingress.yml diff --git a/deploy.sh b/deploy.sh index 0fdc222..6d27030 100755 --- a/deploy.sh +++ b/deploy.sh @@ -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.yaml -echo "Deployment completed successfully!" +echo "Deployment completed successfully!" \ No newline at end of file diff --git a/dev-environment-deployment.yaml b/dev-environment-deployment.yaml index 4198a49..8563f67 100644 --- a/dev-environment-deployment.yaml +++ b/dev-environment-deployment.yaml @@ -2,6 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: dev-environment + namespace: biolytics-dev spec: replicas: 1 selector: @@ -17,3 +18,11 @@ 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 + emptyDir: {} \ No newline at end of file diff --git a/dev-environment-service-ingress.yml b/dev-environment-service-ingress.yml new file mode 100644 index 0000000..db4d8fc --- /dev/null +++ b/dev-environment-service-ingress.yml @@ -0,0 +1,19 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: dev-environment-ingress + namespace: biolyticsai-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 diff --git a/dev-environment-service.yaml b/dev-environment-service.yaml index f54ed4e..fe7abbc 100644 --- a/dev-environment-service.yaml +++ b/dev-environment-service.yaml @@ -1,12 +1,13 @@ apiVersion: v1 kind: Service metadata: - name: dev-environment + name: dev-environment-service namespace: biolyticsai-dev spec: type: ClusterIP ports: - port: 8080 targetPort: 8080 + protocol: TCP selector: app: dev-environment \ No newline at end of file From 5775f5df7490b47c84b1164f5fab25c1d6bb3322 Mon Sep 17 00:00:00 2001 From: hugolytics Date: Wed, 26 Jun 2024 16:27:48 +0200 Subject: [PATCH 3/4] chore: Update Kubernetes deployment and service configurations --- deploy.sh | 2 +- dev-environment-deployment.yaml | 5 +++-- dev-environment-pvc.yaml | 2 +- dev-environment-service-ingress.yml | 2 +- dev-environment-service.yaml | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/deploy.sh b/deploy.sh index 6d27030..72ad8c4 100755 --- a/deploy.sh +++ b/deploy.sh @@ -12,6 +12,6 @@ kubectl apply -f dev-environment-deployment.yaml echo "Applying Kubernetes service..." kubectl apply -f dev-environment-service.yaml -kubectl apply -f dev-environment-service-ingress.yaml +kubectl apply -f dev-environment-service-ingress.yml echo "Deployment completed successfully!" \ No newline at end of file diff --git a/dev-environment-deployment.yaml b/dev-environment-deployment.yaml index 8563f67..bb606ab 100644 --- a/dev-environment-deployment.yaml +++ b/dev-environment-deployment.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: dev-environment - namespace: biolytics-dev + namespace: biolytics-dev # Match the PVC's namespace spec: replicas: 1 selector: @@ -25,4 +25,5 @@ spec: mountPath: /data volumes: - name: vscode-data - emptyDir: {} \ No newline at end of file + persistentVolumeClaim: + claimName: dev-environment-pvc # Use the PVC here \ No newline at end of file diff --git a/dev-environment-pvc.yaml b/dev-environment-pvc.yaml index 1cdbef2..757ee91 100644 --- a/dev-environment-pvc.yaml +++ b/dev-environment-pvc.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: PersistentVolumeClaim metadata: name: dev-environment-pvc - namespace: biolyticsai-dev + namespace: biolytics-dev spec: accessModes: - ReadWriteOnce diff --git a/dev-environment-service-ingress.yml b/dev-environment-service-ingress.yml index db4d8fc..5c85f46 100644 --- a/dev-environment-service-ingress.yml +++ b/dev-environment-service-ingress.yml @@ -2,7 +2,7 @@ apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: dev-environment-ingress - namespace: biolyticsai-dev + namespace: biolytics-dev annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: diff --git a/dev-environment-service.yaml b/dev-environment-service.yaml index fe7abbc..de53b9b 100644 --- a/dev-environment-service.yaml +++ b/dev-environment-service.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Service metadata: name: dev-environment-service - namespace: biolyticsai-dev + namespace: biolytics-dev spec: type: ClusterIP ports: From 488c225e249828b76e1c086d8685e2aaff576993 Mon Sep 17 00:00:00 2001 From: lberndsen_baken Date: Wed, 26 Jun 2024 17:30:58 +0200 Subject: [PATCH 4/4] change storage classname for pvc --- dev-environment-pvc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-environment-pvc.yaml b/dev-environment-pvc.yaml index 757ee91..ffd0f0c 100644 --- a/dev-environment-pvc.yaml +++ b/dev-environment-pvc.yaml @@ -9,4 +9,4 @@ spec: resources: requests: storage: 10Gi - storageClassName: standard \ No newline at end of file + storageClassName: openebs-hostpath # or openebs-device