Skip to content

Commit 923453e

Browse files
authored
feat: add project field support to cluster data (#317)
1 parent a42741a commit 923453e

File tree

10 files changed

+23
-4
lines changed

10 files changed

+23
-4
lines changed

akp/apis/v1alpha1/cluster.go

+1
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,5 @@ type ClusterData struct {
6666

6767
MultiClusterK8SDashboardEnabled *bool `json:"multiClusterK8sDashboardEnabled,omitempty"`
6868
AutoscalerConfig *AutoScalerConfig `json:"autoscalerConfig,omitempty"`
69+
Project string `json:"project,omitempty"`
6970
}

akp/data_source_akp_cluster_schema.go

+4
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ func getClusterDataDataSourceAttributes() map[string]schema.Attribute {
131131
Computed: true,
132132
Attributes: getCustomAgentSizeConfigDataSourceAttributes(),
133133
},
134+
"project": schema.StringAttribute{
135+
MarkdownDescription: "Project name",
136+
Computed: true,
137+
},
134138
}
135139
}
136140

akp/resource_akp_cluster_schema.go

+8
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,14 @@ func getClusterDataAttributes() map[string]schema.Attribute {
231231
Optional: true,
232232
Attributes: getCustomAgentSizeConfigAttributes(),
233233
},
234+
"project": schema.StringAttribute{
235+
MarkdownDescription: "Project name",
236+
Optional: true,
237+
Computed: true,
238+
PlanModifiers: []planmodifier.String{
239+
stringplanmodifier.UseStateForUnknown(),
240+
},
241+
},
234242
}
235243
}
236244

akp/types/cluster.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ type ClusterData struct {
8888
EksAddonEnabled types.Bool `tfsdk:"eks_addon_enabled"`
8989
ManagedClusterConfig *ManagedClusterConfig `tfsdk:"managed_cluster_config"`
9090
MultiClusterK8SDashboardEnabled types.Bool `tfsdk:"multi_cluster_k8s_dashboard_enabled"`
91-
AutoscalerConfig basetypes.ObjectValue `tfsdk:"auto_agent_size_config"`
9291
CustomAgentSizeConfig *CustomAgentSizeConfig `tfsdk:"custom_agent_size_config"`
92+
AutoscalerConfig basetypes.ObjectValue `tfsdk:"auto_agent_size_config"`
93+
Project types.String `tfsdk:"project"`
9394
}

akp/types/types.go

+2
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ func (c *Cluster) Update(ctx context.Context, diagnostics *diag.Diagnostics, api
286286
MultiClusterK8SDashboardEnabled: tftypes.BoolValue(apiCluster.GetData().GetMultiClusterK8SDashboardEnabled()),
287287
AutoscalerConfig: autoscalerConfig,
288288
CustomAgentSizeConfig: customConfig,
289+
Project: tftypes.StringValue(apiCluster.GetData().GetProject()),
289290
},
290291
}
291292
}
@@ -476,6 +477,7 @@ func toClusterDataAPIModel(ctx context.Context, diagnostics *diag.Diagnostics, c
476477
ManagedClusterConfig: managedConfig,
477478
MultiClusterK8SDashboardEnabled: toBoolPointer(clusterData.MultiClusterK8SDashboardEnabled),
478479
AutoscalerConfig: autoscalerConfigAPI,
480+
Project: clusterData.Project.ValueString(),
479481
}
480482
}
481483

docs/data-sources/cluster.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ Read-Only:
8585
- `kustomization` (String) Kustomize configuration that will be applied to generated agent installation manifests
8686
- `managed_cluster_config` (Attributes) The config to access managed Kubernetes cluster. By default agent is using "in-cluster" config. (see [below for nested schema](#nestedatt--spec--data--managed_cluster_config))
8787
- `multi_cluster_k8s_dashboard_enabled` (Boolean) Enable the KubeVision feature on the managed cluster
88+
- `project` (String) Project name
8889
- `redis_tunneling` (Boolean) Enables the ability to connect to Redis over a web-socket tunnel that allows using Akuity agent behind HTTPS proxy
8990
- `size` (String) Cluster Size. One of `small`, `medium`, `large`, `custom` or `auto`
9091
- `target_version` (String) The version of the agent to install on your cluster

docs/data-sources/clusters.md

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Read-Only:
9696
- `kustomization` (String) Kustomize configuration that will be applied to generated agent installation manifests
9797
- `managed_cluster_config` (Attributes) The config to access managed Kubernetes cluster. By default agent is using "in-cluster" config. (see [below for nested schema](#nestedatt--clusters--spec--data--managed_cluster_config))
9898
- `multi_cluster_k8s_dashboard_enabled` (Boolean) Enable the KubeVision feature on the managed cluster
99+
- `project` (String) Project name
99100
- `redis_tunneling` (Boolean) Enables the ability to connect to Redis over a web-socket tunnel that allows using Akuity agent behind HTTPS proxy
100101
- `size` (String) Cluster Size. One of `small`, `medium`, `large`, `custom` or `auto`
101102
- `target_version` (String) The version of the agent to install on your cluster

docs/resources/cluster.md

+1
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ Optional:
253253
- `kustomization` (String) Kustomize configuration that will be applied to generated agent installation manifests
254254
- `managed_cluster_config` (Attributes) The config to access managed Kubernetes cluster. By default agent is using "in-cluster" config. (see [below for nested schema](#nestedatt--spec--data--managed_cluster_config))
255255
- `multi_cluster_k8s_dashboard_enabled` (Boolean) Enable the KubeVision feature on the managed cluster
256+
- `project` (String) Project name
256257
- `redis_tunneling` (Boolean) Enables the ability to connect to Redis over a web-socket tunnel that allows using Akuity agent behind HTTPS proxy
257258
- `target_version` (String) The version of the agent to install on your cluster
258259

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.23.0
55
toolchain go1.23.1
66

77
require (
8-
github.com/akuity/api-client-go v0.20.1
8+
github.com/akuity/api-client-go v0.21.3
99
github.com/akuity/grpc-gateway-client v0.0.0-20240912082144-55a48e8b4b89
1010
github.com/hashicorp/terraform-plugin-docs v0.20.1
1111
github.com/hashicorp/terraform-plugin-framework v1.14.1

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ github.com/ProtonMail/go-crypto v1.1.0-alpha.2 h1:bkyFVUP+ROOARdgCiJzNQo2V2kiB97
2222
github.com/ProtonMail/go-crypto v1.1.0-alpha.2/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE=
2323
github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
2424
github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
25-
github.com/akuity/api-client-go v0.20.1 h1:OhATFkxJtCeN86vb+L1oaA9JNJBLPZbkr75DJjk8pOE=
26-
github.com/akuity/api-client-go v0.20.1/go.mod h1:l1KysY8NXHVy2yN3+vEyygqKIqVEWvA78dTw0lShCUE=
25+
github.com/akuity/api-client-go v0.21.3 h1:vuWRmRiF0CMLdgK/EWRK84XgOCV1pCSaA+N0a/PnOIU=
26+
github.com/akuity/api-client-go v0.21.3/go.mod h1:l1KysY8NXHVy2yN3+vEyygqKIqVEWvA78dTw0lShCUE=
2727
github.com/akuity/grpc-gateway-client v0.0.0-20240912082144-55a48e8b4b89 h1:TNZN2oYHs6ymIMyDeVu6RnwNowChc/q4U/p7ruHA/GM=
2828
github.com/akuity/grpc-gateway-client v0.0.0-20240912082144-55a48e8b4b89/go.mod h1:0MZqOxL+zq+hGedAjYhkm1tOKuZyjUmE/xA8nqXa9q0=
2929
github.com/alevinval/sse v1.0.1 h1:cFubh2lMNdHT6niFLCsyTuhAgljaAWbdmceAe6qPIfo=

0 commit comments

Comments
 (0)