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

azurerm_kubernetes_cluster - support for the revisions for istio addon #26546

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hqhqhqhqhqhqhqhqhqhqhq
Copy link
Contributor

@hqhqhqhqhqhqhqhqhqhqhq hqhqhqhqhqhqhqhqhqhqhq commented Jul 5, 2024

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

Adds new property revisions forazurerm_kubernetes_cluster istio addon. This configuration allows users to bring set istio control plane revisions for managing upgrades the minor revision using canary upgrade process.

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevent documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_kubernetes_cluster - support for the revisions property for service_mesh_profile.

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

image image

Closes #25724

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

Comment on lines 1324 to 1325
Optional: true,
Computed: true,
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason this needs to be Computed? We avoid introducing new properties that are both Optional+Computed (O+C), in particular lists of primitives unless there is a good reason to. This is because the provider is sometimes unable to tell whether a change has happened to an O+C property when a user tries to update it. We have a more detailed explanation over in the contributor docs in case you're interested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in latest commit

Type: pluginsdk.TypeSet,
Optional: true,
Computed: true,
MinItems: 1,
Copy link
Member

Choose a reason for hiding this comment

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

This would be a breaking change for users that have this block set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, are you referring to MinItems? As in it would be a breaking change when in future this MinItems changes? And vice versa for MaxItems?

Copy link
Member

Choose a reason for hiding this comment

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

I was referring to the MinItems, but my suspicion that it would be a breaking change was incorrect. Specifying a MinItems would have implied that the property must be set with at least one element in the list, but because it's Optional is appears to really only be a validation that's applied if the property has been set. Good to know.

Unfortunately adding this property is still going to be a breaking change since users will need to add this property to ignore_changes to prevent a diff when they upgrade to a version that will include this change.

From the sounds of it it also seems like this property might actually want to be Required instead of Optional?

Computed: true,
MinItems: 1,
MaxItems: 2,
Set: set.HashStringIgnoreCase,
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be a set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need, but Set feels more suitable in this case to stop users from inputting duplicates, can update to List if preferred.

Copy link
Member

Choose a reason for hiding this comment

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

We only use sets if the API doesn't preserve the ordering.

Regarding duplicates, you could add some validation in the expand function to check for duplicates and can error at apply time if that helps?

Comment on lines +4810 to +4808
if existing != nil && existing.Istio != nil && existing.Istio.Revisions != nil {
profile.Istio.Revisions = existing.Istio.Revisions
Copy link
Member

Choose a reason for hiding this comment

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

What is this for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Previously, if the service_mesh_profile is set with istio, it will be deployed fine, but any updates for service_mesh_profile properties later will cause error returned by the AKS API because the revisions has not been specified.
I have added this block so that if user wants to update the service_mesh_profile without revisions, it will by default use whatever revisions it already has as returned by the AKS API.

Copy link
Member

Choose a reason for hiding this comment

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

Based on this it sounds like this property might actually want to be Required instead of Optional

website/docs/r/kubernetes_cluster.html.markdown Outdated Show resolved Hide resolved
…data source

feat: add revisions setting in azurerm_kubernetes_cluster resource & data source

feat: add doc & acceptance tests for new property

feat: add revisions setting in azurerm_kubernetes_cluster resource & data source

Update kubernetes_cluster_network_resource_test.go

fix: fix issues based on pr reviews

Update website/docs/r/kubernetes_cluster.html.markdown

Co-Authored-By: stephybun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for ASM revisions in azurerm_kubernetes_cluster
2 participants