Skip to content

Conversation

@labuladong
Copy link
Member

@labuladong labuladong commented Oct 22, 2025

broker:
  replicaCount: 1
  component: broker
  authorizationPolicy: null  # Explicitly set to null

Explicitly set to null will cause NPE.

@labuladong labuladong requested review from a team as code owners October 22, 2025 08:15
Copilot AI review requested due to automatic review settings October 22, 2025 08:15
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds nil pointer safety checks to authorization policy templates across multiple Helm charts by verifying that the parent authorizationPolicy object exists before accessing its child properties (from and to).

Key Changes:

  • Added parent object existence checks using and operator in conditional statements
  • Applied consistently across zookeeper, broker, bookkeeper, and autorecovery authorization policy templates
  • Prevents template rendering errors when authorizationPolicy is nil/undefined

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
charts/sn-platform/templates/zookeeper/zookeeper-authorizationpolicy.yaml Added nil checks for zookeeper.authorizationPolicy before accessing .from and .to
charts/sn-platform/templates/broker/broker-authorizationpolicy.yaml Added nil checks for broker.authorizationPolicy before accessing .from and .to
charts/sn-platform/templates/bookkeeper/bookkeeper-authorizationpolicy.yaml Added nil checks for bookkeeper.authorizationPolicy and autorecovery.authorizationPolicy before accessing .from and .to
charts/sn-platform-slim/templates/zookeeper/zookeeper-authorizationpolicy.yaml Added nil checks for zookeeper.authorizationPolicy before accessing .from and .to
charts/sn-platform-slim/templates/broker/broker-authorizationpolicy.yaml Added nil checks for broker.authorizationPolicy before accessing .from and .to
charts/sn-platform-slim/templates/bookkeeper/bookkeeper-authorizationpolicy.yaml Added nil checks for bookkeeper.authorizationPolicy and autorecovery.authorizationPolicy before accessing .from and .to

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions
Copy link

@labuladong:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions github-actions bot added the doc-info-missing This pr needs to mark a document option in description label Oct 22, 2025
@labuladong labuladong merged commit 41d531d into master Oct 22, 2025
4 checks passed
@labuladong labuladong deleted the donglai/improve/authorization-policy-nil branch October 22, 2025 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-info-missing This pr needs to mark a document option in description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants