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: allow specifying Azure cloud to connect to #170

Merged
merged 7 commits into from
Aug 16, 2024
Merged

Conversation

mattwelke
Copy link
Member

@mattwelke mattwelke commented Aug 16, 2024

Issue

Resolves #165.

Description

Adds support for specifying which Azure cloud to connect to. Users can use this to enable connecting to Azure Government.

Users are prompted for this when they enable the Azure plugin. Example:

Install Azure plugin? [Y/n]: Yes
Select the Azure cloud environment to connect to.
Azure cloud: 
  > AzureCloud

Works with both direct rule invocation and installing with Helm.

  • For direct rule invocation, it sets the AZURE_ENVIRONMENT env var which gets picked up by the plugin code invoked
  • For installing with Helm, it adds the name of the cloud to connect to to the template file it uses to generate the Helm values.yaml file. This taps into the new Helm config for this in the plugin.

Because this prompt happens before it gets to the rule config, it is persisted in the Validator config that is generated and users don't have to select it again when they proceed to the rules step or if they ever re-configure rules. It's best to tightly couple it to the Validator config step instead of the rules config step because users would want to use a particular combination of Tenant ID, Client ID, and Client Secret when they're connecting to either the public Azure cloud or Azure Government. It wouldn't make sense to switch from public cloud to Azure Government but keep the same three credentials. They wouldn't work.

Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
…plgin.

Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
@mattwelke mattwelke requested a review from a team as a code owner August 16, 2024 17:56
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. new-feature Net-new feature labels Aug 16, 2024
Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
@mattwelke mattwelke changed the title feat: allow specifying Azure cloud to connect to (e.g. public vs govt) feat: allow specifying Azure cloud to connect to Aug 16, 2024
Copy link
Member

@TylerGillson TylerGillson left a comment

Choose a reason for hiding this comment

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

Will approve once tests are passing and nit is addressed!

pkg/services/validator/validator_service.go Outdated Show resolved Hide resolved
Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
Signed-off-by: Matt Welke <matt.welke@spectrocloud.com>
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 16, 2024
Copy link

codecov bot commented Aug 16, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 5 lines in your changes missing coverage. Please review.

Files Patch % Lines
pkg/services/validator/azure.go 37.50% 4 Missing and 1 partial ⚠️
@@            Coverage Diff             @@
##             main     #170      +/-   ##
==========================================
- Coverage   53.77%   53.76%   -0.02%     
==========================================
  Files          43       43              
  Lines        6086     6095       +9     
==========================================
+ Hits         3273     3277       +4     
- Misses       1994     1998       +4     
- Partials      819      820       +1     
Files Coverage Δ
pkg/components/validator.go 59.94% <ø> (ø)
pkg/config/constants.go 100.00% <ø> (ø)
pkg/services/validator/validator_service.go 46.68% <ø> (ø)
...integration/_validator/testcases/test_validator.go 93.60% <100.00%> (+0.01%) ⬆️
pkg/services/validator/azure.go 39.60% <37.50%> (-0.09%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cc2c056...62c86f4. Read the comment docs.

@TylerGillson TylerGillson merged commit 6a4a704 into main Aug 16, 2024
7 of 8 checks passed
@TylerGillson TylerGillson deleted the feat/iss165 branch August 16, 2024 21:13
ahmad-ibra pushed a commit that referenced this pull request Aug 19, 2024
🤖 I have created a release *beep* *boop*
---


##
[0.1.2](v0.1.1...v0.1.2)
(2024-08-19)


### Features

* add maas plugin
([#160](#160))
([ab9f21a](ab9f21a))
* allow selecting aws creds from filesystem
([#171](#171))
([c3a714c](c3a714c))
* allow specifying Azure cloud to connect to
([#170](#170))
([6a4a704](6a4a704))
* read vCenter privileges from local file or editor
([#152](#152))
([94ddd90](94ddd90))
* set exit code 2 on validation failure; restore debug log file
([#150](#150))
([2a3fe4d](2a3fe4d))
* support configuring oci validationType on a rule
([#161](#161))
([8dfc501](8dfc501))
* support direct oci validation of private registries
([#173](#173))
([9cfeab9](9cfeab9))


### Bug Fixes

* correct TUI flow for `validator install -o --apply`
([#169](#169))
([0912f6e](0912f6e))
* export creds for aws and azure direct check
([#167](#167))
([5d569de](5d569de))


### Dependency Updates

* **deps:** update anchore/sbom-action action to v0.17.1
([#163](#163))
([416d23c](416d23c))
* **deps:** update github.com/validator-labs/validator-plugin-azure
digest to b4687e5
([#149](#149))
([e7ab9a6](e7ab9a6))
* **deps:** update github.com/validator-labs/validator-plugin-vsphere
digest to a93cb70
([#147](#147))
([79304b9](79304b9))
* **deps:** update module github.com/vmware/govmomi to v0.40.0
([#162](#162))
([acf4a25](acf4a25))


### Refactoring

* lazy configuration of oci auth and signature verification secrets
([#168](#168))
([cc2c056](cc2c056))
* remove explicit TypeMetas; use vapi constants
([#154](#154))
([28b321c](28b321c))

---
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
lgtm This PR has been approved by a maintainer new-feature Net-new feature size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🌱 Prompt for Azure cloud to connect to and pass it into the Azure plugin
2 participants