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

COSI 74, COSI 75: Brownfield use case (re-use existing S3 buckets in Kube) #68

Merged
merged 4 commits into from
Dec 20, 2024

Conversation

anurag4DSB
Copy link
Collaborator

@anurag4DSB anurag4DSB commented Dec 18, 2024

Brownfield use case.

Commit # 1: remove silent success if the user already owns the bucket - this is a brownfield case
Commit # 2: Add CRs (custom resources yaml files) for the brownfield use case.
Commit # 3: Added e2e tests for brownfield use case
Commit # 4: Reorganized greenfield CRs in a greenfield folder

Note to reviewers: It is intentional that brownfield CRs are in the same namespace as cosi driver as the sidecar in the cosi driver pod(controlled by CNCF) needs to patch events and that cannot be done cross namespace Reference

Code reference from k8s

if e.GetNamespace() != "" && event.Namespace != e.GetNamespace() {
		return nil, fmt.Errorf("can't patch an event with namespace '%v' in namespace '%v'", event.Namespace, e.GetNamespace())
	}

Documentation coming soon
Context for branch name: It started with a bug fix, but we ended up understanding how brownfield case works.

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.40%. Comparing base (52e13ca) to head (a3e7337).
Report is 5 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

Files with missing lines Coverage Δ
pkg/driver/provisioner_server_impl.go 97.64% <ø> (-0.06%) ⬇️
Components Coverage Δ
🏠 Main Package ∅ <ø> (∅)
🚗 Driver Package 92.22% <ø> (-0.17%) ⬇️
📡 gRPC Factory Package 81.65% <ø> (ø)
🔐 IAM Client Package 100.00% <ø> (ø)
🌐 S3 Client Package 100.00% <ø> (ø)
🔧 Util Package 100.00% <ø> (ø)
🔖 Constants Package ∅ <ø> (∅)
@@            Coverage Diff             @@
##             main      #68      +/-   ##
==========================================
- Coverage   93.46%   93.40%   -0.07%     
==========================================
  Files           9        9              
  Lines         643      637       -6     
==========================================
- Hits          601      595       -6     
  Misses         36       36              
  Partials        6        6              

@anurag4DSB anurag4DSB force-pushed the bugfix/COSI-74-remove-silent-errors branch 2 times, most recently from 7b39705 to 3b66088 Compare December 18, 2024 11:25
@anurag4DSB anurag4DSB force-pushed the improvement/COSI-35-update-logging-mechanism branch from e8481a9 to 535757d Compare December 18, 2024 11:35
Base automatically changed from improvement/COSI-35-update-logging-mechanism to main December 18, 2024 11:42
If the bucket already exists, users should add them through brownfield
workflow. It is not expected in COSI specs to silently pass if bucket
already owned by the IAM user or account used for create bucket request.
@anurag4DSB anurag4DSB force-pushed the bugfix/COSI-74-remove-silent-errors branch from 3b66088 to 4d96040 Compare December 18, 2024 11:43
@anurag4DSB anurag4DSB changed the title Add brownfield use case COSI 74, COSI 75: Brownfield use case (re-use existing S3 buckets in Kube) Dec 18, 2024
@anurag4DSB anurag4DSB marked this pull request as ready for review December 18, 2024 12:03
log_and_run kubectl delete -f cosi-examples/bucketclass-delete-on-claim-removal.yaml || { echo "Bucket Class not found." | tee -a "$LOG_FILE"; }
log_and_run kubectl delete -f cosi-examples/greenfield/bucketclass.yaml || { echo "Bucket Class not found." | tee -a "$LOG_FILE"; }
log_and_run kubectl delete -f cosi-examples/greenfield/bucketclaim.yaml || { echo "Bucket Claim not found." | tee -a "$LOG_FILE"; }
log_and_run kubectl delete -f cosi-examples/greenfield/bucketclass-deletion-policy.yaml || { echo "Bucket Class not found." | tee -a "$LOG_FILE"; }
Copy link
Collaborator Author

@anurag4DSB anurag4DSB Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this line the name and directory was changed.
This check-in went unchecked in an older PR with the old name of the yaml file

@fredmnl fredmnl self-requested a review December 19, 2024 09:15
Copy link

@fredmnl fredmnl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll recap to verify that I'm understanding everything correctly:

  • brownfield means that you were already using a bucket for an application before the introduction of cosi. Therefore, you will need to import this existing bucket into cosi.
  • you removed the BucketIsAlreadyOwnedByYou case since now there is an actual path for brownfield. In other words, we now know that BucketIsAlreadyOwnedByYou is not the legit path for the brownfield use case.

log_and_run echo "Protocols mismatch! Expected: $EXPECTED_PROTOCOLS, Found: $ACTUAL_PROTOCOLS"
exit 1
fi

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could perform some action on the bucket since we have everything we need at this stage, even just a HeadBucket or ListObjects, if that's not too complicated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a test in the lastest review commit

@anurag4DSB
Copy link
Collaborator Author

Ok, I'll recap to verify that I'm understanding everything correctly:

  • brownfield means that you were already using a bucket for an application before the introduction of cosi. Therefore, you will need to import this existing bucket into cosi.
  • you removed the BucketIsAlreadyOwnedByYou case since now there is an actual path for brownfield. In other words, we now know that BucketIsAlreadyOwnedByYou is not the legit path for the brownfield use case.

100% accurate.

@anurag4DSB anurag4DSB force-pushed the bugfix/COSI-74-remove-silent-errors branch from 89e0dfc to a3e7337 Compare December 20, 2024 13:19
@anurag4DSB anurag4DSB merged commit a9cf51d into main Dec 20, 2024
8 checks passed
@anurag4DSB anurag4DSB deleted the bugfix/COSI-74-remove-silent-errors branch December 20, 2024 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants