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: add these to the config to prevent drift #1194

Merged
merged 1 commit into from
Dec 19, 2024
Merged

Conversation

monteiro-renato
Copy link
Contributor

@monteiro-renato monteiro-renato commented Dec 19, 2024

This should prevent the Terraform plan from being polluted.

Summary by CodeRabbit

  • New Features
    • Enhanced upgrade management settings for the Kubernetes cluster.
    • Improved handling of spot instances with new labels and taints.

Copy link

coderabbitai bot commented Dec 19, 2024

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The changes modify the Terraform configuration for an Azure Kubernetes Service (AKS) cluster, focusing on upgrade management and node pool configuration. The modifications introduce an upgrade_settings block to the default node pool, specifying drain timeout, max surge, and node soak duration. Additionally, the spot node pool configuration is enhanced with node labels and taints to better control scheduling and prioritize spot instances.

Changes

File Change Summary
infrastructure/adminservices-test/.../k6_tests_rg_k8s.tf - Added upgrade_settings block to azurerm_kubernetes_cluster resource with drain and upgrade parameters
- Updated azurerm_kubernetes_cluster_node_pool with node_labels and node_taints for spot instances

Sequence Diagram

sequenceDiagram
    participant AKS as AKS Cluster
    participant NodePool as Default Node Pool
    participant SpotPool as Spot Node Pool
    
    AKS->>NodePool: Configure Upgrade Settings
    NodePool-->>AKS: Set drain timeout, max surge
    
    AKS->>SpotPool: Apply Node Labels
    SpotPool-->>AKS: Add spot priority label
    
    AKS->>SpotPool: Configure Node Taints
    SpotPool-->>AKS: Prevent scheduling without tolerations
Loading

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aed7cf7 and 6791c23.

📒 Files selected for processing (1)
  • infrastructure/adminservices-test/altinn-monitor-test-rg/k6_tests_rg_k8s.tf (2 hunks)

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

github-actions bot commented Dec 19, 2024

Terraform environment test

Format and Style 🖌failure

Initialization ⚙️success

Validation 🤖success

Validation Output

Success! The configuration is valid.


Plan 📖success

Show Plan

[Lines containing Refreshing state removed]
[Maybe further truncated see logs for complete plan output]
Acquiring state lock. This may take a few moments...
data.azurerm_client_config.current: Reading...
data.azurerm_monitor_data_collection_rule.prometheus: Reading...
data.azurerm_client_config.current: Read complete after 0s [id=Y2xpZW50Q29uZmlncy9jbGllbnRJZD1mMDNmNzU3OS01ZjM5LTRkN2YtYmNlYS04ZTVjYjZkN2FjYTQ7b2JqZWN0SWQ9MDJiMTdkMjgtN2VjOC00MDg0LTkyY2UtZDI2MDUxZmE0OTk4O3N1YnNjcmlwdGlvbklkPTFjZThlOWFmLWMyZDYtNDRlNy05YzVlLTA5OWEzMDgwNTZmZTt0ZW5hbnRJZD1jZDAwMjZkOC0yODNiLTRhNTUtOWJmYS1kMGVmNGE4YmEyMWM=]
data.azurerm_monitor_data_collection_rule.prometheus: Read complete after 1s [id=/subscriptions/1ce8e9af-c2d6-44e7-9c5e-099a308056fe/resourceGroups/MA_k6tests-amw_norwayeast_managed/providers/Microsoft.Insights/dataCollectionRules/k6tests-amw]
data.azurerm_resource_group.rg_dp_test: Reading...
data.azurerm_resource_group.rg_dp_test: Read complete after 0s [id=/subscriptions/8a353de8-d81d-468d-a40d-f3574b6bb3f4/resourceGroups/dp-be-test-rg]
data.azurerm_log_analytics_workspace.dp_law_test: Reading...
data.azurerm_log_analytics_workspace.dp_law_test: Read complete after 1s [id=/subscriptions/8a353de8-d81d-468d-a40d-f3574b6bb3f4/resourceGroups/dp-be-test-rg/providers/Microsoft.OperationalInsights/workspaces/dp-be-test-insightsWorkspace]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # azurerm_role_assignment.grafana_identity_reader_rg_dp_test will be created
  + resource "azurerm_role_assignment" "grafana_identity_reader_rg_dp_test" {
      + condition_version                = (known after apply)
      + id                               = (known after apply)
      + name                             = (known after apply)
      + principal_id                     = "ccc9af1e-ab07-4895-8a2e-446fce26e871"
      + principal_type                   = (known after apply)
      + role_definition_id               = (known after apply)
      + role_definition_name             = "Monitoring Reader"
      + scope                            = "/subscriptions/8a353de8-d81d-468d-a40d-f3574b6bb3f4"
      + skip_service_principal_aad_check = true
    }

  # azurerm_role_assignment.log_analytics_reader_dp_test will be created
  + resource "azurerm_role_assignment" "log_analytics_reader_dp_test" {
      + condition_version                = (known after apply)
      + id                               = (known after apply)
      + name                             = (known after apply)
      + principal_id                     = "ccc9af1e-ab07-4895-8a2e-446fce26e871"
      + principal_type                   = (known after apply)
      + role_definition_id               = (known after apply)
      + role_definition_name             = "Log Analytics Reader"
      + scope                            = "/subscriptions/8a353de8-d81d-468d-a40d-f3574b6bb3f4/resourceGroups/dp-be-test-rg/providers/Microsoft.OperationalInsights/workspaces/dp-be-test-insightsWorkspace"
      + skip_service_principal_aad_check = true
    }

  # azurerm_role_assignment.monitoring_reader_rg_dp_test will be created
  + resource "azurerm_role_assignment" "monitoring_reader_rg_dp_test" {
      + condition_version                = (known after apply)
      + id                               = (known after apply)
      + name                             = (known after apply)
      + principal_id                     = "ccc9af1e-ab07-4895-8a2e-446fce26e871"
      + principal_type                   = (known after apply)
      + role_definition_id               = "/subscriptions/1ce8e9af-c2d6-44e7-9c5e-099a308056fe/providers/Microsoft.Authorization/roleDefinitions/43d0d8ad-25c7-4714-9337-8ba259a9fe05"
      + role_definition_name             = (known after apply)
      + scope                            = "/subscriptions/8a353de8-d81d-468d-a40d-f3574b6bb3f4/resourceGroups/dp-be-test-rg"
      + skip_service_principal_aad_check = true
    }

Plan: 3 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: tfplan.out

To perform exactly these actions, run the following command to apply:
    terraform apply "tfplan.out"
Releasing state lock. This may take a few moments...

Context Values
Pusher @monteiro-renato
Action push
Working Directory ./infrastructure/adminservices-test/altinn-monitor-test-rg
State File github.com/altinn/altinn-platform/environments/test/altinn-monitor-test-rg.tfstate
Plan File github.com_altinn_altinn-platform_environments_test_altinn-monitor-test-rg.tfstate.tfplan

@monteiro-renato monteiro-renato marked this pull request as ready for review December 19, 2024 12:54
@monteiro-renato monteiro-renato requested a review from a team as a code owner December 19, 2024 12:54
@monteiro-renato monteiro-renato merged commit 8024b9a into main Dec 19, 2024
5 of 6 checks passed
@monteiro-renato monteiro-renato deleted the fix/defaults branch December 19, 2024 12:55
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