generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 35
E2e rosa #482
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
Draft
okankoAMZ
wants to merge
41
commits into
main
Choose a base branch
from
e2e-rosa
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
E2e rosa #482
Changes from 31 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
97c5c36
cluster_test
okankoAMZ 4def8bf
added container insights test
okankoAMZ 6ae15ad
fixed fillEKS for rosa
okankoAMZ 976127e
fixed helm args
okankoAMZ 741d2e9
added k8smode
okankoAMZ 65f8fec
made sample app optional
okankoAMZ 7bb61cd
added security test
okankoAMZ ba23de2
updated rosa validation test
okankoAMZ 0ae2d3a
update gomod
okankoAMZ 12d6c58
update generator
okankoAMZ 263725e
added test name
okankoAMZ 946a0fb
fixed rosa cluster validation
okankoAMZ a6eb637
updated the generator
okankoAMZ 571765d
added diskio exception
okankoAMZ f59a3bc
change test-shell requirement
okankoAMZ 0f582ff
added terraform generation
okankoAMZ add1529
change vpc naming
okankoAMZ 4d2c5a5
changed iam to be per cluster
okankoAMZ 520e311
removed random string gen
okankoAMZ 3cf7d6d
appsig test
okankoAMZ 08456d6
improved resource creation and deletion
okankoAMZ d50bcaa
added configurable instance type
okankoAMZ 76cc1a1
added application signals test
okankoAMZ 79e69f3
added sample app field to generator
okankoAMZ edd8f8f
added patch
okankoAMZ ceb2416
wait for metric propagation
okankoAMZ 3501bd6
cleaned up security test
okankoAMZ e2cfd2d
added enhanced CI metrics
okankoAMZ 8bd4dc3
removed apiserver_storage_list_duration_seconds from rosa test
okankoAMZ 2acd622
added jitter and increased wait time
okankoAMZ 1f9b296
changed order of tests
okankoAMZ c08c84b
added json field to helm manager
okankoAMZ 54782f2
fixed jmx w helm wait
okankoAMZ 3314f15
fixed tomcat test w traffic gen
okankoAMZ c4a2c78
removed openshift version
okankoAMZ fe376c2
fixed jvm tomcat for rosa
okankoAMZ 09bc823
Merge branch 'main' into e2e-rosa
okankoAMZ 6303d0a
reformatted terraform
okankoAMZ aa180ea
addressed comments
okankoAMZ 78eef50
removed wait for sample app
okankoAMZ 54f41d6
fixing ci test
okankoAMZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| [ | ||
| { | ||
| "nodes": 2 | ||
| } | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,137 @@ | ||
| # | ||
| # Copyright (c) 2023 Red Hat, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: verify if we need to include this license |
||
| terraform { | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = ">= 4.20.0" | ||
| } | ||
| rhcs = { | ||
| version = ">= 1.6.3" | ||
| source = "terraform-redhat/rhcs" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| # Export token using the RHCS_TOKEN environment variable | ||
| variable "rhcs_token" { | ||
| } | ||
| provider "rhcs" { | ||
okankoAMZ marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| token = var.rhcs_token | ||
| } | ||
|
|
||
| provider "aws" { | ||
| region = var.aws_region | ||
| ignore_tags { | ||
| key_prefixes = ["kubernetes.io/"] | ||
| } | ||
| default_tags { | ||
| tags = var.default_aws_tags | ||
| } | ||
| } | ||
|
|
||
| data "aws_caller_identity" "current" {} | ||
| data "aws_availability_zones" "available" {} | ||
|
|
||
| locals { | ||
| # Extract availability zone names for the specified region, limit it to 3 if multi-az or 1 if single | ||
| region_azs = var.multi_az ? slice([for zone in data.aws_availability_zones.available.names : format("%s", zone)], 0, 3) : slice([for zone in data.aws_availability_zones.available.names : format("%s", zone)], 0, 1) | ||
| account_id = data.aws_caller_identity.current.account_id | ||
| } | ||
|
|
||
| locals { | ||
| worker_node_replicas = var.multi_az ? 3 : 2 | ||
| # If cluster_name is not null, use that, otherwise generate a random cluster name | ||
| cluster_name = coalesce(var.cluster_name, "cwa-rosa-test") | ||
| } | ||
|
|
||
| # The network validator requires an additional 60 seconds to validate Terraform clusters. | ||
| resource "time_sleep" "wait_60_seconds" { | ||
| count = var.create_vpc ? 1 : 0 | ||
| depends_on = [module.vpc] | ||
| create_duration = "60s" | ||
| } | ||
|
|
||
| module "hcp" { | ||
| source = "terraform-redhat/rosa-hcp/rhcs" | ||
| version = "1.6.5" | ||
| openshift_version = "4.17.14" | ||
|
|
||
| cluster_name = local.cluster_name | ||
| replicas = local.worker_node_replicas | ||
| aws_availability_zones = local.region_azs | ||
| private = var.private_cluster | ||
| aws_subnet_ids = var.create_vpc ? var.private_cluster ? module.vpc[0].private_subnets : concat(module.vpc[0].public_subnets, module.vpc[0].private_subnets) : var.aws_subnet_ids | ||
|
|
||
| create_oidc = true | ||
| create_account_roles = true | ||
| account_role_prefix = local.cluster_name | ||
| create_operator_roles = true | ||
| operator_role_prefix = local.cluster_name | ||
| create_admin_user = true | ||
|
|
||
| aws_billing_account_id = var.billing_account_id | ||
| ec2_metadata_http_tokens = "required" | ||
| compute_machine_type = var.instance_type | ||
|
|
||
| depends_on = [time_sleep.wait_60_seconds] | ||
| } | ||
|
|
||
|
|
||
| ############################ | ||
| # HTPASSWD IDP | ||
| ############################ | ||
|
|
||
| resource "aws_secretsmanager_secret" "secret" { | ||
| name = "${local.cluster_name}-htpasswd" | ||
|
|
||
| tags = { | ||
okankoAMZ marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Environment = "Production" | ||
| } | ||
| } | ||
| resource "aws_secretsmanager_secret_version" "secret_version" { | ||
| secret_id = aws_secretsmanager_secret.secret.id | ||
| secret_string = jsonencode({ | ||
| "openshift_password": module.hcp.cluster_admin_password | ||
| "openshift_username": module.hcp.cluster_admin_username | ||
| "openshift_server": module.hcp.cluster_api_url | ||
| }) | ||
| } | ||
|
|
||
| ############################ | ||
| # Setup CWA IAM | ||
| ############################ | ||
|
|
||
|
|
||
| locals { | ||
| cloudwatch_agent_role_arn = lookup(module.hcp.account_roles_arn, "HCP-ROSA-Worker") | ||
| } | ||
| # Output the ARN of the CloudWatch Agent IAM role | ||
| output "cloudwatch_agent_role_arn" { | ||
okankoAMZ marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| value = local.cloudwatch_agent_role_arn | ||
| description = "ARN of the IAM role created for the CloudWatch agent" | ||
| } | ||
|
|
||
| # Attach CloudWatchAgentServerPolicy to the role | ||
| resource "aws_iam_role_policy_attachment" "cloudwatch_agent_policy" { | ||
| role = split("/", local.cloudwatch_agent_role_arn)[1] | ||
| policy_arn = "arn:aws:iam::aws:policy/CloudWatchAgentServerPolicy" | ||
| } | ||
| # Attach CloudWatchAgentAppSignalPolicy to the role | ||
| resource "aws_iam_role_policy_attachment" "cloudwatch_agent_appsig_policy" { | ||
| role = split("/", local.cloudwatch_agent_role_arn)[1] | ||
| policy_arn = "arn:aws:iam::aws:policy/CloudWatchApplicationSignalsFullAccess" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| output "cluster_id" { | ||
| value = module.hcp.cluster_id | ||
| description = "Unique identifier of the cluster." | ||
| } | ||
|
|
||
| output "cluster_name" { | ||
| value = local.cluster_name | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this if you don't end up using it -- it's meant to determine the number of nodes on the cluster