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

[DRAFT] Add description for resources & examples for resources/datasources #362

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions castai/resource_eks_cluster_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func resourceEKSClusterID() *schema.Resource {
CreateContext: resourceEKSClusterIDCreate,
ReadContext: resourceEKSClusterIDRead,
DeleteContext: resourceEKSClusterIDDelete,
Description: "Retrieve CAST AI clusterid",
Schema: map[string]*schema.Schema{
"account_id": {
Type: schema.TypeString,
Expand Down
1 change: 1 addition & 0 deletions castai/resource_eks_cluster_userarn.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func resourceEKSClusterUserARN() *schema.Resource {
ReadContext: resourceEKSUserARNRead,
CreateContext: resourceEKSUserARNCreate,
DeleteContext: resourceEKSUserARNDelete,
Description: "Retrieve EKS Cluster user arn",
Schema: map[string]*schema.Schema{
EKSClusterUserARNFieldClusterID: {
Type: schema.TypeString,
Expand Down
3 changes: 3 additions & 0 deletions castai/resource_eviction_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,17 @@ func resourceEvictionConfig() *schema.Resource {
FieldEvictionOptionDisabled: {
Type: schema.TypeBool,
Optional: true,
Description: "Marking pods as removalDisabled",
},
FieldEvictionOptionAggressive: {
Type: schema.TypeBool,
Description: "Apply Aggressive mode to Evictor",
Optional: true,
},
FieldEvictionOptionDisposable: {
Type: schema.TypeBool,
Optional: true,
Description: "Marking node as disposable",
},
},
},
Expand Down
11 changes: 9 additions & 2 deletions castai/resource_node_configuration_gke_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

const (
// acceptanceTestClusterSubnetworkName points to the subnet that the acceptance test cluster uses.
// Actual value (should) be managed by our IaC repository and could be shared with other clusters as well.
acceptanceTestClusterSubnetworkName = "ext-prov-e2e-shared-ip-range-nodes"
)

func TestAccResourceNodeConfiguration_gke(t *testing.T) {
rName := fmt.Sprintf("%v-node-cfg-%v", ResourcePrefix, acctest.RandString(8))
resourceName := "castai_node_configuration.test"
Expand Down Expand Up @@ -127,14 +133,15 @@ resource "castai_gke_cluster" "test" {
}

func testAccGCPConfig(rName, clusterName, projectID string) string {

return fmt.Sprintf(`
locals {
service_account_id = %[3]q
cluster_name = %[1]q
service_account_email = "${local.service_account_id}@$%[2]s.iam.gserviceaccount.com"
custom_role_id = "castai.tfAcc.${substr(sha1(local.service_account_id),0,8)}.tf"
subnet_id = "projects/%[2]s/regions/us-central1/subnetworks/%[1]s-ip-range-nodes"
subnet_id = "projects/%[2]s/regions/us-central1/subnetworks/%[4]s"
}
resource "google_service_account" "castai_service_account" {
Expand Down Expand Up @@ -177,5 +184,5 @@ resource "google_service_account_key" "castai_key" {
public_key_type = "TYPE_X509_PEM_FILE"
}
`, clusterName, projectID, rName)
`, clusterName, projectID, rName, acceptanceTestClusterSubnetworkName)
}
4 changes: 2 additions & 2 deletions castai/resource_node_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -984,9 +984,9 @@ func updateDefaultNodeTemplate(ctx context.Context, d *schema.ResourceData, meta
for _, d := range diagnostics {
if d.Severity == diag.Error {
if strings.Contains(d.Summary, "node template not found") {
return retry.RetryableError(fmt.Errorf(d.Summary))
return retry.RetryableError(fmt.Errorf("%s", d.Summary))
}
return retry.NonRetryableError(fmt.Errorf(d.Summary))
return retry.NonRetryableError(fmt.Errorf("%s", d.Summary))
}
}
return nil
Expand Down
8 changes: 8 additions & 0 deletions castai/sdk/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion docs/data-sources/eks_settings.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions docs/data-sources/gke_user_policies.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/data-sources/organization.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 46 additions & 1 deletion docs/resources/autoscaler.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions docs/resources/eks_clusterid.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions docs/resources/eks_user_arn.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 32 additions & 4 deletions docs/resources/evictor_advanced_config.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 56 additions & 1 deletion docs/resources/node_template.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions docs/resources/organization_members.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading