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

feat: allow k6 operator service account in rdev/staging (CCIE-3437) #3586

Merged
merged 10 commits into from
Oct 3, 2024

Conversation

christophermanahan
Copy link
Collaborator

@christophermanahan christophermanahan commented Oct 2, 2024

CCIE-3437
Summary happy edu - Deploy and test k6 in staging
Type Story Story
Status To Do

Ticket: https://czi.atlassian.net/browse/CP-1504

Doc: https://czi.atlassian.net/wiki/spaces/ETE/pages/3192881220/PEMA+Project+End+Manual+Approvals

While Grafana k6 tests have been successfully POC’d in rdev via injection of the LinkerD sidecar into the test runner pods that are deployed by the k6 operator to test our private backend service endpoints - staging introduces LinkerD mesh access control lists that prevent the test runner pod from making successful requests to our services in staging. This PR adds the service account k6-operator-controller under the namespace k6-operator-system to the staging and rdev environments so that the test runner pods deployed by the k6 operator under the k6-operator-controller service account can make successful requests to the services in rdev and staging.

A test stack of the session service was deployed to staging with the happy config pointing to the git SHA associated with this PR and a successful test run to create a session was achieved in staging to validate this approach and change.

Screenshot 2024-10-02 at 12 27 52 PM

@christophermanahan christophermanahan requested a review from a team as a code owner October 2, 2024 15:53
@christophermanahan christophermanahan requested review from kuannie1, jakeyheath and ademartini-czi and removed request for a team October 2, 2024 15:53
Copy link
Contributor

github-actions bot commented Oct 2, 2024

No Jira issue reference found in branch, title, or body of PR.

Please add a reference to a Jira issue in the form of CCIE-#### (eg: CCIE-1400) to the branch name, title, or body of your PR.

Copy link
Contributor

github-actions bot commented Oct 2, 2024

No Jira issue reference found in branch, title, or body of PR.

Please add a reference to a Jira issue in the form of CCIE-#### (eg: CCIE-1400) to the branch name, title, or body of your PR.

@chanzuckerberg chanzuckerberg deleted a comment from github-actions bot Oct 2, 2024
Copy link
Contributor

github-actions bot commented Oct 2, 2024

No Jira issue reference found in branch, title, or body of PR.

Please add a reference to a Jira issue in the form of CCIE-#### (eg: CCIE-1400) to the branch name, title, or body of your PR.

1 similar comment
Copy link
Contributor

github-actions bot commented Oct 2, 2024

No Jira issue reference found in branch, title, or body of PR.

Please add a reference to a Jira issue in the form of CCIE-#### (eg: CCIE-1400) to the branch name, title, or body of your PR.

@kuannie1 kuannie1 changed the title feat: allow k6 operator service account in rdev/staging feat: allow k6 operator service account in rdev/staging (CCIE-3437) Oct 2, 2024
Copy link
Contributor

@kuannie1 kuannie1 left a comment

Choose a reason for hiding this comment

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

@christophermanahan instead of checking if you're in rdev or staging, do you think you can add another variable that's like, allow_k6_operator_controller with a description about grafana k6s? Then set the "default" to false so you can turn it on using that variable.

That way, we don't have the brittle logic about whether it's rdev or staging. Just something like this:

k6_operator_service_account = var.allow_k6_operator_controller ? [{
    "kind"      = "ServiceAccount"
    "name"      = "k6-operator-controller"
    "namespace" = "k6-operator-system"
  }] : []

more about variables here: https://developer.hashicorp.com/terraform/language/values/variables
We have variables.tf for blocks like this

@christophermanahan christophermanahan force-pushed the cmanahan/k6-operator-service-account branch 3 times, most recently from 1d3eb38 to b7e9da2 Compare October 2, 2024 20:55
@@ -32,7 +32,12 @@ variable "allow_mesh_services" {
description = "A list of service/stack that we want to allow access to this protected service"
}

variable "allow_k6_operator" {
type = bool
description = "A flag to allow the k6 operator to access this protected service"
Copy link
Contributor

Choose a reason for hiding this comment

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

add a default parameter here

@@ -296,6 +296,7 @@ variable "routing" {
success_codes : optional(string, "200-499")
service_type : string
service_mesh : bool
allow_k6_operator : bool
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
allow_k6_operator : bool
allow_k6_operator : optional(bool, true)

Copy link
Contributor

Choose a reason for hiding this comment

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

make match the default above

@christophermanahan christophermanahan force-pushed the cmanahan/k6-operator-service-account branch from 6b3ca7d to 201d4ee Compare October 2, 2024 21:02
@christophermanahan
Copy link
Collaborator Author

christophermanahan commented Oct 2, 2024

@christophermanahan instead of checking if you're in rdev or staging, do you think you can add another variable that's like, allow_k6_operator_controller with a description about grafana k6s? Then set the "default" to false so you can turn it on using that variable.

That way, we don't have the brittle logic about whether it's rdev or staging. Just something like this:

k6_operator_service_account = var.allow_k6_operator_controller ? [{
    "kind"      = "ServiceAccount"
    "name"      = "k6-operator-controller"
    "namespace" = "k6-operator-system"
  }] : []

more about variables here: https://developer.hashicorp.com/terraform/language/values/variables We have variables.tf for blocks like this

@kuannie1 Updated to be a variable, thank you for the review and suggestion!

@christophermanahan christophermanahan merged commit afd9685 into main Oct 3, 2024
33 checks passed
@christophermanahan christophermanahan deleted the cmanahan/k6-operator-service-account branch October 3, 2024 19:27
@czi-github-helper czi-github-helper bot mentioned this pull request Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants