Skip to content

Commit

Permalink
Generate crd and upload status.externalRef
Browse files Browse the repository at this point in the history
  • Loading branch information
gemmahou committed Sep 5, 2024
1 parent 0bbac86 commit 3970d4e
Show file tree
Hide file tree
Showing 10 changed files with 246 additions and 184 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dev/tasks/generate-crds
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ go run ./scripts/crd-tools reflow-descriptions --dir apis/config/crd/

# excluded_resources are resources that are under development for a direct conversion
# we don't modify the CRD just yet for those but will in the future
excluded_resources=("computeforwardingrule")
# i.e. excluded_resources=("computeforwardingrule")

cd ${REPO_ROOT}
cd apis/config/crd/
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *ForwardingRuleIdentity) FullyQualifiedName() string {
if c.location == "global" {
return fmt.Sprintf("projects/%s/global/forwardingrules/%s", c.project, c.forwardingRule)
} else {
return fmt.Sprintf("projects/%s/locations/%s/forwardingrules/%s", c.project, c.location, c.forwardingRule)
return fmt.Sprintf("projects/%s/regions/%s/forwardingrules/%s", c.project, c.location, c.forwardingRule)
}
}

Expand All @@ -53,14 +53,14 @@ func asID(externalRef string) (*ForwardingRuleIdentity, error) {
}
path := strings.TrimPrefix(externalRef, serviceDomain+"/")
tokens := strings.Split(path, "/")
if len(tokens) == 5 || tokens[0] == "projects" || tokens[2] == "global" || tokens[3] == "forwardingrules" {
if len(tokens) == 5 && tokens[0] == "projects" && tokens[2] == "global" && tokens[3] == "forwardingrules" {
return &ForwardingRuleIdentity{
project: tokens[1],
location: "global",
forwardingRule: tokens[4],
}, nil
}
if len(tokens) == 6 || tokens[0] == "projects" || tokens[2] == "locations" || tokens[4] == "forwardingrules" {
if len(tokens) == 6 && tokens[0] == "projects" && tokens[2] == "regions" && tokens[4] == "forwardingrules" {
return &ForwardingRuleIdentity{
project: tokens[1],
location: tokens[3],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ status:
status: "True"
type: Ready
creationTimestamp: "1970-01-01T00:00:00Z"
externalRef: //compute.googleapis.com/projects/${projectId}/global/forwardingrules/computeglobalforwardingrule-${uniqueId}
labelFingerprint: abcdef0123A=
observedGeneration: 2
selfLink: https://www.googleapis.com/compute/v1/projects/${projectId}/global/forwardingRules/computeglobalforwardingrule-${uniqueId}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ status:
status: "True"
type: Ready
creationTimestamp: "1970-01-01T00:00:00Z"
externalRef: //compute.googleapis.com/projects/${projectId}/regions/us-central1/forwardingrules/computeregionalforwardingrule-${uniqueId}
labelFingerprint: abcdef0123A=
observedGeneration: 1
selfLink: https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/computeregionalforwardingrule-${uniqueId}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ status:
status: "True"
type: Ready
creationTimestamp: "1970-01-01T00:00:00Z"
externalRef: //compute.googleapis.com/projects/${projectId}/regions/us-central1/forwardingrules/computeforwardingrule-${uniqueId}
labelFingerprint: abcdef0123A=
observedGeneration: 1
selfLink: https://www.googleapis.com/compute/v1/projects/${projectId}/regions/us-central1/forwardingRules/computeforwardingrule-${uniqueId}
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,46 @@ X-Xss-Protection: 0
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "insert",
"progress": 0,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "DONE"
"status": "RUNNING",
"targetId": "${addressesId}",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}",
"user": "[email protected]"
}

---

GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}?alt=json&prettyPrint=false
User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"endTime": "2024-04-01T12:34:56.123456Z",
"id": "000000000000000000000",
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "insert",
"progress": 100,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "DONE",
"targetId": "${addressesId}",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}",
"user": "[email protected]"
}

---
Expand Down Expand Up @@ -1152,10 +1188,46 @@ X-Xss-Protection: 0
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "delete",
"progress": 0,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "DONE"
"status": "RUNNING",
"targetId": "${addressesId}",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}",
"user": "[email protected]"
}

---

GET https://compute.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}?alt=json&prettyPrint=false
User-Agent: google-api-go-client/0.5 Terraform/ (+https://www.terraform.io) Terraform-Plugin-SDK/2.10.1 terraform-provider-google-beta/kcc/controller-manager

200 OK
Cache-Control: private
Content-Type: application/json; charset=UTF-8
Server: ESF
Vary: Origin
Vary: X-Origin
Vary: Referer
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-Xss-Protection: 0

{
"endTime": "2024-04-01T12:34:56.123456Z",
"id": "000000000000000000000",
"insertTime": "2024-04-01T12:34:56.123456Z",
"kind": "compute#operation",
"name": "${operationID}",
"operationType": "delete",
"progress": 100,
"selfLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/operations/${operationID}",
"startTime": "2024-04-01T12:34:56.123456Z",
"status": "DONE",
"targetId": "${addressesId}",
"targetLink": "https://www.googleapis.com/compute/v1/projects/${projectId}/global/addresses/computeaddress-${uniqueId}",
"user": "[email protected]"
}

---
Expand Down
Loading

0 comments on commit 3970d4e

Please sign in to comment.