Compare commits

...

2 Commits

Author SHA1 Message Date
ee5a31021c Update Dev documentation
All checks were successful
continuous-integration/drone/push Build is passing
2025-03-06 21:01:28 +01:00
8d8942d360 Start to write dev guide 2025-03-06 20:41:22 +01:00
3 changed files with 190 additions and 2 deletions

99
docs/DevelopmentSetup.md Normal file
View File

@@ -0,0 +1,99 @@
# Setup for development
This guide will present you how to prepare your computer to update features of MinioK8SBucket
## Install Rust
As this project has been written using Rust, you will need to install it prior working on MinioK8SBucket. Please follow the official instructions: https://www.rust-lang.org/tools/install
## Install Minikube
First, you need to install Minikube on your computer to have a K8S environment. In order to do this, please follow the official instructions: https://minikube.sigs.k8s.io/docs/start
## Start Minikube
You will then need to start Minikube using the following command:
```bash
minikube start
```
You can then make sure that Minikube is working properly:
```
minikube kubectl get nodes
```
You should get a response similar to this one:
```
NAME STATUS ROLES AGE VERSION
minikube Ready control-plane 2m16s v1.32.0
```
## Clone repository
Clone this repository using:
```bash
https://gitea.communiquons.org/pierre/MinioK8sBuckets
```
!!! note "Gitea account request"
If you want to get a Gitea account to make pull request on this repository, you will need to contact me at: `pierre.git@communiquons.org`
## Deploy Minio
First, enable Minikube tunnel:
```bash
minikube tunnel --bind-address '127.0.0.1'
```
You will then need to deploy Minio in Minikube. Apply the Minio deployment located at the in MinioK8SBucket repository:
```bash
minikube kubectl -- apply -f yaml/minio-dev-deployment.yml
```
Check for launching of pod:
```bash
minikube kubectl -- get pods -w
```
Check for the availability of the service:
```bash
minikube kubectl -- get services
```
You should get a result similar to this one:
```
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 31m
minio LoadBalancer 10.103.82.87 127.0.0.1 9000:30656/TCP,9090:31369/TCP 6m40s
```
You should be able to access minio at the following address: http://127.0.0.1:9090
Minio API should be available at: http://127.0.0.1:9000/
## Deploy CRD
You will need then to deploy the Custom Resource Definitions of MinioK8S bucket using the following command:
```bash
minikube kubectl -- apply -f yaml/crd.yaml
```
## Run operator
You can then run the project using the following command:
```bash
cargo fmt && cargo clippy && RUST_LOG=debug cargo run --
```
## Create a first bucket
You should be able to create a first bucket using the following command:
```bash
minikube kubectl -- apply -f test/test-outside-cluster.yaml
```
Have fun working for MinioK8SBucket!

View File

@@ -12,7 +12,7 @@ kind: MinioInstance
metadata: metadata:
name: my-minio-instance name: my-minio-instance
spec: spec:
endpoint: http://localhost:9000/ endpoint: http://localhost:9000
credentials: minio-root credentials: minio-root
--- ---
apiVersion: "communiquons.org/v1" apiVersion: "communiquons.org/v1"

View File

@@ -0,0 +1,89 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: minio
labels:
app: minio
spec:
replicas: 1
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
volumes:
- name: data
persistentVolumeClaim:
claimName: minio
containers:
- name: minio
image: minio/minio
imagePullPolicy: Always
ports:
- containerPort: 9000
protocol: TCP
name: api
- containerPort: 9090
protocol: TCP
name: console
args:
- server
- /data
- --console-address
- ":9090"
env:
- name: MINIO_ROOT_USER
value: minioadmin
- name: MINIO_ROOT_PASSWORD
value: minioadmin
volumeMounts:
- mountPath: "/data"
name: data
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: minio
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
capacity:
storage: 5Gi
hostPath:
path: /data/minio/
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 3Gi
---
apiVersion: v1
kind: Service
metadata:
name: minio
labels:
app: minio
spec:
type: LoadBalancer
selector:
app: minio
ports:
- name: api
port: 9000
targetPort: api
- name: console
port: 9090
targetPort: console
externalTrafficPolicy: Local