Skip to content

Commit

Permalink
Update readme & Gitops housekeeping (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarvesh-cast authored Nov 7, 2024
1 parent c4d6ee8 commit b6348c8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
6 changes: 4 additions & 2 deletions examples/eks/eks_cluster_existing/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@ terraform destroy -var-file=tf.vars

> **Note**
>
> If you are onboarding existing cluster to CAST AI
> If you are onboarding existing eks cluster to CAST AI
0. Set Profile in AWS CLI
AWS CLI profile is already set to default, override if only required.
1. If your eks cluster authentication mode is API/API_CONFIGMAP - TF will update role in IAM access entries (No user action needed)
2. If your eks cluster authentication mode is CONFIGMAP - you need to also update [aws-auth](https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html) configmap. In the configmap instance profile
> used by CAST AI has to be present. Example of entry can be found [here](https://github.com/castai/terraform-provider-castai/blob/157babd57b0977f499eb162e9bee27bee51d292a/examples/eks/eks_cluster_autoscaler_polices/eks.tf#L28-L38).

Please refer to this guide if you run into any issues https://docs.cast.ai/docs/terraform-troubleshooting
Please refer to this guide if you run into any issues https://docs.cast.ai/docs/terraform-troubleshooting
3 changes: 2 additions & 1 deletion examples/eks/eks_cluster_existing/tf.vars.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ grpc_url = ""
vpc_id = ""
cluster_security_group_id = ""
node_security_group_id = ""
subnets = ["", ""]
subnets = ["", ""]
profile = "default" # default aws cli profile is used, override if needed.
12 changes: 11 additions & 1 deletion examples/eks/eks_cluster_gitops/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ Helm Managed ==> All Castware components such as `castai-agent`, `castai-cluste
+-------------------------+
| Start |
+-------------------------+
|
| Set Profile in AWS CLI
|
+-------------------------+
| 0. AWS CLI profile is already set to default,override if only required
|
+-------------------------+
|
| AWS CLI
+-------------------------+
| 1.Check EKS Auth Mode is API/API_CONFIGMAP
Expand Down Expand Up @@ -52,6 +58,10 @@ Prerequisites:
- Obtained CAST AI [API Access key](https://docs.cast.ai/docs/authentication#obtaining-api-access-key) with Full Access


### Step 0: Set Profile in AWS CLI
AWS CLI profile is already set to default, override if only required.


### Step 1: Get EKS cluster authentication mode
```
CLUSTER_NAME=""
Expand Down
15 changes: 2 additions & 13 deletions examples/eks/eks_cluster_gitops/castai.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
# Create IAM resources required for connecting cluster to CAST AI.
locals {
resource_name_postfix = var.aws_cluster_name
account_id = data.aws_caller_identity.current.account_id
partition = data.aws_partition.current.partition

instance_profile_role_name = "castai-eks-${local.resource_name_postfix}-node-role"
iam_role_name = "castai-eks-${local.resource_name_postfix}-cluster-role"
iam_inline_policy_name = "CastEKSRestrictedAccess"
role_name = "castai-eks-role"
}

data "aws_caller_identity" "current" {}

data "aws_partition" "current" {}
Expand Down Expand Up @@ -49,7 +38,7 @@ locals {

resource "aws_eks_access_entry" "access_entry" {
count = local.access_entry ? 1 : 0
cluster_name = local.resource_name_postfix
cluster_name = var.aws_cluster_name
principal_arn = module.castai-eks-role-iam.instance_profile_role_arn
type = "EC2_LINUX"
}
Expand All @@ -58,7 +47,7 @@ resource "aws_eks_access_entry" "access_entry" {
resource "castai_eks_cluster" "my_castai_cluster" {
account_id = var.aws_account_id
region = var.aws_cluster_region
name = local.resource_name_postfix
name = var.aws_cluster_name
delete_nodes_on_disconnect = var.delete_nodes_on_disconnect
assume_role_arn = module.castai-eks-role-iam.role_arn
}
Expand Down
1 change: 1 addition & 0 deletions examples/eks/eks_cluster_gitops/tf.vars.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ subnets = ["PLACEHOLDER1", "PLACEHOLDER2"]
vpc_id = "PLACEHOLDER"
cluster_security_group_id = ["PLACEHOLDER1"]
node_security_group_id = ["PLACEHOLDER1]
profile = "default" # default aws cli profile is used, override if needed.

0 comments on commit b6348c8

Please sign in to comment.