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 4, 2024
1 parent e63c5ad commit a659a9b
Show file tree
Hide file tree
Showing 9 changed files with 172 additions and 182 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}
Loading

0 comments on commit a659a9b

Please sign in to comment.