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(arm): ACREnableZoneRedundancy #6326

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

channy-katz
Copy link
Contributor

@channy-katz channy-katz commented May 19, 2024

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Description

adds a ACREnableZoneRedundancy

Description

The function checks whether the "zoneRedundancy" property is set to True for a resource and all its replications. If any "zoneRedundancy" is not True, it returns a failure result; otherwise, it returns a pass result.

Fix

How does someone fix the issue in code and/or in runtime?

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature, policy, or fix is effective and works
  • New and existing tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

return CheckResult.FAILED

# check each replica. default=false
replications = conf.get("replications", {})
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see the replications field in Microsoft.ContainerRegistry/registries/replications or Microsoft.ContainerRegistry/registries, are you sure this is the field we should check here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the error
can you confirm me please

Copy link
Contributor

Choose a reason for hiding this comment

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

My comment was for the resource template, Are you sure that those resources have the field replications to configure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked and I think it's good now

Copy link
Contributor

Choose a reason for hiding this comment

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

You are looking for the field replications in the Microsoft.ContainerRegistry/registries resource type
but I don't see here the replications filed

@channy-katz channy-katz changed the title feat(arm): ACREnableZoneRedundancy feat(arm): add ACREnableZoneRedundancy May 28, 2024
@channy-katz
Copy link
Contributor Author

I changed the mistakes
But there was something about the title, I don't find a problem there

Copy link
Contributor

@ChanochShayner ChanochShayner left a comment

Choose a reason for hiding this comment

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

your UT is failing, please fix it and the other failing jobs.

# check registry. default=false
properties = conf.get("properties")
if properties and isinstance(properties, dict):
if properties.get("zoneRedundancy", []) != [True]:
Copy link
Contributor

Choose a reason for hiding this comment

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

zoneRedundancy should be Enabled or Disabled and not a boolean value

@channy-katz channy-katz changed the title feat(arm): add ACREnableZoneRedundancy feat(arm): ACREnableZoneRedundancy Jun 2, 2024
# check registry. default=false
properties = conf.get("properties")
if properties and isinstance(properties, dict):
if properties.get("zoneRedundancy") == "disabled":
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if properties.get("zoneRedundancy") == "disabled":
if properties.get("zoneRedundancy") == "Disabled":

"properties": {
"adminUserEnabled": "[parameters('acrAdminUserEnabled')]",
"zoneRedundancy":
"disabled"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"disabled"
"Disabled"

"[resourceId('Microsoft.ContainerRegistry/registries/', parameters('acrName'))]"
],
"properties": {
"zoneRedundancy": "disabled"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"zoneRedundancy": "disabled"
"zoneRedundancy": "Disabled"

},
"properties": {
"adminUserEnabled": "[parameters('acrAdminUserEnabled')]",
"zoneRedundancy": "enabled"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"zoneRedundancy": "enabled"
"zoneRedundancy": "Enabled"

"[resourceId('Microsoft.ContainerRegistry/registries/', parameters('acrName'))]"
],
"properties": {
"zoneRedundancy": "enabled"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"zoneRedundancy": "enabled"
"zoneRedundancy": "Enabled"

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.

None yet

2 participants