@@ -10,57 +10,66 @@ import (
1010)
1111
1212func dataSourceKubernetesIngress () * schema.Resource {
13+ return & schema.Resource {
14+ ReadContext : dataSourceKubernetesIngressRead ,
15+ StateUpgraders : []schema.StateUpgrader {
16+ {
17+ Type : dataSourceKubernetesIngressV0 ().CoreConfigSchema ().ImpliedType (),
18+ Upgrade : dataSourceKubernetesIngressStateUpgradeV0 ,
19+ Version : 0 ,
20+ },
21+ },
22+ SchemaVersion : 1 ,
23+ Schema : dataSourceKubernetesIngressSchemaV1 (),
24+ }
25+ }
26+
27+ func dataSourceKubernetesIngressSchemaV1 () map [string ]* schema.Schema {
1328 docHTTPIngressPath := networking.HTTPIngressPath {}.SwaggerDoc ()
1429 docHTTPIngressRuleValue := networking.HTTPIngressPath {}.SwaggerDoc ()
1530 docIngress := networking.Ingress {}.SwaggerDoc ()
1631 docIngressTLS := networking.IngressTLS {}.SwaggerDoc ()
1732 docIngressRule := networking.IngressRule {}.SwaggerDoc ()
1833 docIngressSpec := networking.IngressSpec {}.SwaggerDoc ()
1934
20- return & schema.Resource {
21- ReadContext : dataSourceKubernetesIngressRead ,
22-
23- Schema : map [string ]* schema.Schema {
24- "metadata" : namespacedMetadataSchema ("ingress" , false ),
25- "spec" : {
26- Type : schema .TypeList ,
27- Description : docIngress ["spec" ],
28- Computed : true ,
29- Elem : & schema.Resource {
30- Schema : map [string ]* schema.Schema {
31- "backend" : backendSpecFields (defaultBackendDescription ),
32- // FIXME: this field is inconsistent with the k8s API 'rules'
33- "rule" : {
34- Type : schema .TypeList ,
35- Description : docIngressSpec ["rules" ],
36- Computed : true ,
37- Elem : & schema.Resource {
38- Schema : map [string ]* schema.Schema {
39- "host" : {
40- Type : schema .TypeString ,
41- Description : docIngressRule ["host" ],
42- Computed : true ,
43- },
44- "http" : {
45- Type : schema .TypeList ,
46- Computed : true ,
47- Description : docIngressRule ["" ],
48- Elem : & schema.Resource {
49- Schema : map [string ]* schema.Schema {
50- // FIXME: this field is inconsistent with the k8s API 'paths'
51- "path" : {
52- Type : schema .TypeList ,
53- Computed : true ,
54- Description : docHTTPIngressRuleValue ["paths" ],
55- Elem : & schema.Resource {
56- Schema : map [string ]* schema.Schema {
57- "path" : {
58- Type : schema .TypeString ,
59- Description : docHTTPIngressPath ["path" ],
60- Computed : true ,
61- },
62- "backend" : backendSpecFields (ruleBackedDescription ),
35+ return map [string ]* schema.Schema {
36+ "metadata" : namespacedMetadataSchema ("ingress" , false ),
37+ "spec" : {
38+ Type : schema .TypeList ,
39+ Description : docIngress ["spec" ],
40+ Computed : true ,
41+ Elem : & schema.Resource {
42+ Schema : map [string ]* schema.Schema {
43+ "backend" : backendSpecFields (defaultBackendDescription ),
44+ "rule" : {
45+ Type : schema .TypeList ,
46+ Description : docIngressSpec ["rules" ],
47+ Computed : true ,
48+ Elem : & schema.Resource {
49+ Schema : map [string ]* schema.Schema {
50+ "host" : {
51+ Type : schema .TypeString ,
52+ Description : docIngressRule ["host" ],
53+ Computed : true ,
54+ },
55+ "http" : {
56+ Type : schema .TypeList ,
57+ Computed : true ,
58+ Description : docIngressRule ["" ],
59+ Elem : & schema.Resource {
60+ Schema : map [string ]* schema.Schema {
61+ "path" : {
62+ Type : schema .TypeList ,
63+ Computed : true ,
64+ Description : docHTTPIngressRuleValue ["paths" ],
65+ Elem : & schema.Resource {
66+ Schema : map [string ]* schema.Schema {
67+ "path" : {
68+ Type : schema .TypeString ,
69+ Description : docHTTPIngressPath ["path" ],
70+ Computed : true ,
6371 },
72+ "backend" : backendSpecFields (ruleBackedDescription ),
6473 },
6574 },
6675 },
@@ -69,52 +78,52 @@ func dataSourceKubernetesIngress() *schema.Resource {
6978 },
7079 },
7180 },
72- "tls" : {
73- Type : schema . TypeList ,
74- Description : docIngressSpec [ "tls" ] ,
75- Computed : true ,
76- Elem : & schema. Resource {
77- Schema : map [ string ] * schema.Schema {
78- "hosts" : {
79- Type : schema . TypeList ,
80- Description : docIngressTLS [ "hosts" ] ,
81- Computed : true ,
82- Elem : & schema. Schema { Type : schema . TypeString } ,
83- },
84- "secret_name" : {
85- Type : schema . TypeString ,
86- Description : docIngressTLS [ "secretName" ] ,
87- Computed : true ,
88- } ,
81+ },
82+ "tls" : {
83+ Type : schema . TypeList ,
84+ Description : docIngressSpec [ "tls" ] ,
85+ Computed : true ,
86+ Elem : & schema.Resource {
87+ Schema : map [ string ] * schema. Schema {
88+ "hosts" : {
89+ Type : schema . TypeList ,
90+ Description : docIngressTLS [ "hosts" ] ,
91+ Computed : true ,
92+ Elem : & schema. Schema { Type : schema . TypeString },
93+ },
94+ "secret_name" : {
95+ Type : schema . TypeString ,
96+ Description : docIngressTLS [ "secretName" ] ,
97+ Computed : true ,
8998 },
9099 },
91100 },
92101 },
93102 },
94103 },
95- "status" : {
96- Type : schema . TypeList ,
97- Computed : true ,
98- Elem : & schema. Resource {
99- Schema : map [ string ] * schema.Schema {
100- "load_balancer" : {
101- Type : schema . TypeList ,
102- Computed : true ,
103- Elem : & schema. Resource {
104- Schema : map [ string ] * schema.Schema {
105- "ingress" : {
106- Type : schema . TypeList ,
107- Computed : true ,
108- Elem : & schema. Resource {
109- Schema : map [ string ] * schema.Schema {
110- "ip" : {
111- Type : schema . TypeString ,
112- Computed : true ,
113- } ,
114- "hostname" : {
115- Type : schema . TypeString ,
116- Computed : true ,
117- } ,
104+ },
105+ "status" : {
106+ Type : schema . TypeList ,
107+ Computed : true ,
108+ Elem : & schema.Resource {
109+ Schema : map [ string ] * schema. Schema {
110+ "load_balancer" : {
111+ Type : schema . TypeList ,
112+ Computed : true ,
113+ Elem : & schema.Resource {
114+ Schema : map [ string ] * schema. Schema {
115+ "ingress" : {
116+ Type : schema . TypeList ,
117+ Computed : true ,
118+ Elem : & schema.Resource {
119+ Schema : map [ string ] * schema. Schema {
120+ "ip" : {
121+ Type : schema . TypeString ,
122+ Computed : true ,
123+ },
124+ "hostname" : {
125+ Type : schema . TypeString ,
126+ Computed : true ,
118127 },
119128 },
120129 },
0 commit comments