Skip to content

Commit 8e008d5

Browse files
author
Pawel Peksa
committed
PRICE-553: add terraform support for pod mutations
1 parent 7033f41 commit 8e008d5

File tree

12 files changed

+6492
-13
lines changed

12 files changed

+6492
-13
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export SWAGGER_LOCATION ?= https://$(API_HOST)/v1/spec/openapi.json
88
SDK_SPECS := \
99
cluster_autoscaler:HibernationSchedulesAPI:https://$(API_HOST)/spec/cluster-autoscaler/openapi.yaml \
1010
organization_management:EnterpriseAPI:https://$(API_HOST)/spec/organization-management/openapi.yaml \
11-
omni:EdgeLocationsAPI,ClustersAPI:https://$(API_HOST)/spec/omni/openapi.yaml
11+
omni:EdgeLocationsAPI,ClustersAPI:https://$(API_HOST)/spec/omni/openapi.yaml \
12+
patching_engine:PodMutationsAPI:https://$(API_HOST)/spec/patching-engine/openapi.yaml
1213

1314
default: build
1415

castai/provider.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ import (
1313
"github.com/castai/terraform-provider-castai/castai/sdk/cluster_autoscaler"
1414
"github.com/castai/terraform-provider-castai/castai/sdk/omni"
1515
"github.com/castai/terraform-provider-castai/castai/sdk/organization_management"
16+
"github.com/castai/terraform-provider-castai/castai/sdk/patching_engine"
1617
)
1718

1819
type ProviderConfig struct {
1920
api sdk.ClientWithResponsesInterface
2021
clusterAutoscalerClient cluster_autoscaler.ClientWithResponsesInterface
2122
organizationManagementClient organization_management.ClientWithResponsesInterface
2223
omniAPI *omni.ClientWithResponses
24+
patchingEngineClient patching_engine.ClientWithResponsesInterface
2325
}
2426

2527
func Provider(version string) *schema.Provider {
@@ -74,17 +76,18 @@ func Provider(version string) *schema.Provider {
7476
"castai_cache_group": resourceCacheGroup(),
7577
"castai_cache_configuration": resourceCacheConfiguration(),
7678
"castai_cache_rule": resourceCacheRule(),
79+
"castai_pod_mutation": resourcePodMutation(),
7780
},
7881

7982
DataSourcesMap: map[string]*schema.Resource{
80-
"castai_eks_settings": dataSourceEKSSettings(),
81-
"castai_gke_user_policies": dataSourceGKEPolicies(),
82-
"castai_organization": dataSourceOrganization(),
83-
"castai_rebalancing_schedule": dataSourceRebalancingSchedule(),
84-
"castai_hibernation_schedule": dataSourceHibernationSchedule(),
85-
"castai_workload_scaling_policy_order": dataSourceWorkloadScalingPolicyOrder(),
86-
"castai_cache_group": dataSourceCacheGroup(),
87-
"castai_impersonation_service_account": dataSourceImpersonationServiceAccount(),
83+
"castai_eks_settings": dataSourceEKSSettings(),
84+
"castai_gke_user_policies": dataSourceGKEPolicies(),
85+
"castai_organization": dataSourceOrganization(),
86+
"castai_rebalancing_schedule": dataSourceRebalancingSchedule(),
87+
"castai_hibernation_schedule": dataSourceHibernationSchedule(),
88+
"castai_workload_scaling_policy_order": dataSourceWorkloadScalingPolicyOrder(),
89+
"castai_cache_group": dataSourceCacheGroup(),
90+
"castai_impersonation_service_account": dataSourceImpersonationServiceAccount(),
8891
},
8992

9093
ConfigureContextFunc: providerConfigure(version),
@@ -127,11 +130,17 @@ func providerConfigure(version string) schema.ConfigureContextFunc {
127130
return nil, diag.FromErr(err)
128131
}
129132

133+
patchingEngineClient, err := patching_engine.CreateClient(apiURL, apiToken, agent)
134+
if err != nil {
135+
return nil, diag.FromErr(err)
136+
}
137+
130138
return &ProviderConfig{
131139
api: client,
132140
clusterAutoscalerClient: clusterAutoscalerClient,
133141
organizationManagementClient: organizationManagementClient,
134142
omniAPI: omniClient,
143+
patchingEngineClient: patchingEngineClient,
135144
}, nil
136145
}
137146
}

0 commit comments

Comments
 (0)