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

CORS-3220: Prepare GCP CAPI Installation #7978

Closed

Conversation

barbacbd
Copy link
Contributor

@barbacbd barbacbd commented Feb 1, 2024

** Added dns resource creation including:
- privateManagedZone
- Private DNS Records
- Public DNS Record (when appropriate)

** Labels are added with the function to add the owned tag
** Network Resources including compute Address for the load balancers and health checks
** Create the resources when control plane nodes are available.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Feb 1, 2024
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Feb 1, 2024

@barbacbd: This pull request references CORS-3220 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.16.0" version, but no target version was set.

In response to this:

** Added dns resource creation including:

  • privateManagedZone
  • Private DNS Records
  • Public DNS Record (when appropriate)

** Labels are added with the function to add the owned tag
** Network Resources including compute Address for the load balancers and health checks
** Create the resources when control plane nodes are available.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 1, 2024
@barbacbd
Copy link
Contributor Author

barbacbd commented Feb 1, 2024

/label platform/google

Copy link
Contributor

openshift-ci bot commented Feb 1, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from barbacbd. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@barbacbd barbacbd changed the title WIP: CORS-3220: Prepare GCP CAPI Installation CORS-3220: Prepare GCP CAPI Installation Feb 5, 2024
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 5, 2024
@barbacbd
Copy link
Contributor Author

barbacbd commented Feb 5, 2024

/retest-required

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 6, 2024
** Added dns resource creation including:
- privateManagedZone
- Private DNS Records
- Public DNS Record (when appropriate)
** Labels are added with the function to add the owned tag
** Network Resources including compute Address for the load balancers and health checks
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 6, 2024
…r ignition.

** Add creation of Bucket, BucketObject, and Signed URL.
** Add ability to update/set the contents of the Bucket Object after the signed url
has been added to the bootstrap machine. This allows us to create the storage object
then update its contents after the ignition data can be edited.
@barbacbd barbacbd force-pushed the CORS-3220-network-resources branch 2 times, most recently from dae648f to 4a857a1 Compare February 6, 2024 15:33
Copy link
Contributor

@patrickdillon patrickdillon left a comment

Choose a reason for hiding this comment

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

I did an initial review. During which I realized CAPG does not support internal clusters, so we will need to plan around that.

gcptypes "github.com/openshift/installer/pkg/types/gcp"
)

type Provider struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

We want a build-time check that the Provider type is implementing any interfaces that it intends to implement. E.g. if it implements the Ignition interface, we want to check that at build time:

var _ clusterapi.IgnitionProvider = (*Provider)(nil)

Comment on lines 50 to 57
privateZoneName := fmt.Sprintf("%s-private-zone", clusterID.InfraID)
potentialPrivateZoneName, err := getDNSZoneName(ctx, ic, false)
if err != nil {
return nil, err
}
if potentialPrivateZoneName != "" {
privateZoneName = potentialPrivateZoneName
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a comment explaining why we need the potentialPrivateZoneName? I believe that is if we are using an existing private zone... and is currently only supported for shared VPC? A quick comment clarifying this might make it more understandable. I think existing or preexisting or user may be better prefix than potential

pkg/infrastructure/gcp/clusterapi/dns.go Outdated Show resolved Hide resolved
pkg/infrastructure/gcp/clusterapi/dns.go Outdated Show resolved Hide resolved
Comment on lines 30 to 37
apiIntIPAddress, err := createLoadBalancerAddress(ctx, in.InstallConfig, in.InfraID, "", internalLoadBalancer)
if err != nil {
return nil
}
apiIPAddress, err := createLoadBalancerAddress(ctx, in.InstallConfig, in.InfraID, "", externalLoadBalancer)
if err != nil {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

CAPI should be creating one of the load balancers already, and we should create the other one (if applicable). It looks like CAPG does not support "private clusters": kubernetes-sigs/cluster-api-provider-gcp#903, which means it can't create the internal LB.

So at the simplest level, we should just create the internal LB and we will have the split-horizon for a normal install.

But ideally what we want to do is implement private cluster support in CAPG, then add the external LB when it is a public cluster.

return nil, nil
}

func (p Provider) InfraReady(ctx context.Context, in clusterapi.InfraReadyInput) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't had a chance to review how nodes are added to LBs in GCP, but this InfraReady hook is executed prior to machine creation. I suspect we want to run LB creation in the PostProvision hook so that machines can be joined to the LBs.

Comment on lines 65 to 75
apiIntIPAddress, err := createLoadBalancerAddress(ctx, in.InstallConfig, in.InfraID, "", internalLoadBalancer)
if err != nil {
return nil
}
apiIPAddress, err := createLoadBalancerAddress(ctx, in.InstallConfig, in.InfraID, "", externalLoadBalancer)
if err != nil {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Hm. This is just creating the LB addresses.

  • for the capi-provisioned LB, CAPI will publish the ControlPlaneEndpoint value that we can use
  • for the non-capi-provisioned LB we will need to create the complete LB

@patrickdillon
Copy link
Contributor

we should break apart the ignition and LB implementations into separate prs

Copy link
Contributor

@vincepri vincepri left a comment

Choose a reason for hiding this comment

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

first round of reviews, great progress so far!

Comment on lines +87 to +92
var credsMap map[string]interface{}
if err := json.Unmarshal(session.Credentials.JSON, &credsMap); err != nil {
return "", err
}
opts.GoogleAccessID = credsMap["client_email"].(string)
opts.PrivateKey = []byte(credsMap["private_key"].(string))
Copy link
Contributor

Choose a reason for hiding this comment

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

We could use a typed struct here instead of map[string]interface? Something like:

type gcpCredentials struct {
   ClientEmail string `json:"client_email"`
   PrivateKey []byte `json:"private_key"`
}

Expires: time.Now().Add(time.Minute * 60),
}

ctx := context.Background()
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we pass the context in?

Labels: mergeLabels(ic, clusterID),
}

ctx, cancel := context.WithTimeout(ctx, time.Second*60)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we pass the context in?


// CreateBucketHandle will create the bucket handle that can be used as a reference for other storage resources.
func CreateBucketHandle(ctx context.Context, bucketName string) (*storage.BucketHandle, error) {
ctx, cancel := context.WithTimeout(ctx, time.Second*60)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ctx, cancel := context.WithTimeout(ctx, time.Second*60)
ctx, cancel := context.WithTimeout(ctx, time.Minute*1)

To be consistent with the timeout below

pkg/infrastructure/gcp/clusterapi/bootstrap.go Outdated Show resolved Hide resolved
pkg/infrastructure/gcp/clusterapi/bootstrap.go Outdated Show resolved Hide resolved
pkg/infrastructure/gcp/clusterapi/bootstrap.go Outdated Show resolved Hide resolved
pkg/infrastructure/gcp/clusterapi/clusterapi.go Outdated Show resolved Hide resolved
pkg/infrastructure/gcp/clusterapi/clusterapi.go Outdated Show resolved Hide resolved
** Add the ignition stage. The ignition stage will create a GCP storage bucket and a
signed url. The Bucket is filled with the original data intended for ignition, and the
shim will contain the url.
** using the backend service (public load balancer) that is created by CAPG
** Adding the backend service for the private cluster install. This will be removed
when capg supports internal/private clusters.
Copy link
Contributor

openshift-ci bot commented Feb 8, 2024

@barbacbd: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-secureboot a830807 link false /test e2e-gcp-secureboot
ci/prow/gofmt a830807 link true /test gofmt
ci/prow/golint a830807 link true /test golint

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 11, 2024
@openshift-merge-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@barbacbd
Copy link
Contributor Author

/close

@openshift-ci openshift-ci bot closed this Feb 14, 2024
Copy link
Contributor

openshift-ci bot commented Feb 14, 2024

@barbacbd: Closed this PR.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. platform/google
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants