This repository has been archived by the owner on Nov 20, 2024. It is now read-only.
forked from kubernetes-sigs/cosi-driver-sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from scality/feature/COSI-11-deploy-cosi-resou…
…rces-in-CI COSI-11 deploy cosi resources in ci
- Loading branch information
Showing
17 changed files
with
199 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Define log file for debugging | ||
LOG_FILE=".github/e2e_tests/artifacts/logs/kind_cluster_logs/cosi_deployment/setup_debug.log" | ||
mkdir -p "$(dirname "$LOG_FILE")" # Ensure the log directory exists | ||
|
||
# Error handling function | ||
error_handler() { | ||
echo "An error occurred during the COSI setup. Check the log file for details." | tee -a "$LOG_FILE" | ||
echo "Failed command: $BASH_COMMAND" | tee -a "$LOG_FILE" | ||
exit 1 | ||
} | ||
|
||
# Trap errors and call the error handler | ||
trap 'error_handler' ERR | ||
|
||
# Log command execution to the log file for debugging | ||
log_and_run() { | ||
echo "Running: $*" | tee -a "$LOG_FILE" | ||
"$@" | tee -a "$LOG_FILE" | ||
} | ||
|
||
# Step 1: Install COSI CRDs | ||
log_and_run echo "Installing COSI CRDs..." | ||
log_and_run kubectl create -k github.com/kubernetes-sigs/container-object-storage-interface-api | ||
log_and_run kubectl create -k github.com/kubernetes-sigs/container-object-storage-interface-controller | ||
|
||
# Step 2: Verify COSI Controller Pod Status | ||
log_and_run echo "Verifying COSI Controller Pod status..." | ||
log_and_run kubectl wait --namespace default --for=condition=ready pod -l app.kubernetes.io/name=container-object-storage-interface-controller --timeout=10s | ||
log_and_run kubectl get pods --namespace default | ||
|
||
# Step 3: Build COSI driver Docker image | ||
log_and_run echo "Building COSI driver image..." | ||
log_and_run docker build -t ghcr.io/scality/cosi:latest . | ||
|
||
# Step 4: Load COSI driver image into KIND cluster | ||
log_and_run echo "Loading COSI driver image into KIND cluster..." | ||
log_and_run kind load docker-image ghcr.io/scality/cosi:latest --name object-storage-cluster | ||
|
||
# Step 5: Run COSI driver | ||
log_and_run echo "Applying COSI driver manifests..." | ||
log_and_run kubectl apply -k . | ||
|
||
# Step 6: Verify COSI driver Pod Status | ||
log_and_run echo "Verifying COSI driver Pod status..." | ||
log_and_run kubectl wait --namespace scality-object-storage --for=condition=ready pod --selector=app.kubernetes.io/name=scality-cosi-driver --timeout=20s | ||
log_and_run kubectl get pods -n scality-object-storage | ||
|
||
log_and_run echo "COSI setup completed successfully." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,5 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
namespace: scality-cosi-driver | ||
|
||
commonAnnotations: | ||
cosi.storage.k8s.io/authors: "Kubernetes Authors" | ||
cosi.storage.k8s.io/license: "Apache V2" | ||
cosi.storage.k8s.io/support: "https://github.com/kubernetes-sigs/container-object-storage-api" | ||
|
||
commonLabels: | ||
app.kubernetes.io/part-of: container-object-storage-interface | ||
app.kubernetes.io/component: driver-scality | ||
app.kubernetes.io/version: main | ||
app.kubernetes.io/name: cosi-driver-scality | ||
|
||
configMapGenerator: | ||
- name: cosi-driver-scality-config | ||
env: resources/cosi-driver-scality.properties | ||
generatorOptions: | ||
disableNameSuffixHash: true | ||
labels: | ||
generated-by: "kustomize" | ||
|
||
resources: | ||
- resources/ns.yaml | ||
- resources/sa.yaml | ||
- resources/rbac.yaml | ||
- resources/deployment.yaml | ||
|
||
configurations: | ||
- resources/kustomizeconfig.yaml | ||
|
||
vars: | ||
- name: IMAGE_ORG | ||
objref: | ||
name: cosi-driver-scality-config | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
fieldref: | ||
fieldpath: data.OBJECTSTORAGE_PROVISIONER_IMAGE_ORG | ||
- name: IMAGE_VERSION | ||
objref: | ||
name: cosi-driver-scality-config | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
fieldref: | ||
fieldpath: data.OBJECTSTORAGE_PROVISIONER_IMAGE_VERSION | ||
- name: SCALITY_IMAGE_ORG | ||
objref: | ||
name: cosi-driver-scality-config | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
fieldref: | ||
fieldpath: data.SCALITY_DRIVER_IMAGE_ORG | ||
- name: SCALITY_IMAGE_VERSION | ||
objref: | ||
name: cosi-driver-scality-config | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
fieldref: | ||
fieldpath: data.SCALITY_DRIVER_IMAGE_VERSION | ||
- kustomize/overlays |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: scality-cosi-driver | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app.kubernetes.io/name: scality-cosi-driver | ||
template: | ||
metadata: | ||
labels: | ||
app.kubernetes.io/name: scality-cosi-driver | ||
app.kubernetes.io/part-of: container-object-storage-interface | ||
app.kubernetes.io/component: driver | ||
app.kubernetes.io/version: main | ||
app.kubernetes.io/managed-by: kustomize | ||
spec: | ||
serviceAccountName: scality-object-storage-provisioner | ||
containers: | ||
- name: scality-cosi-driver | ||
image: ghcr.io/scality/cosi:latest | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- "--driver-prefix=cosi" | ||
- "--v=$(COSI_DRIVER_LOG_LEVEL)" | ||
volumeMounts: | ||
- mountPath: /var/lib/cosi | ||
name: socket | ||
env: | ||
- name: POD_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: objectstorage-provisioner-sidecar | ||
image: gcr.io/k8s-staging-sig-storage/objectstorage-sidecar:latest | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- "--v=$(OBJECTSTORAGE_PROVISIONER_SIDECAR_LOG_LEVEL)" | ||
volumeMounts: | ||
- mountPath: /var/lib/cosi | ||
name: socket | ||
volumes: | ||
- name: socket | ||
emptyDir: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
namespace: scality-object-storage | ||
|
||
resources: | ||
- namespace.yaml | ||
- serviceaccount.yaml | ||
- rbac.yaml | ||
- deployment.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: scality-object-storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: scality-object-storage-provisioner-role | ||
rules: | ||
- apiGroups: ["objectstorage.k8s.io"] | ||
resources: ["buckets", "bucketaccesses", "bucketclaims", "bucketaccessclasses", "buckets/status", "bucketaccesses/status", "bucketclaims/status", "bucketaccessclasses/status"] | ||
verbs: ["get", "list", "watch", "update", "create", "delete"] | ||
- apiGroups: ["coordination.k8s.io"] | ||
resources: ["leases"] | ||
verbs: ["get", "watch", "list", "delete", "update", "create"] | ||
- apiGroups: [""] | ||
resources: ["secrets", "events"] | ||
verbs: ["get", "delete", "update", "create"] | ||
|
||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: scality-object-storage-provisioner-role-binding | ||
subjects: | ||
- kind: ServiceAccount | ||
name: scality-object-storage-provisioner | ||
namespace: default | ||
roleRef: | ||
kind: ClusterRole | ||
name: scality-object-storage-provisioner-role | ||
apiGroup: rbac.authorization.k8s.io |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: scality-object-storage-provisioner | ||
namespace: default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
configMapGenerator: | ||
- name: scality-cosi-driver-properties | ||
env: scality-cosi-driver.properties | ||
generatorOptions: | ||
disableNameSuffixHash: true | ||
labels: | ||
generated-by: "kustomize" | ||
|
||
resources: | ||
- ../base | ||
|
||
commonLabels: | ||
app.kubernetes.io/version: main | ||
app.kubernetes.io/component: driver | ||
app.kubernetes.io/name: scality-cosi-driver | ||
app.kubernetes.io/part-of: container-object-storage-interface | ||
app.kubernetes.io/managed-by: kustomize | ||
|
||
vars: | ||
- name: COSI_DRIVER_LOG_LEVEL | ||
objref: | ||
name: scality-cosi-driver-properties | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
fieldref: | ||
fieldpath: data.COSI_DRIVER_LOG_LEVEL | ||
|
||
- name: OBJECTSTORAGE_PROVISIONER_SIDECAR_LOG_LEVEL | ||
objref: | ||
name: scality-cosi-driver-properties | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
fieldref: | ||
fieldpath: data.OBJECTSTORAGE_PROVISIONER_SIDECAR_LOG_LEVEL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
COSI_DRIVER_LOG_LEVEL=5 | ||
OBJECTSTORAGE_PROVISIONER_SIDECAR_LOG_LEVEL=5 |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.