You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"metadata": namespacedMetadataSchema("horizontal pod autoscaler", true),
27
-
"spec": {
28
-
Type: schema.TypeList,
29
-
Description: "Behaviour of the autoscaler. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
30
-
Required: true,
31
-
MaxItems: 1,
32
-
Elem: &schema.Resource{
33
-
Schema: map[string]*schema.Schema{
34
-
"max_replicas": {
35
-
Type: schema.TypeInt,
36
-
Description: "Upper limit for the number of pods that can be set by the autoscaler.",
37
-
Required: true,
38
-
},
39
-
"metric": {
40
-
Type: schema.TypeList,
41
-
Computed: true,
42
-
Optional: true,
43
-
Description: "The specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization.",
44
-
Elem: metricSpecFields(),
45
-
},
46
-
"min_replicas": {
47
-
Type: schema.TypeInt,
48
-
Description: "Lower limit for the number of pods that can be set by the autoscaler, defaults to `1`.",
49
-
Optional: true,
50
-
Default: 1,
51
-
},
52
-
"behavior": {
53
-
Type: schema.TypeList,
54
-
Description: "Behavior configures the scaling behavior of the target in both Up and Down directions (scale_up and scale_down fields respectively).",
55
-
Optional: true,
56
-
MaxItems: 1,
57
-
Elem: &schema.Resource{
58
-
Schema: map[string]*schema.Schema{
59
-
"scale_up": {
60
-
Type: schema.TypeList,
61
-
Description: "Scaling policy for scaling Up",
62
-
Optional: true,
63
-
Elem: scalingRulesSpecFields(),
64
-
},
65
-
"scale_down": {
66
-
Type: schema.TypeList,
67
-
Description: "Scaling policy for scaling Down",
68
-
Optional: true,
69
-
Elem: scalingRulesSpecFields(),
70
-
},
71
-
},
72
-
},
73
-
},
74
-
"scale_target_ref": {
75
-
Type: schema.TypeList,
76
-
Description: "Reference to scaled resource. e.g. Replication Controller",
77
-
Required: true,
78
-
MaxItems: 1,
79
-
Elem: &schema.Resource{
80
-
Schema: map[string]*schema.Schema{
81
-
"api_version": {
82
-
Type: schema.TypeString,
83
-
Description: "API version of the referent",
84
-
Optional: true,
85
-
},
86
-
"kind": {
87
-
Type: schema.TypeString,
88
-
Description: "Kind of the referent. e.g. `ReplicationController`. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
89
-
Required: true,
90
-
},
91
-
"name": {
92
-
Type: schema.TypeString,
93
-
Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
94
-
Required: true,
95
-
},
96
-
},
97
-
},
98
-
},
99
-
"target_cpu_utilization_percentage": {
100
-
Type: schema.TypeInt,
101
-
Description: "Target average CPU utilization (represented as a percentage of requested CPU) over all the pods. If not specified the default autoscaling policy will be used.",
102
-
Optional: true,
103
-
Computed: true,
104
-
},
105
-
},
106
-
},
107
-
},
108
-
},
25
+
Schema: horizontalPodAutoscalerSchemaV2(),
109
26
}
110
27
}
111
28
@@ -125,12 +42,12 @@ func resourceKubernetesHorizontalPodAutoscalerCreate(ctx context.Context, d *sch
125
42
returndiag.FromErr(err)
126
43
}
127
44
128
-
svc:=api.HorizontalPodAutoscaler{
45
+
hpa:=autoscalingv1.HorizontalPodAutoscaler{
129
46
ObjectMeta: metadata,
130
47
Spec: *spec,
131
48
}
132
-
log.Printf("[INFO] Creating new horizontal pod autoscaler: %#v", svc)
"metadata": namespacedMetadataSchema("horizontal pod autoscaler", true),
28
-
"spec": {
29
-
Type: schema.TypeList,
30
-
Description: "Behaviour of the autoscaler. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
31
-
Required: true,
32
-
MaxItems: 1,
33
-
Elem: &schema.Resource{
34
-
Schema: map[string]*schema.Schema{
35
-
"max_replicas": {
36
-
Type: schema.TypeInt,
37
-
Description: "Upper limit for the number of pods that can be set by the autoscaler.",
38
-
Required: true,
39
-
},
40
-
"metric": {
41
-
Type: schema.TypeList,
42
-
Computed: true,
43
-
Optional: true,
44
-
Description: "The specifications for which to use to calculate the desired replica count (the maximum replica count across all metrics will be used). The desired replica count is calculated multiplying the ratio between the target value and the current value by the current number of pods. Ergo, metrics used must decrease as the pod count is increased, and vice-versa. See the individual metric source types for more information about how each type of metric must respond. If not set, the default metric will be set to 80% average CPU utilization.",
45
-
Elem: metricSpecFields(),
46
-
},
47
-
"min_replicas": {
48
-
Type: schema.TypeInt,
49
-
Description: "Lower limit for the number of pods that can be set by the autoscaler, defaults to `1`.",
50
-
Optional: true,
51
-
Default: 1,
52
-
},
53
-
"behavior": {
54
-
Type: schema.TypeList,
55
-
Description: "Behavior configures the scaling behavior of the target in both Up and Down directions (scale_up and scale_down fields respectively).",
56
-
Optional: true,
57
-
MaxItems: 1,
58
-
Elem: &schema.Resource{
59
-
Schema: map[string]*schema.Schema{
60
-
"scale_up": {
61
-
Type: schema.TypeList,
62
-
Description: "Scaling policy for scaling Up",
63
-
Optional: true,
64
-
Elem: scalingRulesSpecFields(),
65
-
},
66
-
"scale_down": {
67
-
Type: schema.TypeList,
68
-
Description: "Scaling policy for scaling Down",
69
-
Optional: true,
70
-
Elem: scalingRulesSpecFields(),
71
-
},
72
-
},
73
-
},
74
-
},
75
-
"scale_target_ref": {
76
-
Type: schema.TypeList,
77
-
Description: "Reference to scaled resource. e.g. Replication Controller",
78
-
Required: true,
79
-
MaxItems: 1,
80
-
Elem: &schema.Resource{
81
-
Schema: map[string]*schema.Schema{
82
-
"api_version": {
83
-
Type: schema.TypeString,
84
-
Description: "API version of the referent",
85
-
Optional: true,
86
-
},
87
-
"kind": {
88
-
Type: schema.TypeString,
89
-
Description: "Kind of the referent. e.g. `ReplicationController`. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds",
90
-
Required: true,
91
-
},
92
-
"name": {
93
-
Type: schema.TypeString,
94
-
Description: "Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names",
95
-
Required: true,
96
-
},
97
-
},
98
-
},
99
-
},
100
-
"target_cpu_utilization_percentage": {
101
-
Type: schema.TypeInt,
102
-
Description: "Target average CPU utilization (represented as a percentage of requested CPU) over all the pods. If not specified the default autoscaling policy will be used.",
0 commit comments