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

feat(azure): adjust SKU and storage for yt01 and prod #1508

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

arealmaas
Copy link
Collaborator

@arealmaas arealmaas commented Nov 21, 2024

This reverts commit 304f4da.

Description

  • The sku and storage now match what Storage has configured their database with in yt01

Related Issue(s)

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Documentation

  • Documentation is updated (either in docs-directory, Altinnpedia or a separate linked PR in altinn-studio-docs., if applicable)

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Enhanced PostgreSQL configuration with new storage settings, including size and auto-grow options.
    • Updated SKU for PostgreSQL resources to a higher capacity version.
  • Bug Fixes
    • Improved flexibility in the PostgreSQL resource setup by allowing dynamic storage configurations.
  • Documentation
    • Updated parameter definitions to reflect new storage properties and SKU options.

@arealmaas arealmaas requested review from a team as code owners November 21, 2024 14:22
Copy link
Contributor

coderabbitai bot commented Nov 21, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces modifications across several Bicep files to enhance the configuration of PostgreSQL resources. Key changes include the addition of a new StorageConfiguration type and updates to the postgresConfiguration parameter to include storage properties such as storageSizeGB, autoGrow, and type. The SKU for PostgreSQL resources is also updated to a higher capacity version. These changes allow for more granular control over PostgreSQL storage settings during deployment.

Changes

File Path Change Summary
.azure/infrastructure/main.bicep Added import for StorageConfiguration, updated postgresConfiguration to include storage, modified module instantiation to pass storage.
.azure/infrastructure/prod.bicepparam Updated postgresConfiguration SKU from Standard_D4ads_v5 to Standard_D8ads_v5, added new storage object with properties.
.azure/infrastructure/staging.bicepparam Enhanced postgresConfiguration by adding storage object with storageSizeGB, autoGrow, and type properties.
.azure/infrastructure/test.bicepparam Updated postgresConfiguration to include storage object with storageSizeGB, autoGrow, and type properties.
.azure/infrastructure/yt01.bicepparam Updated postgresConfiguration SKU from Standard_D4ads_v5 to Standard_D8ads_v5, added storage object with properties.
.azure/modules/postgreSql/create.bicep Added StorageConfiguration type, updated sku type to include Standard_D8ads_v5, modified postgres resource to use dynamic storage properties.

Possibly related PRs

Suggested reviewers

  • oskogstad

Warning

Rate limit exceeded

@arealmaas has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 9 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between aed173a and e3e8bb2.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between aed173a and e3e8bb2.

📒 Files selected for processing (1)
  • .azure/modules/postgreSql/create.bicep (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .azure/modules/postgreSql/create.bicep

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
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: 2

🧹 Outside diff range and nitpick comments (6)
.azure/infrastructure/test.bicepparam (1)

39-39: Consider cost implications of enabled autoGrow

While autoGrow: 'Enabled' prevents out-of-storage scenarios, it could lead to unexpected costs in case of rapid data growth or test data accumulation. Consider:

  • Setting up monitoring alerts for storage growth
  • Implementing regular cleanup procedures for test data
  • Documenting the maximum allowed growth limit
.azure/infrastructure/prod.bicepparam (1)

37-42: Review storage configuration for cost-effectiveness

The storage configuration is set to Premium tier with substantial initial allocation:

  • 256GB storage size is significant
  • 1100 IOPS is relatively high
  • Premium tier with AutoGrow enabled will have cost implications

While these settings might be appropriate for production, consider:

  1. Is the initial 256GB storage size based on current data volume plus growth projections?
  2. Have you considered using a more conservative initial size with AutoGrow handling the scaling?
.azure/modules/postgreSql/create.bicep (3)

34-40: Consider adding runtime validation for storage tier

While the comment indicates that the 'Premium' tier is not supported for burstable SKUs, there's no runtime validation to prevent this misconfiguration. Consider adding a validation decorator or runtime check.

Example validation:

@export()
type StorageConfiguration = {
  storageSizeGB: int
  iops: int?
  autoGrow: 'Enabled' | 'Disabled'
  tier: (sku.tier == 'Burstable' ? null : 'Premium')?
}

42-43: Enhance parameter documentation

Consider adding more detailed documentation for the storage parameter, including:

  • Valid ranges for storageSizeGB and iops
  • Impact of autoGrow settings
  • Tier compatibility with different SKUs

Line range hint 27-113: Architecture Review: Storage and SKU changes are well-structured

The changes introduce flexible storage configuration while maintaining backward compatibility. The separation of concerns between SKU and storage configuration is clean and follows Azure best practices. The new structure allows for better control over PostgreSQL resources across different environments.

A few architectural considerations:

  1. The storage configuration could be extended to support future requirements like backup retention
  2. Consider adding a parameter for storage performance tier selection
  3. Think about adding monitoring and alerts for storage capacity and IOPS utilization
.azure/infrastructure/main.bicep (1)

62-62: Consider documenting storage configuration constraints

The storage property is correctly added to the postgresConfiguration parameter. Consider adding parameter decorators to document any constraints on storage values (e.g., min/max IOPS, storage size limits).

Example decorator pattern:

@description('Storage configuration for PostgreSQL instance')
@metadata({
  storageSizeGB: {
    minimum: 32,
    maximum: 16384
  },
  iops: {
    minimum: 120
  }
})
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d18bb76 and 4a7705a.

📒 Files selected for processing (6)
  • .azure/infrastructure/main.bicep (2 hunks)
  • .azure/infrastructure/prod.bicepparam (1 hunks)
  • .azure/infrastructure/staging.bicepparam (1 hunks)
  • .azure/infrastructure/test.bicepparam (1 hunks)
  • .azure/infrastructure/yt01.bicepparam (1 hunks)
  • .azure/modules/postgreSql/create.bicep (2 hunks)
🔇 Additional comments (8)
.azure/infrastructure/staging.bicepparam (1)

37-40: Storage configuration looks appropriate for staging, but consider monitoring.

The storage configuration with autoGrow enabled is a good practice to prevent storage-related issues. However, consider:

  1. Verify if 32GB is sufficient based on your current staging environment usage patterns
  2. Monitor storage growth and costs since autoGrow is enabled on a burstable tier (Standard_B1ms)

Let's check the current database size in the staging environment:

.azure/infrastructure/test.bicepparam (1)

37-40: Verify if 32GB storage size is sufficient for test environment

Please confirm that 32GB storage size aligns with the expected data growth and testing requirements. Consider:

  • Current database size
  • Expected growth rate
  • Test data volume requirements

Run this script to check current database sizes across environments:

.azure/infrastructure/prod.bicepparam (1)

34-34: Verify the necessity of doubling compute capacity in production

The SKU upgrade from Standard_D4ads_v5 to Standard_D8ads_v5 represents a significant increase in compute capacity and cost. While this might be necessary for production workloads, it's important to validate this change.

Let's check if there's evidence of resource constraints that justify this upgrade:

✅ Verification successful

PostgreSQL SKU upgrade appears justified for production workload

The SKU upgrade to Standard_D8ads_v5 is consistent across both production and YT01 environments, with additional performance-focused configurations:

  • Both environments use identical compute SKU and storage configurations
  • YT01 has performance monitoring enabled (enableIndexTuning and enableQueryPerformanceInsight)
  • The storage configuration is substantial (256GB, 1100 IOPS, Premium tier) indicating high-performance requirements
  • Other production services (ServiceBus, Redis) are also configured for production-grade performance

The SKU upgrade appears to be part of a well-considered infrastructure configuration that aligns with production performance requirements. The identical configuration in YT01 suggests proper testing of the upgraded resources before production deployment.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any performance-related discussions or metrics in the codebase
# that might justify the SKU upgrade

# Look for relevant discussions in recent commits
git log --grep="performance\|cpu\|memory\|Standard_D[48]ads" --since="3 months ago" --pretty=format:"%h - %s" 304f4da7eae3657dc85118bbedce393d1a12d5a8...HEAD

# Search for monitoring configurations that might indicate performance thresholds
rg -g "cpu|memory" --type yaml ".azure/monitoring"

Length of output: 199


Script:

#!/bin/bash
# Let's try a broader search strategy to understand the context of this change

# Search for any files containing D4ads or D8ads SKU references
rg -i "Standard_D[48]ads"

# Look for any related configuration files
fd -e bicepparam -e bicep

# Search for performance-related issues or discussions in PR descriptions
gh pr list --state all --search "performance cpu memory" --json number,title,body --limit 10

# Look for monitoring or metrics configurations in any yaml files
fd -e yaml -e yml | xargs cat

Length of output: 79169


Script:

#!/bin/bash
# Let's search for any performance metrics, monitoring, or resource utilization data
# that might justify the SKU upgrade

# Search for any performance-related configurations or metrics in bicep files
fd -e bicep -e bicepparam | xargs grep -l "performance\|memory\|cpu\|Standard_D[48]ads"

# Look for any documentation about infrastructure requirements
fd "README.md\|INFRASTRUCTURE.md" | xargs cat

# Search for any monitoring or metrics configurations
rg -g "monitoring\|metrics\|performance" --type yaml --type json

# Check for any previous SKU configurations
rg "Standard_D4ads_v5"

Length of output: 624


Script:

#!/bin/bash
# Let's try a more focused search approach

# Look for any SKU changes in git history
git log -p --grep="SKU\|D[48]ads" -- .azure/infrastructure/

# Search for specific SKU mentions in infrastructure files
rg -l "Standard_D[48]ads" .azure/infrastructure/

# Check for any performance or resource monitoring configurations
rg "monitoring" .azure/infrastructure/

# Look for any related configuration files
fd -e bicepparam | xargs cat

Length of output: 196


Script:

#!/bin/bash
# Let's examine the specific SKU configurations in both prod and yt01 environments

# Check the content of both files containing SKU configurations
echo "=== Production SKU Configuration ==="
cat .azure/infrastructure/prod.bicepparam

echo -e "\n=== YT01 SKU Configuration ==="
cat .azure/infrastructure/yt01.bicepparam

# Look for any recent commits modifying these files
echo -e "\n=== Recent changes to SKU configurations ==="
git log -p -n 5 -- .azure/infrastructure/prod.bicepparam .azure/infrastructure/yt01.bicepparam

Length of output: 3554

.azure/infrastructure/yt01.bicepparam (2)

37-42: Review Premium storage configuration

The new storage configuration introduces production-grade settings:

  • Premium tier with 256GB storage
  • 1100 IOPS
  • AutoGrow enabled

These settings suggest high-performance requirements. Please verify:

  1. Are these storage parameters aligned with the actual workload requirements for the 'yt01' environment?
  2. Is the Premium tier necessary for this environment?

Consider documenting the rationale for these specific storage parameters in the infrastructure documentation to help with future capacity planning.


34-34: Verify the SKU upgrade impact

The change from Standard_D4ads_v5 to Standard_D8ads_v5 represents a significant increase in compute capacity. Since this PR is reverting a previous commit, please confirm:

  • Is this intentional doubling of compute resources necessary?
  • Have you assessed the cost implications?
.azure/modules/postgreSql/create.bicep (1)

27-27: LGTM: SKU addition aligns with requirements

The addition of 'Standard_D8ads_v5' SKU is valid and properly integrated into the existing type definition.

.azure/infrastructure/main.bicep (2)

220-220: Verify storage configuration across environments

The storage parameter is correctly passed to the PostgreSQL module. However, we should verify that the storage configuration values are appropriate for each environment.

✅ Verification successful

Storage configuration appears appropriate across environments

The storage configurations are well-defined and follow a logical pattern across environments:

  • Production and YT01 environments are configured with premium tier storage:

    • 256GB storage size
    • 1100 IOPS
    • Premium tier
    • Auto-grow enabled
  • Staging and Test environments have lighter configurations:

    • 32GB storage size
    • Auto-grow enabled
    • Basic tier (implied by absence of tier specification)

The configuration follows best practices with higher resources in production and reduced resources in non-production environments, while maintaining auto-grow capability across all environments for safety.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify storage configuration across environment parameter files
# Expected: Find storage configuration in parameter files for different environments

echo "Checking storage configuration in environment parameter files:"
rg -A 5 "storage:" .azure/infrastructure/*.bicepparam

Length of output: 1701


58-58: Verify the StorageConfiguration type import

The import statement is correctly added. However, let's verify the type definition in the PostgreSQL module.

✅ Verification successful

StorageConfiguration type is properly defined and imported

The StorageConfiguration type in the PostgreSQL module is well-structured with all necessary storage-related properties:

  • Required storageSizeGB as integer
  • Optional iops as integer
  • autoGrow with valid enum values
  • Optional tier for non-burstable SKUs
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the StorageConfiguration type definition
# Expected: Find the type definition in the PostgreSQL module

rg "type StorageConfiguration" .azure/modules/postgreSql/create.bicep

Length of output: 101


Script:

#!/bin/bash
# Let's see the complete type definition and its usage
rg -A 5 "type StorageConfiguration" .azure/modules/postgreSql/create.bicep

Length of output: 241

.azure/infrastructure/prod.bicepparam Show resolved Hide resolved
.azure/modules/postgreSql/create.bicep Outdated Show resolved Hide resolved
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: 1

🧹 Outside diff range and nitpick comments (1)
.azure/modules/postgreSql/create.bicep (1)

108-113: Consider monitoring implications of new configuration

With the upgraded SKU and storage settings:

  1. Ensure monitoring alerts are adjusted for the new performance baseline
  2. Consider adding storage usage metrics to existing diagnostics

The diagnostic settings (line 190) already capture metrics, but consider adding specific storage-related alert rules in a separate monitoring configuration.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 4a7705a and 45f229f.

📒 Files selected for processing (5)
  • .azure/infrastructure/prod.bicepparam (1 hunks)
  • .azure/infrastructure/staging.bicepparam (1 hunks)
  • .azure/infrastructure/test.bicepparam (1 hunks)
  • .azure/infrastructure/yt01.bicepparam (1 hunks)
  • .azure/modules/postgreSql/create.bicep (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .azure/infrastructure/prod.bicepparam
  • .azure/infrastructure/staging.bicepparam
  • .azure/infrastructure/test.bicepparam
  • .azure/infrastructure/yt01.bicepparam
🔇 Additional comments (3)
.azure/modules/postgreSql/create.bicep (3)

42-43: LGTM: Storage parameter is well-defined

The parameter declaration is correct and includes appropriate documentation.


27-27: LGTM: SKU addition aligns with requirements

The addition of 'Standard_D8ads_v5' to the SKU options is valid and aligns with the PR objectives to adjust SKU configurations.


108-113: LGTM: Storage configuration is properly implemented

The storage configuration is correctly mapped to the PostgreSQL Flexible Server resource properties.

✅ Verification successful

Storage configuration implementation is correctly validated

The storage configuration implementation is verified to be correct based on the following:

  • The StorageConfiguration type is properly defined with all required properties and their valid values
  • The storage object in the PostgreSQL resource correctly maps all properties from the input parameter
  • The implementation matches Azure's PostgreSQL Flexible Server storage requirements
  • All property types are properly constrained (e.g., tier values are explicitly enumerated)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify storage configurations across environments
# Look for storage configurations in parameter files to ensure consistency
rg -A 10 'storage:' '.azure/infrastructure/*.bicepparam'

Length of output: 131


Script:

#!/bin/bash
# Let's first find all bicepparam files in the repository
fd -e bicepparam

# Then search for storage configurations in all Bicep files
rg -A 10 'storage:' --type bicep

Length of output: 81


Script:

#!/bin/bash
# Search for storage configurations in all files with .bicep extension
rg -A 10 'storage:' -g '*.bicep'

# Also look for parameter files that might define storage configurations
rg -A 10 'storage:' -g '*.parameters.json'

Length of output: 373


Script:

#!/bin/bash
# First, let's find all Bicep files in the repository
fd .bicep

# Then let's look at the module file content to understand the storage parameter definition
cat .azure/modules/postgreSql/create.bicep

Length of output: 7663

.azure/modules/postgreSql/create.bicep Outdated Show resolved Hide resolved
@arealmaas arealmaas merged commit 5478275 into main Nov 22, 2024
18 checks passed
@arealmaas arealmaas deleted the feat/azure-postgres-upgrade branch November 22, 2024 12:39
arealmaas pushed a commit that referenced this pull request Nov 25, 2024
🤖 I have created a release *beep* *boop*
---


##
[1.39.0](v1.38.0...v1.39.0)
(2024-11-22)


### Features

* **azure:** adjust SKU and storage for yt01 and prod
([b7e4909](b7e4909))
* **azure:** adjust SKU and storage for yt01 and prod
([#1508](#1508))
([5478275](5478275))
* **graphql:** Create separate type for sub-parties
([#1510](#1510))
([9c75f11](9c75f11))


### Bug Fixes

* **azure:** ensure correct properties are used when adjusting SKU and
storage for postgres
([#1514](#1514))
([c51d2f5](c51d2f5))
* Reenable party list cache, log party name look failure with negative
cache TTL ([#1395](#1395))
([d18bb76](d18bb76))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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