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

direct: Generate crd and upload status.externalRef #2599

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

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" "bigquerydatatransferconfig")
excluded_resources=("bigquerydatatransferconfig")

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" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch!

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
Loading