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

Add end to end logics for ACS, Service Registry, Gateway and API portal #4282

Merged
merged 12 commits into from
Jan 6, 2022

Conversation

ninpan-ms
Copy link
Contributor


The pr is part of main...VSChina:enterprise.
Add end to end logics for 4 Tanzu components: ACS, Service Registry, Gateway and API portal. Including commands, params, help, transformers and validator.

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally?

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your PR is merged into master branch, a new PR will be created to update src/index.json automatically.
The precondition is to put your code inside this repo and upgrade the version in the PR but do not modify src/index.json.

@yonzhan
Copy link
Collaborator

yonzhan commented Dec 31, 2021

spring cloud

c.argument('host_key', help='Host key of the added config.')
c.argument('host_key_algorithm', help='Host key algorithm of the added config.')
c.argument('private_key', help='Private_key of the added config.')
c.argument('host_key_check', help='Strict_host_key_checking of the added config.')
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please explain Strict_host_key_checking more specifically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added explanation


def validate_routes(namespace):
if namespace.routes_json is not None and namespace.routes_file is not None:
raise ValidationError("You can only specify either --routes-json or --routes-file.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the more specific error type MutuallyExclusiveArgumentError

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 all error types

def validate_gateway_instance_count(namespace):
if namespace.gateway_instance_count is not None:
if namespace.gateway_instance_count < 1:
raise ValidationError("--gateway-instance-count must be greater than 0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the more specific error type InvalidArgumentValueError

def validate_api_portal_instance_count(namespace):
if namespace.api_portal_instance_count is not None:
if namespace.api_portal_instance_count < 1:
raise ValidationError("--api-portal-instance-count must be greater than 0")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the more specific error type InvalidArgumentValueError

all_provided = namespace.scope and namespace.client_id and namespace.client_secret and namespace.issuer_uri
none_provided = namespace.scope is None and namespace.client_id is None and namespace.client_secret is None and namespace.issuer_uri is None
if not all_provided and not none_provided:
raise ValidationError("Single Sign On configurations '--scope --client-id --client-secret --issuer-uri' should be all provided or none provided.")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the more specific error type ArgumentUsageError

def validate_git_uri(namespace):
uri = namespace.uri
if uri and (not uri.startswith("https://")) and (not uri.startswith("git@")):
raise ValidationError("Git URI should start with \"https://\" or \"git@\"")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the more specific error type InvalidArgumentValueError

invalid_list = [p for p in pattern_list if not _is_valid_pattern(p)]
if len(invalid_list) > 0:
logger.warning("Patterns '%s' are invalid.", ','.join(invalid_list))
raise ValidationError("Patterns should be the collection of patterns separated by comma, each pattern in the format of 'application' or 'application/profile'")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use the more specific error type InvalidArgumentValueError

ninpan-ms and others added 4 commits January 4, 2022 17:29
Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com>
Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com>
@ninpan-ms
Copy link
Contributor Author

#4294

Comment on lines 479 to 489
for scope in ['spring-cloud gateway custom-domain',
'spring-cloud api-portal custom-domain']:
with self.argument_context(scope) as c:
c.argument('domain_name', help='Name of custom domain.')

for scope in ['spring-cloud gateway custom-domain bind',
'spring-cloud gateway custom-domain update',
'spring-cloud api-portal custom-domain bind',
'spring-cloud api-portal custom-domain update']:
with self.argument_context(scope) as c:
c.argument('certificate', type=str, help='Certificate name in Azure Spring Cloud.')
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

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

ninpan-ms and others added 2 commits January 5, 2022 15:46
Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com>
c.argument('host_key', help='Host key of the added config.')
c.argument('host_key_algorithm', help='Host key algorithm of the added config.')
c.argument('private_key', help='Private_key of the added config.')
c.argument('host_key_check', help='Strict_host_key_checking of the added config. If false, ignore errors with host key.')
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you replace Strict_host_key_checking with a more understandable description

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, the concept is used in SSH authentication of Configuration Service.

@zhoxing-ms zhoxing-ms merged commit 97d7685 into Azure:main Jan 6, 2022
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

4 participants