Skip to content

Conversation

@kaovilai
Copy link
Owner

@kaovilai kaovilai commented Aug 12, 2025

  • Introduced Conditions field in CloudStorageStatus to track the state of the resource.
  • Updated LastSyncTimestamp description for clarity.
  • Enhanced CloudStorage CRD and CSV with new status descriptors.
  • Implemented validation logic for CloudStorage configuration in the controller.

Signed-off-by: Tiger Kaovilai tkaovila@redhat.com

Summary by CodeRabbit

  • New Features

    • CloudStorage now exposes status.conditions with standardized reconciliation states.
    • Operator UI shows Conditions, LastSyncTimestamp, and Name in CloudStorage status.
    • Provider-aware validation for AWS/Azure/GCP with clear status updates and warning events.
  • Documentation

    • Clarified LastSyncTimestamp to represent the last successful reconciliation across providers.
  • Bug Fixes

    • More reliable status reporting during reconciliation, including explicit success, error, and validation-failed reasons.

@coderabbitai
Copy link

coderabbitai bot commented Aug 12, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds Kubernetes-style Conditions to CloudStorage status, reconciliation condition constants, deepcopy and type-alias updates, CRD/CSV schema and statusDescriptor changes, and a provider-aware ValidateCloudStorage method with status-condition handling in the controller.

Changes

Cohort / File(s) Summary
API types & constants
api/v1alpha1/cloudstorage_types.go
Added CloudStorageStatus.Conditions []metav1.Condition; expanded LastSyncTimestamp comment; introduced CloudStorage reconciliation constants and message.
Deepcopy & corev1/type alias updates
api/v1alpha1/zz_generated.deepcopy.go
Switched core/v1 aliasing to corev1 and adjusted imports; migrated various fields to corev1 types and v1.Duration; added DeepCopy handling for CloudStorageStatus.Conditions; updated deepcopy logic for multiple public fields.
CRD schema changes
config/crd/bases/oadp.openshift.io_cloudstorages.yaml, bundle/manifests/oadp.openshift.io_cloudstorages.yaml
Added status.conditions array with full Condition schema (type, reason, status, lastTransitionTime, message, observedGeneration) and updated status.lastSyncTimestamp description to reconciliation semantics.
CSV / operator manifest updates
bundle/manifests/oadp-operator.clusterserviceversion.yaml, config/manifests/bases/oadp-operator.clusterserviceversion.yaml
Added Conditions statusDescriptor; updated LastSyncTimestamp descriptor text/path; added Name descriptor; refined displayName/path metadata.
Controller logic & validation
internal/controller/cloudstorage_controller.go
Added CloudStorageReconciler.ValidateCloudStorage(bucket *oadpv1alpha1.CloudStorage) error; integrated pre-validation in Reconcile; added provider-specific checks and secret verification; set status conditions via apimeta.SetStatusCondition for ValidationFailed/Error/Complete; updated status fields (Name, LastSyncTimestamp) and requeue behavior.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant K8s as API Server
  participant Ctrl as CloudStorage Controller
  participant Provider as Cloud Provider
  participant Secret as K8s Secret

  User->>K8s: Create/Update CloudStorage
  K8s-->>Ctrl: Reconcile event
  Ctrl->>Ctrl: ValidateCloudStorage(bucket)
  Ctrl->>Secret: Check required credentials (provider-specific)
  alt Validation fails
    Ctrl->>K8s: Status update: Condition Reconciled=False, Reason=ValidationFailed
    Ctrl-->>K8s: Requeue after 1m
  else Validation succeeds
    Ctrl->>Provider: Ensure bucket/container exists (create/verify)
    alt Provider error
      Ctrl->>K8s: Status update: Reconciled=False, Reason=Error
      Ctrl-->>K8s: Requeue
    else Provider success
      Ctrl->>K8s: Update status: Name, LastSyncTimestamp
      Ctrl->>K8s: Status update: Reconciled=True, Reason=Complete, Message="CloudStorage reconcile complete"
    end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

I hop through fields of code and logs,
I tidy clouds and check the cogs.
Secrets found and buckets true,
Conditions set — the job's now through.
Timestamp ticks; the bunny grins — success for me and k8s twins. 🐇☁️


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f25345d and f625fe1.

📒 Files selected for processing (3)
  • api/v1alpha1/cloudstorage_types.go (1 hunks)
  • bundle/manifests/oadp.openshift.io_cloudstorages.yaml (1 hunks)
  • config/crd/bases/oadp.openshift.io_cloudstorages.yaml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
bundle/manifests/oadp.openshift.io_cloudstorages.yaml

[error] 143-143: wrong indentation: expected 24 but found 22

(indentation)


[error] 153-153: wrong indentation: expected 20 but found 18

(indentation)


[error] 161-161: wrong indentation: expected 18 but found 16

(indentation)

config/crd/bases/oadp.openshift.io_cloudstorages.yaml

[error] 143-143: wrong indentation: expected 24 but found 22

(indentation)


[error] 153-153: wrong indentation: expected 20 but found 18

(indentation)


[error] 161-161: wrong indentation: expected 18 but found 16

(indentation)

🔇 Additional comments (3)
api/v1alpha1/cloudstorage_types.go (3)

63-67: Docs improvement for LastSyncTimestamp looks good

The expanded comment clarifies reconciliation semantics across providers and aligns with the CRD/CSV descriptions.


68-72: Conditions field correctly modeled with metav1.Condition and list semantics

Good use of metav1.Condition plus +listType=map and +listMapKey=type for SSA-friendly updates. This will prevent duplicate condition entries and enable proper merging.


75-87: Condition and reason constants are clear and align with Kubernetes conventions

The type "Reconciled" with CamelCase reasons (Complete, Error, ValidationFailed) reads well. Keep reasons specific and stable to aid UIs and automation. No changes needed.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch OADP-3307+validation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @kaovilai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the CloudStorage API by introducing a robust conditions framework and comprehensive validation logic. The primary goal is to provide clearer insights into the state of CloudStorage resources and to prevent misconfigurations before they lead to reconciliation failures. This involves adding a new 'Conditions' field to the CloudStorage status, refining the description of the 'LastSyncTimestamp', and implementing detailed validation checks for various cloud providers (AWS, Azure, GCP) directly within the controller's reconciliation loop.

Highlights

  • Enhanced CloudStorageStatus with Conditions: The CloudStorageStatus struct now includes a 'Conditions' field, allowing for more detailed and standardized reporting of the resource's state, such as reconciliation status and validation outcomes.
  • Improved LastSyncTimestamp Clarity: The description for the 'LastSyncTimestamp' field has been clarified to precisely explain when this timestamp is updated, specifically after successful reconciliation or bucket creation/verification.
  • CRD and CSV Updates for CloudStorage: The Custom Resource Definition (CRD) and ClusterServiceVersion (CSV) for CloudStorage have been updated to reflect the new 'Conditions' field and the refined 'LastSyncTimestamp' description, ensuring consistency across API definitions and operator metadata.
  • Introduced CloudStorage Configuration Validation: New validation logic has been implemented within the CloudStorage controller. This logic performs pre-reconciliation checks, ensuring that CloudStorage configurations are valid, including specific requirements for AWS (region, credentials), Azure (container name, credentials), and GCP (credentials).
  • DeepCopy Logic and Import Alias Standardization: The auto-generated deepcopy file has been updated to correctly handle the new 'Conditions' field and to standardize the use of 'corev1' and 'v1' aliases for Kubernetes API types, maintaining code integrity and compatibility.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces important enhancements to the CloudStorage API, adding status conditions and validation logic. The changes are generally well-implemented. My review focuses on improving error handling, context propagation, and fixing a few issues in the new validation logic, including a redundancy and an inconsistency in the Azure provider validation.

Comment on lines +362 to +386
// Check for required fields based on authentication method
hasStorageAccount := false
if _, ok := secret.Data["AZURE_STORAGE_ACCOUNT_NAME"]; ok {
hasStorageAccount = true
}
if _, ok := secret.Data["storageAccount"]; ok {
hasStorageAccount = true
}
if !hasStorageAccount {
// Check if it's in the azurekey field (STS format)
if azureKey, ok := secret.Data["azurekey"]; ok {
keyStr := string(azureKey)
if !strings.Contains(keyStr, "AZURE_STORAGE_ACCOUNT") {
return fmt.Errorf("Azure credentials must specify storage account name")
}
} else {
return fmt.Errorf("Azure credentials must specify storage account name")
}
}

Choose a reason for hiding this comment

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

high

The validation logic for Azure credentials seems inconsistent with the implementation logic used elsewhere for retrieving the storage account name.

Specifically:

  • This validation checks for AZURE_STORAGE_ACCOUNT_NAME (line 364) and storageAccount (line 367) within the secret data.
  • However, the implementation in pkg/bucket/azure.go (getStorageAccountName function) looks for AZURE_STORAGE_ACCOUNT in the secret data, and storageAccount in the bucket.Spec.Config map, not the secret.

This discrepancy can lead to validation passing for configurations that will fail at runtime, or failing for valid configurations. The validation logic should be aligned with the implementation.

}

// ValidateCloudStorage validates the CloudStorage configuration based on the provider
func (b *CloudStorageReconciler) ValidateCloudStorage(bucket *oadpv1alpha1.CloudStorage) error {

Choose a reason for hiding this comment

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

medium

The ValidateCloudStorage function should accept a context.Context from the Reconcile function instead of using context.Background(). This ensures that API calls within this function respect the parent context's lifecycle, including cancellation and deadlines.

You should update the function signature and then use the passed context in all b.Client.Get calls within this function (lines 326, 352, 387). The call at line 79 should also be updated to pass the context.

func (b *CloudStorageReconciler) ValidateCloudStorage(ctx context.Context, bucket *oadpv1alpha1.CloudStorage) error {

Comment on lines +346 to +354
if bucket.Spec.Name == "" {
return fmt.Errorf("Azure provider requires container name to be specified")
}

Choose a reason for hiding this comment

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

medium

This check for bucket.Spec.Name is redundant. It is already checked for all providers on line 312 before the switch statement. This block can be removed.

- Introduced Conditions field in CloudStorageStatus to track the state of the resource.
- Updated LastSyncTimestamp description for clarity.
- Enhanced CloudStorage CRD and CSV with new status descriptors.
- Implemented validation logic for CloudStorage configuration in the controller.

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@kaovilai kaovilai force-pushed the OADP-3307+validation branch from 0128efa to f25345d Compare August 12, 2025 17:25
@kaovilai
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Aug 12, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 6

♻️ Duplicate comments (4)
internal/controller/cloudstorage_controller.go (4)

368-386: Verify Azure credential field consistency

The validation checks for AZURE_STORAGE_ACCOUNT_NAME and storageAccount in the secret data, but the implementation in pkg/bucket/azure.go may look for different field names. This could lead to validation passing for configurations that fail at runtime.

Run the following script to verify the Azure credential field usage:

#!/bin/bash
# Description: Verify the Azure credential field names used in the implementation

# Search for Azure storage account field usage in the bucket package
echo "=== Searching for Azure storage account field usage ==="
rg -A 5 "AZURE_STORAGE_ACCOUNT" pkg/bucket/

# Look for getStorageAccountName function implementation
echo -e "\n=== Searching for getStorageAccountName function ==="
ast-grep --pattern 'func getStorageAccountName($$$) {
  $$$
}'

165-176: Consider handling status update errors more gracefully

The status update failures are logged but the reconciliation continues. While this is generally acceptable, consider whether these failures should trigger a requeue to ensure status consistency.

Also applies to: 181-192, 200-211


311-311: ValidateCloudStorage should accept context.Context from Reconcile

The function currently uses context.Background() which doesn't respect the parent context's lifecycle. This could lead to validation continuing even after the reconciliation has been cancelled.

Apply this diff to fix the context usage:

-func (b *CloudStorageReconciler) ValidateCloudStorage(bucket *oadpv1alpha1.CloudStorage) error {
+func (b *CloudStorageReconciler) ValidateCloudStorage(ctx context.Context, bucket *oadpv1alpha1.CloudStorage) error {

And update all context.Background() calls within this function to use the passed ctx parameter (lines 332, 358, 393).

Also update the call site at line 79:

-	if err := b.ValidateCloudStorage(&bucket); err != nil {
+	if err := b.ValidateCloudStorage(ctx, &bucket); err != nil {

352-354: Remove redundant bucket name check

This check for bucket.Spec.Name is redundant as it's already validated for all providers at line 318.

Apply this diff to remove the redundant check:

-		if bucket.Spec.Name == "" {
-			return fmt.Errorf("Azure provider requires container name to be specified")
-		}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dcffc06 and f25345d.

📒 Files selected for processing (7)
  • api/v1alpha1/cloudstorage_types.go (1 hunks)
  • api/v1alpha1/zz_generated.deepcopy.go (9 hunks)
  • bundle/manifests/oadp-operator.clusterserviceversion.yaml (1 hunks)
  • bundle/manifests/oadp.openshift.io_cloudstorages.yaml (1 hunks)
  • config/crd/bases/oadp.openshift.io_cloudstorages.yaml (1 hunks)
  • config/manifests/bases/oadp-operator.clusterserviceversion.yaml (1 hunks)
  • internal/controller/cloudstorage_controller.go (5 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
internal/controller/cloudstorage_controller.go (1)
api/v1alpha1/cloudstorage_types.go (9)
  • ConditionCloudStorageReconciled (76-76)
  • CloudStorageReconciledReasonValidationFailed (82-82)
  • CloudStorageReconciledReasonError (80-80)
  • CloudStorageReconciledReasonComplete (78-78)
  • CloudStorageReconcileCompleteMessage (84-84)
  • CloudStorage (91-97)
  • AWSBucketProvider (27-27)
  • AzureBucketProvider (28-28)
  • GCPBucketProvider (29-29)
api/v1alpha1/zz_generated.deepcopy.go (1)
api/v1alpha1/dataprotectionapplication_types.go (1)
  • StorageType (597-601)
🪛 golangci-lint (2.2.2)
internal/controller/cloudstorage_controller.go

[error] 217-217: File is not properly formatted

(gci)

🪛 YAMLlint (1.37.1)
bundle/manifests/oadp.openshift.io_cloudstorages.yaml

[error] 143-143: wrong indentation: expected 24 but found 22

(indentation)


[error] 153-153: wrong indentation: expected 20 but found 18

(indentation)

config/manifests/bases/oadp-operator.clusterserviceversion.yaml

[error] 406-406: wrong indentation: expected 8 but found 6

(indentation)

bundle/manifests/oadp-operator.clusterserviceversion.yaml

[error] 397-397: wrong indentation: expected 8 but found 6

(indentation)

config/crd/bases/oadp.openshift.io_cloudstorages.yaml

[error] 143-143: wrong indentation: expected 24 but found 22

(indentation)


[error] 153-153: wrong indentation: expected 20 but found 18

(indentation)

🔇 Additional comments (16)
bundle/manifests/oadp-operator.clusterserviceversion.yaml (1)

401-404: LGTM! Clear and comprehensive LastSyncTimestamp description

The updated description clearly explains when the timestamp is updated and its applicability across all supported cloud providers (AWS, Azure, GCP). This provides better clarity for users compared to the previous generic description.

api/v1alpha1/cloudstorage_types.go (3)

63-65: LGTM! Well-documented LastSyncTimestamp field

The expanded documentation clearly explains the reconciliation-based timing semantics and provider applicability.


68-70: LGTM! Standard Kubernetes conditions pattern

The addition of the Conditions field follows Kubernetes best practices for status reporting, providing a standardized way to track the CloudStorage resource state.


73-85: LGTM! Well-structured condition constants

The condition constants follow Kubernetes naming conventions and provide clear semantic meaning for different reconciliation states.

internal/controller/cloudstorage_controller.go (1)

79-94: LGTM! Proper validation flow with status updates

The validation logic is well-integrated with proper error handling, status condition updates, and event recording. The 1-minute requeue allows for recovery from transient issues.

bundle/manifests/oadp.openshift.io_cloudstorages.yaml (1)

102-159: LGTM! Well-structured Conditions field following Kubernetes API conventions

The Conditions field is properly defined with all required fields and appropriate validation constraints, following the standard Kubernetes API pattern for status conditions.

config/crd/bases/oadp.openshift.io_cloudstorages.yaml (1)

161-165: LastSyncTimestamp is only set on successful reconciliation
I’ve reviewed internal/controller/cloudstorage_controller.go and confirmed that:

  • In all error paths (validation failure, bucket creation or existence errors), the controller updates status conditions to False without touching Status.LastSynced.
  • The only bucket.Status.LastSynced = … call occurs immediately before setting the success condition (ConditionCloudStorageReconciled = True) and updating status.

No code path updates LastSyncTimestamp on failure, so the behavior matches the CRD description.

api/v1alpha1/zz_generated.deepcopy.go (9)

27-29: Import aliasing looks correct and unambiguous

Using corev1 for k8s.io/api/core/v1 and v1 for k8s.io/apimachinery/pkg/apis/meta/v1 avoids collisions and keeps references clear in this generated file.


199-205: DeepCopy updates for CloudStorageLocation types are correct

Switching Credential to corev1.SecretKeySelector and BackupSyncPeriod to v1.Duration aligns with the aliasing change and preserves type correctness.


266-272: DeepCopy for CloudStorageStatus.Conditions is implemented correctly

Allocates a new slice and deep-copies each metav1.Condition element. This is the correct pattern to avoid aliasing of slice elements.


460-462: ImagePullPolicy alias update is consistent

Using corev1.PullPolicy maintains clarity with the new import aliasing and doesn’t change semantics.


485-489: DataProtectionApplicationStatus.Conditions deepcopy remains correct with new alias

Conditions slice is deep-copied element-wise as expected.


630-644: EnforceBackupStorageLocationSpec alias/type adjustments are sound

Credential and Duration pointers switched to corev1 and v1 types respectively; deepcopy semantics preserved.


851-858: NodeAgentConfig Duration fields use the correct metav1 alias

DataMoverPrepareTimeout and ResourceTimeout now use v1.Duration with proper deep copy. Looks good.


951-958: NonAdmin Duration fields aliasing is correct

GarbageCollectionPeriod and BackupSyncPeriod now reference v1.Duration consistently.


1011-1021: PodConfig Env and Tolerations alias changes are correct

Switching to corev1.Toleration and corev1.EnvVar with deep copy per element matches Kubernetes API expectations.

Comment on lines +397 to +400
- description: Conditions represent the latest available observations of the
CloudStorage's state.
displayName: Conditions
path: conditions
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Fix YAML indentation for consistency

The indentation for the new status descriptors is inconsistent with the rest of the file. Status descriptors should be indented with 8 spaces.

Apply this diff to fix the indentation:

-      - description: Conditions represent the latest available observations of the
-          CloudStorage's state.
-        displayName: Conditions
-        path: conditions
+        - description: Conditions represent the latest available observations of the
+            CloudStorage's state.
+          displayName: Conditions
+          path: conditions
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- description: Conditions represent the latest available observations of the
CloudStorage's state.
displayName: Conditions
path: conditions
- description: Conditions represent the latest available observations of the
CloudStorage's state.
displayName: Conditions
path: conditions
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 397-397: wrong indentation: expected 8 but found 6

(indentation)

🤖 Prompt for AI Agents
In bundle/manifests/oadp-operator.clusterserviceversion.yaml around lines 397 to
400, the three status descriptor lines ("description: Conditions...",
"displayName: Conditions", "path: conditions") are indented inconsistently;
re-indent each of these lines to use 8 spaces (matching the other
statusDescriptors entries) so they align with the rest of the file's status
descriptor block and preserve YAML structure.

status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Fix YAML indentation for enum values

The indentation for the enum values is inconsistent with Kubernetes CRD conventions.

Apply this diff to fix the indentation:

                      enum:
-                      - "True"
-                      - "False"
-                      - Unknown
+                        - "True"
+                        - "False"
+                        - Unknown

And for the required fields:

-                  required:
-                  - lastTransitionTime
-                  - message
-                  - reason
-                  - status
-                  - type
+                    required:
+                      - lastTransitionTime
+                      - message
+                      - reason
+                      - status
+                      - type

Also applies to: 153-153

🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 143-143: wrong indentation: expected 24 but found 22

(indentation)

🤖 Prompt for AI Agents
In bundle/manifests/oadp.openshift.io_cloudstorages.yaml around lines 143 and
153, the enum value lines are over-indented and not aligned with Kubernetes CRD
conventions; update the indentation so enum entries are nested under the "enum:"
key (two spaces deeper than the key) rather than aligned with it, and likewise
fix the "required:" list indentation so each required field is listed under the
"required:" key with proper list dash indentation; ensure YAML spacing matches
surrounding schema entries to restore valid CRD formatting.

Comment on lines +141 to +159
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix YAML indentation (YAMLlint errors) and normalize enum quoting

YAMLlint flagged indentation issues at Line 143 and Line 153. Also, enum values for status should be consistently quoted. Correct both indentation and quoting to avoid schema validation issues.

Apply this diff to fix indentation and quoting:

-          enum:
-          - "True"
-          - "False"
-          - Unknown
+          enum:
+            - "True"
+            - "False"
+            - "Unknown"

...
-        required:
-        - lastTransitionTime
-        - message
-        - reason
-        - status
-        - type
+        required:
+          - lastTransitionTime
+          - message
+          - reason
+          - status
+          - type
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- "Unknown"
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 143-143: wrong indentation: expected 24 but found 22

(indentation)


[error] 153-153: wrong indentation: expected 20 but found 18

(indentation)

🤖 Prompt for AI Agents
In config/crd/bases/oadp.openshift.io_cloudstorages.yaml around lines 141-159,
the YAML has incorrect indentation for the enum block and inconsistent quoting
for the status enum values; fix by aligning the enum list items under the enum
key with two additional spaces (so they are nested under description->enum) and
ensure all enum scalar values are consistently quoted (e.g., "True", "False",
"Unknown"); keep the surrounding keys (type, description, pattern, maxLength)
indentation intact and validate with yamllint after change.

Comment on lines +406 to +409
- description: Conditions represent the latest available observations of the
CloudStorage's state.
displayName: Conditions
path: conditions
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Fix YAML indentation inconsistency

The indentation is inconsistent with the rest of the file. Status descriptors should be indented with 8 spaces.

Apply this diff to fix the indentation:

-      - description: Conditions represent the latest available observations of the
-          CloudStorage's state.
-        displayName: Conditions
-        path: conditions
+        - description: Conditions represent the latest available observations of the
+            CloudStorage's state.
+          displayName: Conditions
+          path: conditions
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- description: Conditions represent the latest available observations of the
CloudStorage's state.
displayName: Conditions
path: conditions
- description: Conditions represent the latest available observations of the
CloudStorage's state.
displayName: Conditions
path: conditions
🧰 Tools
🪛 YAMLlint (1.37.1)

[error] 406-406: wrong indentation: expected 8 but found 6

(indentation)

🤖 Prompt for AI Agents
In config/manifests/bases/oadp-operator.clusterserviceversion.yaml around lines
406 to 409, the "description"/"displayName"/"path" block is indented
incorrectly; align the status descriptor lines to 8 spaces (match the rest of
the file) by adjusting their indentation so each of those keys is preceded by
two additional spaces (total 8) to be consistent with other status descriptors.

// Update status with updated value
bucket.Status.LastSynced = &metav1.Time{Time: time.Now()}
bucket.Status.Name = bucket.Spec.Name

Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Remove trailing whitespace

There's trailing whitespace on this line that should be removed.

Apply this diff to remove the trailing whitespace:

-	
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
🧰 Tools
🪛 golangci-lint (2.2.2)

[error] 217-217: File is not properly formatted

(gci)

🤖 Prompt for AI Agents
In internal/controller/cloudstorage_controller.go around line 217, there is a
trailing whitespace character at the end of the line; remove the trailing space
so the line ends cleanly (no extra spaces or tabs) and save the file, then run
gofmt or your editor's trim-trailing-whitespace action to ensure no other lines
have trailing whitespace.

…onditions

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
@kaovilai
Copy link
Owner Author

https://github.com/coderabbitai review

@kaovilai
Copy link
Owner Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Aug 12, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

2 participants