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

fix: added missing grant to auth ids api for user notification #16680

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

brynjarorng
Copy link
Member

@brynjarorng brynjarorng commented Oct 31, 2024

Fix

Adding missing grant NS to auth ids api for user notification worker

Summary by CodeRabbit

  • New Features

    • Enhanced authorization capabilities with the addition of user-notification namespace across multiple services.
    • Health check configurations updated for improved service monitoring.
  • Improvements

    • Increased resource allocations for the identity-server and related services to better handle expected loads.
    • Adjusted scaling strategies with updated Horizontal Pod Autoscaler settings.
  • Configuration Changes

    • Updated ingress settings to optimize traffic management and routing.

@brynjarorng brynjarorng requested a review from a team as a code owner October 31, 2024 13:58
Copy link
Contributor

coderabbitai bot commented Oct 31, 2024

Walkthrough

The pull request introduces modifications across several configuration files related to the identity-server and services-auth-ids-api. Key changes include the addition of the user-notification namespace in the grantNamespaces settings and enabling the grantNamespacesEnabled flag. Health check paths and ports have been updated, and resource limits for CPU and memory have been significantly increased. The horizontal pod autoscaler (HPA) settings have also been adjusted, reflecting a shift in scaling strategy across the services.

Changes

File Path Change Summary
apps/services/auth/ids-api/infra/ids-api.ts Updated serviceSetup function to include .grantNamespaces("user-notification").
charts/identity-server/values.dev.yaml - Added grantNamespaces: ['user-notification'] and set grantNamespacesEnabled: true for identity-server and services-auth-ids-api.
- Updated healthCheck port to 5010 and added readiness path.
- Adjusted HPA settings: max replicas from 10 to 3, min from 2 to 1.
- Increased CPU limit from 400m to 4000m and memory limit from 256Mi to 2048Mi.
- Modified ingress proxy-buffer-size to 8k and removed nginx.ingress.kubernetes.io/proxy-buffers-number annotation.
- Added serviceAccount with IAM role ARN.
charts/identity-server/values.prod.yaml - Similar updates as values.dev.yaml for identity-server, services-auth-ids-api, and services-auth-ids-api-cleanup.
- Adjusted health check path and port.
- Increased CPU and memory limits for identity-server.
- Changed ingress path from /admin to /.
charts/identity-server/values.staging.yaml - Included user-notification in grantNamespaces and set grantNamespacesEnabled: true for multiple services.
- Updated health check readiness path to /readiness and port to 5010.
- Adjusted HPA settings for identity-server and services-auth-ids-api.
- Increased resource limits for identity-server and services-auth-ids-api.
- Modified ingress configurations.

Possibly related PRs

Suggested labels

deploy-feature

Suggested reviewers

  • thorkellmani
  • eirikurn
  • svanaeinars
  • lodmfjord

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

Documentation and Community

  • 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
Member

@AndesKrrrrrrrrrrr AndesKrrrrrrrrrrr left a comment

Choose a reason for hiding this comment

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

Changes are OK 👍

@brynjarorng brynjarorng added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Oct 31, 2024
Copy link
Contributor

@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: 0

🧹 Outside diff range and nitpick comments (2)
charts/identity-server/values.staging.yaml (1)

431-433: Consider documenting namespace access requirements.

Multiple services have been granted access to the user-notification namespace. Consider adding documentation explaining the purpose and scope of these permissions.

Add a comment above each grantNamespaces section explaining why the service needs access to user-notification:

  services-auth-ids-api:
+   # Requires user-notification namespace access for sending user notifications
    grantNamespaces:
      - 'user-notification'

Also applies to: 534-536

charts/identity-server/values.dev.yaml (1)

534-536: LGTM - Consistent permissions for cleanup job.

The cleanup job requires the same namespace grants as the main service to ensure proper access during maintenance operations. This maintains security consistency across the service and its supporting jobs.

Consider documenting the relationship between the main service and cleanup job's permissions in the service documentation to help future maintainers understand why both components need the same grants.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 72d681b and b0cf8fc.

📒 Files selected for processing (4)
  • apps/services/auth/ids-api/infra/ids-api.ts (1 hunks)
  • charts/identity-server/values.dev.yaml (3 hunks)
  • charts/identity-server/values.prod.yaml (3 hunks)
  • charts/identity-server/values.staging.yaml (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/services/auth/ids-api/infra/ids-api.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
🔇 Additional comments (10)
apps/services/auth/ids-api/infra/ids-api.ts (2)

Line range hint 91-102: Verify resource limits for production workload.

The service configuration specifies relatively high resource limits and implements horizontal scaling. Let's verify if these settings align with actual usage patterns:

  • CPU limits: 800m with 400m requests
  • Memory limits: 768Mi with 512Mi requests
  • Replica count: 2-15 pods
#!/bin/bash
# Description: Search for HPA metrics or monitoring configurations
# Expected: Find evidence of resource utilization patterns

# Look for monitoring configurations or metrics collection
rg -A 5 "metrics|monitoring|prometheus" "apps/services/auth/ids-api/**/*"

125-125: LGTM: Grant namespace addition aligns with PR objectives.

The addition of "user-notification" to grantNamespaces is consistent with the PR's purpose of fixing missing authorization grants for the user notification feature.

Let's verify the grant namespace configuration across environments:

✅ Verification successful

Verified: The user-notification namespace grant is correctly configured across environments

The search results confirm that:

  1. The user-notification namespace grant is correctly added in the IDS API infrastructure code
  2. The grant is also properly configured in the identity server values files across dev, staging, and prod environments
  3. The namespace is consistently used in related services that interact with user notifications
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify grant namespace configuration in identity server values
# Expected: user-notification should be present in grantNamespaces for all environments

# Check values files for grantNamespaces configuration
rg -A 5 "grantNamespaces.*user-notification" "charts/identity-server/values*.yaml"

Length of output: 241


Script:

#!/bin/bash
# Let's try a broader search to find relevant files and configurations
# First, let's find all files related to identity server or auth configuration
fd -t f "values.*\.ya?ml" -X rg -l "grantNamespaces"

# Then let's check the actual content of these files
fd -t f "values.*\.ya?ml" -X rg -C 5 "grantNamespaces"

# Also search in the infrastructure code
rg -C 5 "grantNamespaces" "apps/services/auth/"

Length of output: 156494

charts/identity-server/values.prod.yaml (3)

428-430: LGTM! Consistent namespace grant configuration.

The namespace grant configuration for services-auth-ids-api matches the identity-server configuration, maintaining consistency across services.


531-533: LGTM! Cleanup job has consistent namespace grants.

The namespace grant configuration for the cleanup job maintains consistency with related services, ensuring proper access for scheduled maintenance tasks.


124-126: LGTM! Verify user-notification namespace exists.

The addition of user-notification namespace and enabling grants is aligned with the PR objectives.

✅ Verification successful

✅ Namespace configuration verified and properly defined

The 'user-notification' namespace is properly defined across all environments (dev, staging, and prod) in the islandis charts, with consistent configuration including security context and pod disruption budgets. The grant access being added in identity-server is therefore valid and secure.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the user-notification namespace exists in the cluster
# Expected: The namespace should be listed in the output

# Search for user-notification namespace definition
rg -l "namespace: 'user-notification'"

Length of output: 147


Script:

#!/bin/bash
# Let's verify the content of these files to ensure proper namespace configuration
rg -A 5 "namespace: 'user-notification'" charts/islandis/values.*.yaml

Length of output: 3161

charts/identity-server/values.staging.yaml (3)

431-433: Configuration is consistent with identity-server settings.

The same namespace configuration is applied to services-auth-ids-api, maintaining consistency across related services.


534-536: Verify cleanup job's namespace requirements.

The cleanup job also includes user-notification namespace access. While this maintains consistency, verify if the cleanup job actually requires this access.

#!/bin/bash
# Description: Check if cleanup job interacts with user-notification service
# Test: Search for user-notification related operations in cleanup job
rg -A 5 "cleanup.*user-notification|user-notification.*cleanup"

126-128: Verify user-notification namespace access requirements.

The addition of 'user-notification' namespace and enabling grantNamespaces suggests new integration with user notification service. This change aligns with the PR objective of fixing auth ids api for user notification.

✅ Verification successful

Let me gather more information about the user-notification service configuration.


Configuration for user-notification namespace is properly aligned across environments

The addition of 'user-notification' namespace and enabling grantNamespaces is verified to be consistent with the service's requirements:

  • The user-notification service uses OAuth2 authentication with proper scopes (openid, profile, documents)
  • The configuration is consistently applied across dev, staging, and prod environments
  • The service has proper auth delegation API integration configured
  • The identity server has the required USER_NOTIFICATION_API_URL environment variable set for all environments
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the user-notification service configuration and dependencies
# Test: Check for user-notification related configurations and service dependencies
rg -A 5 "USER_NOTIFICATION" 

Length of output: 2796


Script:

#!/bin/bash
# Check for user-notification service configuration in identity-server values
rg -A 5 "user-notification" charts/identity-server/

# Check for any auth or permission related configurations in user-notification service
rg -A 5 "auth|permission" apps/services/user-notification/

Length of output: 27166

charts/identity-server/values.dev.yaml (2)

431-433: LGTM - Grant configuration aligns with requirements.

The addition of user-notification namespace grant to services-auth-ids-api is correct and matches the PR objectives.


126-128: Verify namespace grant configuration consistency.

The addition of 'user-notification' namespace grant is aligned with the PR objectives. However, let's ensure this configuration is consistent across related services.

✅ Verification successful

Configuration is consistent across environments

The 'user-notification' namespace grant is consistently configured across all environments (dev, staging, prod) in the identity-server chart, with grantNamespacesEnabled set to true. The configuration is also properly reflected in related services that need access to the user-notification namespace.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if user-notification namespace grant is consistently configured
# across related services in the development environment

# Search for grantNamespaces configurations
echo "Checking grantNamespaces configurations:"
rg -A 5 "grantNamespaces:" charts/

Length of output: 53523

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 31, 2024

Datadog Report

All test runs 4f233bb 🔗

2 Total Test Services: 0 Failed, 1 Passed
➡️ Test Sessions change in coverage: 21 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
service-portal-core 0 0 0 5 0 1.77s N/A Link
service-portal-health 0 0 0 0 0 482.49ms 1 no change Link

@brynjarorng brynjarorng added the high priority VIP-Kodiak PR label Oct 31, 2024
@kodiakhq kodiakhq bot merged commit f0dd1e4 into main Oct 31, 2024
35 checks passed
@kodiakhq kodiakhq bot deleted the fix-user-notification-allow-grant-auth-ids-api branch October 31, 2024 15:13
kodiakhq bot pushed a commit that referenced this pull request Nov 1, 2024
AndesKrrrrrrrrrrr added a commit that referenced this pull request Nov 1, 2024
kodiakhq bot added a commit that referenced this pull request Nov 1, 2024
…otification (#16680)" (#16693)" (#16695)

This reverts commit 82fde90.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass high priority VIP-Kodiak PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants