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

prow-build-canary-cluster: provisioning scripts #5063

Merged
merged 13 commits into from
Apr 4, 2023

Conversation

pkprzekwas
Copy link
Contributor

@pkprzekwas pkprzekwas commented Mar 31, 2023

As we started migrating Prow jobs to EKS Prow, applying infrastructure changes on that cluster became risky. For that reason, here are changes for conditionally provisioning canary cluster.

This new cluster is meant for:

  • testing changes before applying on main EKS Prow Cluster,
  • playground for new solutions.

Can be considered as part of #4686

/assign @xmudrii @ameukam

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. area/infra Infrastructure management, infrastructure design, code in infra/ area/infra/aws Issues or PRs related to Kubernetes AWS infrastructure sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Mar 31, 2023
@k8s-ci-robot k8s-ci-robot requested review from dims and thockin March 31, 2023 16:17
@pkprzekwas
Copy link
Contributor Author

/assign @pkprzekwas

@pkprzekwas
Copy link
Contributor Author

/hold

After discussing with @xmudrii , I want to refactor this a bit.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 3, 2023
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Apr 3, 2023
@pkprzekwas pkprzekwas requested a review from xmudrii April 3, 2023 14:05
@pkprzekwas
Copy link
Contributor Author

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 3, 2023
Copy link
Member

@xmudrii xmudrii left a comment

Choose a reason for hiding this comment

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

Just two nits, otherwise LGTM.

data "aws_availability_zones" "available" {}

locals {
canary_prefix = terraform.workspace != "prod" ? "canary-" : ""
Copy link
Member

Choose a reason for hiding this comment

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

we want to be consistent about prefixes added:

Suggested change
canary_prefix = terraform.workspace != "prod" ? "canary-" : ""
canary_prefix = terraform.workspace != "prod-" ? "canary-" : ""

Copy link
Member

Choose a reason for hiding this comment

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

I also prefer we have a prefix variable defining the environment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking about that, but unfortunately we haven't planned that in advance. The production cluster has been already created and introducing prod- prefix would require re-provisioning.


# Recognize federated identities from the prow trusted cluster
resource "aws_iam_openid_connect_provider" "k8s_prow" {
count = terraform.workspace == "prod" ? 1 : 0
Copy link
Member

Choose a reason for hiding this comment

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

we are not creating a OIDC provider for the canary env ?

Copy link
Member

Choose a reason for hiding this comment

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

No, we don't have Prow on the canary environment. We use it only for testing infra changes, not Prow changes. That would require some additional effort if we want to go that route.

vpc_intra_subnet = ["10.5.0.0/18", "10.5.64.0/18", "10.5.128.0/18"]

# Ubuntu EKS optimized AMI: https://cloud-images.ubuntu.com/aws-eks/
node_ami = "ami-03de35fda144b3672"
Copy link
Member

Choose a reason for hiding this comment

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

we should replace this with a data resource.

Copy link
Member

Choose a reason for hiding this comment

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

I personally prefer binding the AMI. If we query the AMI, the node group is going to recreated each time there's a new AMI. That can affect running tests. We might want to be able to do run terraform apply without actually having to rotate nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't have strong opinion here. In case we want to keep this AMI hardcoded we need to think about its update schedule. AWS releases new AMIs pretty often.

@ameukam
Copy link
Member

ameukam commented Apr 3, 2023

Thank you for working on this!

My understanding is that we'll use the same AWS account for prod and canary clusters, which I'm not sure is the desired state. I believe that account isolation can help us reduce security risks associated with access.

@xmudrii
Copy link
Member

xmudrii commented Apr 3, 2023

@ameukam I can see with @hh about getting a new account.

Copy link
Member

@xmudrii xmudrii left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/hold
for @ameukam to take a look

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Apr 4, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pkprzekwas, xmudrii

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

The pull request process is described 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

@ameukam
Copy link
Member

ameukam commented Apr 4, 2023

/lgtm

@xmudrii
Copy link
Member

xmudrii commented Apr 4, 2023

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 4, 2023
@k8s-ci-robot k8s-ci-robot merged commit 4622846 into kubernetes:main Apr 4, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.28 milestone Apr 4, 2023
@pkprzekwas pkprzekwas deleted the prow-build-canary-cluster branch July 6, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/infra/aws Issues or PRs related to Kubernetes AWS infrastructure area/infra Infrastructure management, infrastructure design, code in infra/ cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/k8s-infra Categorizes an issue or PR as relevant to SIG K8s Infra. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants