'Is it possible to create Noobaa bucket without creating ObjectBucketClaim(OBC)?

I am able to create noobaa bucket by creating OBC as shown below:

apiVersion: objectbucket.io/v1alpha1
kind: ObjectBucketClaim
metadata:
  name: my-obc1
spec:
  storageClassName: noobaa-test.noobaa.io
  bucketName: my-bucket
  additionalConfig: {}

Above OBC will create a noobaa bucket my-bucket. But is there any way we can create noobaa bucket directly without having to create OBC?



Solution 1:[1]

There are several ways to create buckets in noobaa other than OBC:

  1. You can use the UI - open with noobaa ui.
  2. You can use the simple command - noobaa bucket create <name>.
  3. You can use the internal API - noobaa api bucket create_bucket '{ "name": "<name>" ... }' (see here the json schema of this api params)
  4. You can use S3 - take the endpoint and credentials from noobaa status.

Thanks! Guy

Solution 2:[2]

I have had the same issue as I want to be able to create a bucket and for it to have a Tier Policy and Tier associated with it which will point it to the correct backingstore which I had already created, just like you can in the management UI but from the command line. This is what I came up with:-

#!/bin/bash
BUCKET_NAME="my_bucket"
BACKINGSTORE="my_backing_store"

NOW=$(gdate +%s)
TIER_NAME=$(printf "%s.%x" ${BUCKET_NAME} ${NOW})
TIER_POLICY_NAME=$(printf "%s.%d" ${BUCKET_NAME} 1)
noobaa -n noobaa api tier create_tier "{\"name\": \"${TIER_NAME}\", \"attached_pools\": [\"${BACKINGSTORE}\"], \"data_placement\": \"SPREAD\"}"
noobaa -n noobaa api tiering_policy create_policy "{\"name\": \"${TIER_POLICY_NAME}\", \"tiers\": [{\"order\": 1, \"tier\": \"${TIER_NAME}\"}]}"
noobaa -n noobaa api bucket create_bucket "{\"name\": \"${BUCKET_NAME}\", \"tiering\": \"${TIER_POLICY_NAME}\"}"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 guymguym
Solution 2 Grant Fribbens