-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat(networkservices): generate AgentConnectivityTemplate and add to … #18456
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
Open
ericlin0101
wants to merge
5
commits into
GoogleCloudPlatform:main
Choose a base branch
from
ericlin0101:agw-act
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f7093a9
feat(networkservices): generate AgentConnectivityTemplate and add to …
ericlin0101 b1613a6
fix(networkservices): address PR review feedback for Agent Connectivi…
ericlin0101 2370616
Fix lint and missing service label
ericlin0101 459361b
Add acceptance test for egress network config
ericlin0101 88bc68a
Add advanced update test for Agent Connectivity Template
ericlin0101 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
172 changes: 172 additions & 0 deletions
172
mmv1/products/networkservices/AgentConnectivityTemplate.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| --- | ||
| name: AgentConnectivityTemplate | ||
| description: | | ||
| AgentConnectivityTemplate represents a reusable network configuration. | ||
| references: | ||
| guides: | ||
| api: https://cloud.google.com/network-services/docs/reference/network-services/rest/v1/projects.locations.agentConnectivityTemplates | ||
| docs: | ||
| base_url: projects/{{project}}/locations/{{location}}/agentConnectivityTemplates | ||
| self_link: projects/{{project}}/locations/{{location}}/agentConnectivityTemplates/{{agent_connectivity_template_id}} | ||
| create_url: projects/{{project}}/locations/{{location}}/agentConnectivityTemplates?agentConnectivityTemplateId={{agent_connectivity_template_id}} | ||
| update_mask: true | ||
| update_verb: PATCH | ||
| import_format: | ||
| - projects/{{project}}/locations/{{location}}/agentConnectivityTemplates/{{agent_connectivity_template_id}} | ||
| timeouts: | ||
| insert_minutes: 30 | ||
| update_minutes: 30 | ||
| delete_minutes: 30 | ||
| async: | ||
| type: OpAsync | ||
| operation: | ||
| base_url: '{{op_id}}' | ||
| actions: [create, delete, update] | ||
| result: | ||
| resource_inside_response: true | ||
| autogen_async: true | ||
| samples: | ||
| - name: network_services_agent_connectivity_template_basic | ||
| primary_resource_id: default | ||
| steps: | ||
| - name: network_services_agent_connectivity_template_basic | ||
| resource_id_vars: | ||
| agent_connectivity_template_id: my-connectivity-template | ||
| test_env_vars: | ||
| project: PROJECT_NAME | ||
| - name: network_services_agent_connectivity_template_basic_update | ||
| resource_id_vars: | ||
| agent_connectivity_template_id: my-connectivity-template | ||
| test_env_vars: | ||
| project: PROJECT_NAME | ||
| - name: network_services_agent_connectivity_template_advanced | ||
| primary_resource_id: default | ||
| steps: | ||
| - name: network_services_agent_connectivity_template_advanced | ||
| resource_id_vars: | ||
| agent_connectivity_template_id: my-connectivity-template | ||
| network_name: my-network | ||
| subnetwork_name: my-subnetwork | ||
| network_attachment_name: my-attachment | ||
| test_env_vars: | ||
| project: PROJECT_NAME | ||
| - name: network_services_agent_connectivity_template_advanced_update | ||
| resource_id_vars: | ||
| agent_connectivity_template_id: my-connectivity-template | ||
| network_name: my-network | ||
| subnetwork_name: my-subnetwork | ||
| network_attachment_name: my-attachment | ||
| test_env_vars: | ||
| project: PROJECT_NAME | ||
| parameters: | ||
| - name: agentConnectivityTemplateId | ||
| type: String | ||
| description: | | ||
| Short name of the AgentConnectivityTemplate resource. | ||
| required: true | ||
| url_param_only: true | ||
| immutable: true | ||
| - name: location | ||
| type: String | ||
| description: | | ||
| The location of the AgentConnectivityTemplate. | ||
| url_param_only: true | ||
| required: true | ||
| properties: | ||
| - name: name | ||
| type: String | ||
| description: | | ||
| Identifier. Name of the resource. | ||
| output: true | ||
| - name: createTime | ||
| type: Time | ||
| description: | | ||
| The timestamp when the resource was created. | ||
| output: true | ||
| - name: updateTime | ||
| type: Time | ||
| description: | | ||
| The timestamp when the resource was updated. | ||
| output: true | ||
| - name: labels | ||
| type: KeyValueLabels | ||
| description: | | ||
| Set of label tags associated with the AgentConnectivityTemplate resource. | ||
| - name: description | ||
| type: String | ||
| description: | | ||
| A free-text description of the resource. Max length 1024 characters. | ||
| - name: etag | ||
| type: Fingerprint | ||
| description: | | ||
| Etag of the resource. | ||
| If this is provided, it must match the server's etag. If the provided etag | ||
| does not match the server's etag, the request will fail with a 409 ABORTED | ||
| error. | ||
| - name: accessTypes | ||
| type: Array | ||
| description: | | ||
| The types of network access provided to the gateway. | ||
| Both PUBLIC and PRIVATE can be configured. | ||
| item_type: | ||
| type: Enum | ||
| enum_values: | ||
| - PUBLIC | ||
| - PRIVATE | ||
| - name: accessPath | ||
| type: Enum | ||
| required: true | ||
| immutable: true | ||
| description: | | ||
| The path of the access. | ||
| The path is immutable once set. Exactly one path can be set. | ||
| enum_values: | ||
| - CLIENT_TO_AGENT | ||
| - AGENT_TO_ANYWHERE | ||
| - name: egressNetworkConfig | ||
| type: NestedObject | ||
| description: | | ||
| Configuration for egress network traffic. | ||
| properties: | ||
| - name: networkAttachment | ||
| type: String | ||
| description: | | ||
| The network attachment resource name. | ||
| Format: projects/{project}/regions/{region}/networkAttachments/{network_attachment_id} | ||
| diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName | ||
| - name: dnsPeeringConfig | ||
| type: NestedObject | ||
| description: | | ||
| DNS peering configuration for the AgentConnectivityTemplate. | ||
| When set, the gateway will resolve queries for the configured | ||
| `domains` via Cloud DNS in the specified `targetNetwork`. | ||
| properties: | ||
| - name: domains | ||
| type: Array | ||
| required: true | ||
| description: | | ||
| The list of domain names to peer for DNS resolution. Each entry | ||
| must be a fully qualified domain name ending with a dot | ||
| (for example, `example.com.`). | ||
| item_type: | ||
| type: String | ||
| - name: targetProject | ||
| type: String | ||
| required: true | ||
| description: | | ||
| The ID of the project that hosts the target VPC network for DNS | ||
| peering. | ||
| - name: targetNetwork | ||
| type: String | ||
| required: true | ||
| diff_suppress_func: tpgresource.CompareSelfLinkOrResourceName | ||
| description: | | ||
| The URI of the target VPC network for DNS peering. Must be of the | ||
| form `projects/{project}/global/networks/{network}`. | ||
| - name: vpcEgress | ||
| type: Enum | ||
| description: | | ||
| The VPC egress setting. | ||
| enum_values: | ||
| - ALL_TRAFFIC | ||
| - PRIVATE_RANGES_ONLY | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...es/services/networkservices/network_services_agent_connectivity_template_advanced.tf.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| data "google_project" "project" {} | ||
|
|
||
| resource "google_compute_network" "default" { | ||
| name = "{{index $.ResourceIdVars "network_name"}}" | ||
| auto_create_subnetworks = false | ||
| } | ||
|
|
||
| resource "google_compute_subnetwork" "default" { | ||
| name = "{{index $.ResourceIdVars "subnetwork_name"}}" | ||
| region = "us-central1" | ||
| network = google_compute_network.default.id | ||
| ip_cidr_range = "10.0.0.0/16" | ||
| } | ||
|
|
||
| resource "google_compute_network_attachment" "default" { | ||
| name = "{{index $.ResourceIdVars "network_attachment_name"}}" | ||
| region = "us-central1" | ||
| connection_preference = "ACCEPT_AUTOMATIC" | ||
| subnetworks = [google_compute_subnetwork.default.id] | ||
| } | ||
|
|
||
| resource "google_network_services_agent_connectivity_template" "{{$.PrimaryResourceId}}" { | ||
| agent_connectivity_template_id = "{{index $.ResourceIdVars "agent_connectivity_template_id"}}" | ||
| location = "us-central1" | ||
| description = "An advanced configuration for Agent Connectivity Template" | ||
|
|
||
| access_types = ["PRIVATE"] | ||
| access_path = "AGENT_TO_ANYWHERE" | ||
|
|
||
| egress_network_config { | ||
| vpc_egress = "ALL_TRAFFIC" | ||
| network_attachment = google_compute_network_attachment.default.id | ||
| dns_peering_config { | ||
| domains = ["example.com."] | ||
| target_network = google_compute_network.default.id | ||
| target_project = data.google_project.project.project_id | ||
| } | ||
| } | ||
| } |
43 changes: 43 additions & 0 deletions
43
...ices/networkservices/network_services_agent_connectivity_template_advanced_update.tf.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| data "google_project" "project" {} | ||
|
|
||
| resource "google_compute_network" "default" { | ||
| name = "{{index $.ResourceIdVars "network_name"}}" | ||
| auto_create_subnetworks = false | ||
| } | ||
|
|
||
| resource "google_compute_subnetwork" "default" { | ||
| name = "{{index $.ResourceIdVars "subnetwork_name"}}" | ||
| region = "us-central1" | ||
| network = google_compute_network.default.id | ||
| ip_cidr_range = "10.0.0.0/16" | ||
| } | ||
|
|
||
| resource "google_compute_network_attachment" "default" { | ||
| name = "{{index $.ResourceIdVars "network_attachment_name"}}" | ||
| region = "us-central1" | ||
| connection_preference = "ACCEPT_AUTOMATIC" | ||
| subnetworks = [google_compute_subnetwork.default.id] | ||
| } | ||
|
|
||
| resource "google_network_services_agent_connectivity_template" "{{$.PrimaryResourceId}}" { | ||
| agent_connectivity_template_id = "{{index $.ResourceIdVars "agent_connectivity_template_id"}}" | ||
| location = "us-central1" | ||
| description = "An updated advanced configuration for Agent Connectivity Template" | ||
|
|
||
| access_types = ["PRIVATE"] | ||
| access_path = "AGENT_TO_ANYWHERE" | ||
|
|
||
| labels = { | ||
| env = "prod" | ||
| } | ||
|
|
||
| egress_network_config { | ||
| vpc_egress = "PRIVATE_RANGES_ONLY" | ||
| network_attachment = google_compute_network_attachment.default.id | ||
| dns_peering_config { | ||
| domains = ["example.com.", "example.net."] | ||
| target_network = google_compute_network.default.id | ||
| target_project = data.google_project.project.project_id | ||
| } | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
...mples/services/networkservices/network_services_agent_connectivity_template_basic.tf.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| data "google_project" "project" {} | ||
|
|
||
| resource "google_network_services_agent_connectivity_template" "{{$.PrimaryResourceId}}" { | ||
| agent_connectivity_template_id = "{{index $.ResourceIdVars "agent_connectivity_template_id"}}" | ||
| location = "us-central1" | ||
| description = "A basic configuration for Agent Connectivity Template" | ||
| labels = { | ||
| env = "test" | ||
| tier = "gold" | ||
| } | ||
|
|
||
| access_types = ["PUBLIC"] | ||
| access_path = "AGENT_TO_ANYWHERE" | ||
| } |
15 changes: 15 additions & 0 deletions
15
...ervices/networkservices/network_services_agent_connectivity_template_basic_update.tf.tmpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| data "google_project" "project" {} | ||
|
|
||
| resource "google_network_services_agent_connectivity_template" "{{$.PrimaryResourceId}}" { | ||
| agent_connectivity_template_id = "{{index $.ResourceIdVars "agent_connectivity_template_id"}}" | ||
| location = "us-central1" | ||
| description = "An updated configuration for Agent Connectivity Template" | ||
| labels = { | ||
| env = "prod" | ||
| tier = "platinum" | ||
| new_label = "added" | ||
| } | ||
|
|
||
| access_types = ["PUBLIC"] | ||
| access_path = "AGENT_TO_ANYWHERE" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add an update test here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Added an update test