Skip to content

Commit 62b8453

Browse files
authored
Merge pull request #379 from ovh/revert-373-kube/feat/kube_proxy_mode
Revert "feat(kube): Let user configure kube proxy"
2 parents d52c7e6 + 8810b91 commit 62b8453

9 files changed

+154
-1492
lines changed

ovh/data_cloud_project_kube.go

+5-138
Original file line numberDiff line numberDiff line change
@@ -29,77 +29,28 @@ func dataSourceCloudProjectKube() *schema.Resource {
2929
Type: schema.TypeString,
3030
Optional: true,
3131
},
32-
kubeClusterProxyModeKey: {
33-
Type: schema.TypeString,
34-
Optional: true,
35-
ForceNew: true,
36-
},
37-
kubeClusterCustomizationApiServerKey: {
32+
kubeClusterCustomizationKey: {
3833
Type: schema.TypeSet,
3934
Computed: true,
4035
Optional: true,
41-
// Required: true,
4236
ForceNew: false,
43-
// MaxItems: 1,
44-
Set: CustomSchemaSetFunc(),
37+
MaxItems: 1,
4538
Elem: &schema.Resource{
4639
Schema: map[string]*schema.Schema{
47-
"admissionplugins": {
40+
"apiserver": {
4841
Type: schema.TypeSet,
4942
Computed: true,
5043
Optional: true,
51-
// Required: true,
5244
ForceNew: false,
53-
// MaxItems: 1,
54-
Set: CustomSchemaSetFunc(),
55-
Elem: &schema.Resource{
56-
Schema: map[string]*schema.Schema{
57-
"enabled": {
58-
Type: schema.TypeList,
59-
Computed: true,
60-
Optional: true,
61-
// Required: true,
62-
ForceNew: false,
63-
Elem: &schema.Schema{Type: schema.TypeString},
64-
},
65-
"disabled": {
66-
Type: schema.TypeList,
67-
Computed: true,
68-
Optional: true,
69-
// Required: true,
70-
ForceNew: false,
71-
Elem: &schema.Schema{Type: schema.TypeString},
72-
},
73-
},
74-
},
75-
},
76-
},
77-
},
78-
},
79-
kubeClusterCustomization: {
80-
Type: schema.TypeSet,
81-
Computed: true,
82-
Optional: true,
83-
ForceNew: false,
84-
Set: CustomSchemaSetFunc(),
85-
Deprecated: fmt.Sprintf("Use %s instead", kubeClusterCustomizationApiServerKey),
86-
Elem: &schema.Resource{
87-
Schema: map[string]*schema.Schema{
88-
"apiserver": {
89-
Type: schema.TypeSet,
90-
Computed: true,
91-
Optional: true,
92-
ForceNew: false,
93-
Set: CustomSchemaSetFunc(),
94-
Deprecated: fmt.Sprintf("Use %s instead", kubeClusterCustomizationApiServerKey),
45+
MaxItems: 1,
9546
Elem: &schema.Resource{
9647
Schema: map[string]*schema.Schema{
9748
"admissionplugins": {
9849
Type: schema.TypeSet,
9950
Computed: true,
10051
Optional: true,
10152
ForceNew: false,
102-
Set: CustomSchemaSetFunc(),
53+
MaxItems: 1,
10354
Elem: &schema.Resource{
10455
Schema: map[string]*schema.Schema{
10556
"enabled": {
@@ -125,90 +76,6 @@ func dataSourceCloudProjectKube() *schema.Resource {
12576
},
12677
},
12778
},
128-
kubeClusterCustomizationKubeProxyKey: {
129-
Type: schema.TypeSet,
130-
Computed: false,
131-
Optional: true,
132-
ForceNew: false,
133-
MaxItems: 1,
134-
Elem: &schema.Resource{
135-
Schema: map[string]*schema.Schema{
136-
"iptables": {
137-
Type: schema.TypeSet,
138-
Computed: false,
139-
Optional: true,
140-
ForceNew: false,
141-
MaxItems: 1,
142-
Set: CustomIPVSIPTablesSchemaSetFunc(),
143-
Elem: &schema.Resource{
144-
Schema: map[string]*schema.Schema{
145-
"min_sync_period": {
146-
Type: schema.TypeString,
147-
Computed: false,
148-
Optional: true,
149-
ForceNew: false,
150-
},
151-
"sync_period": {
152-
Type: schema.TypeString,
153-
Computed: false,
154-
Optional: true,
155-
ForceNew: false,
156-
},
157-
},
158-
},
159-
},
160-
"ipvs": {
161-
Type: schema.TypeSet,
162-
Computed: false,
163-
Optional: true,
164-
ForceNew: false,
165-
MaxItems: 1,
166-
Set: CustomIPVSIPTablesSchemaSetFunc(),
167-
Elem: &schema.Resource{
168-
Schema: map[string]*schema.Schema{
169-
"min_sync_period": {
170-
Type: schema.TypeString,
171-
Computed: false,
172-
Optional: true,
173-
ForceNew: false,
174-
},
175-
"sync_period": {
176-
Type: schema.TypeString,
177-
Computed: false,
178-
Optional: true,
179-
ForceNew: false,
180-
},
181-
"scheduler": {
182-
Type: schema.TypeString,
183-
Computed: false,
184-
Optional: true,
185-
ForceNew: false,
186-
},
187-
"tcp_fin_timeout": {
188-
Type: schema.TypeString,
189-
Computed: false,
190-
Optional: true,
191-
ForceNew: false,
192-
},
193-
"tcp_timeout": {
194-
Type: schema.TypeString,
195-
Computed: false,
196-
Optional: true,
197-
ForceNew: false,
198-
},
199-
"udp_timeout": {
200-
Type: schema.TypeString,
201-
Computed: false,
202-
Optional: true,
203-
ForceNew: false,
204-
},
205-
},
206-
},
207-
},
208-
},
209-
},
210-
},
211-
21279
"private_network_id": {
21380
Type: schema.TypeString,
21481
Computed: true,

ovh/data_cloud_project_kube_test.go

+6-75
Original file line numberDiff line numberDiff line change
@@ -25,58 +25,19 @@ func TestAccCloudProjectKubeDataSource_basic(t *testing.T) {
2525

2626
resource.Test(t, resource.TestCase{
2727
PreCheck: func() {
28-
testAccPreCheckCloud(t)
29-
testAccCheckCloudProjectExists(t)
3028
testAccPreCheckKubernetes(t)
3129
},
3230
Providers: testAccProviders,
3331
Steps: []resource.TestStep{
3432
{
3533
Config: config,
3634
Check: resource.ComposeTestCheckFunc(
37-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "region", region),
38-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "name", name),
39-
resource.TestMatchResourceAttr("data.ovh_cloud_project_kube.cluster", "version", matchVersion),
40-
),
41-
},
42-
},
43-
})
44-
}
45-
46-
func TestAccCloudProjectKubeDataSource_kubeProxy(t *testing.T) {
47-
name := acctest.RandomWithPrefix(test_prefix)
48-
region := os.Getenv("OVH_CLOUD_PROJECT_KUBE_REGION_TEST")
49-
config := fmt.Sprintf(
50-
testAccCloudProjectKubeDatasourceKubeProxyConfig,
51-
os.Getenv("OVH_CLOUD_PROJECT_SERVICE_TEST"),
52-
name,
53-
region,
54-
)
55-
56-
resource.Test(t, resource.TestCase{
57-
PreCheck: func() {
58-
testAccPreCheckCloud(t)
59-
testAccCheckCloudProjectExists(t)
60-
testAccPreCheckKubernetes(t)
61-
},
62-
Providers: testAccProviders,
63-
Steps: []resource.TestStep{
64-
{
65-
Config: config,
66-
Check: resource.ComposeTestCheckFunc(
67-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "region", region),
68-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "name", name),
69-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "kube_proxy_mode", "ipvs"),
70-
71-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "customization_kube_proxy.0.iptables.0.min_sync_period", "PT30S"),
72-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "customization_kube_proxy.0.iptables.0.sync_period", "PT30S"),
73-
74-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "customization_kube_proxy.0.ipvs.0.min_sync_period", "PT30S"),
75-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "customization_kube_proxy.0.ipvs.0.sync_period", "PT30S"),
76-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "customization_kube_proxy.0.ipvs.0.scheduler", "rr"),
77-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "customization_kube_proxy.0.ipvs.0.tcp_fin_timeout", "PT30S"),
78-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "customization_kube_proxy.0.ipvs.0.tcp_timeout", "PT30S"),
79-
resource.TestCheckResourceAttr("data.ovh_cloud_project_kube.cluster", "customization_kube_proxy.0.ipvs.0.udp_timeout", "PT30S"),
35+
resource.TestCheckResourceAttr(
36+
"data.ovh_cloud_project_kube.cluster", "region", region),
37+
resource.TestCheckResourceAttr(
38+
"data.ovh_cloud_project_kube.cluster", "name", name),
39+
resource.TestMatchResourceAttr(
40+
"data.ovh_cloud_project_kube.cluster", "version", matchVersion),
8041
),
8142
},
8243
},
@@ -96,33 +57,3 @@ data "ovh_cloud_project_kube" "cluster" {
9657
kube_id = ovh_cloud_project_kube.cluster.id
9758
}
9859
`
99-
100-
var testAccCloudProjectKubeDatasourceKubeProxyConfig = `
101-
resource "ovh_cloud_project_kube" "cluster" {
102-
service_name = "%s"
103-
name = "%s"
104-
region = "%s"
105-
106-
kube_proxy_mode = "ipvs"
107-
customization_kube_proxy {
108-
iptables {
109-
min_sync_period = "PT30S"
110-
sync_period = "PT30S"
111-
}
112-
113-
ipvs {
114-
min_sync_period = "PT30S"
115-
sync_period = "PT30S"
116-
scheduler = "rr"
117-
tcp_fin_timeout = "PT30S"
118-
tcp_timeout = "PT30S"
119-
udp_timeout = "PT30S"
120-
}
121-
}
122-
}
123-
124-
data "ovh_cloud_project_kube" "cluster" {
125-
service_name = ovh_cloud_project_kube.cluster.service_name
126-
kube_id = ovh_cloud_project_kube.cluster.id
127-
}
128-
`

0 commit comments

Comments
 (0)