move Resources field from PodTemplate to NginxSpec

parent e45f4a98
......@@ -34,12 +34,12 @@ type NginxSpec struct {
// working or not.
// +optional
HealthcheckPath string `json:"healthcheckPath,omitempty"`
// Resources requirements to be set on the NGINX container.
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}
type NginxPodTemplateSpec struct {
// Resources requirements to be set on the nginx container.
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
// Affinity to be set on the nginx pod.
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`
......
......@@ -112,7 +112,6 @@ func (in *NginxList) DeepCopyObject() runtime.Object {
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NginxPodTemplateSpec) DeepCopyInto(out *NginxPodTemplateSpec) {
*out = *in
in.Resources.DeepCopyInto(&out.Resources)
if in.Affinity != nil {
in, out := &in.Affinity, &out.Affinity
*out = new(v1.Affinity)
......@@ -190,6 +189,7 @@ func (in *NginxSpec) DeepCopyInto(out *NginxSpec) {
*out = new(FilesRef)
(*in).DeepCopyInto(*out)
}
in.Resources.DeepCopyInto(&out.Resources)
return
}
......
......@@ -111,7 +111,7 @@ func NewDeployment(n *v1alpha1.Nginx) (*appv1.Deployment, error) {
Protocol: corev1.ProtocolTCP,
},
},
Resources: n.Spec.PodTemplate.Resources,
Resources: n.Spec.Resources,
ReadinessProbe: &corev1.Probe{
Handler: corev1.Handler{
HTTPGet: &corev1.HTTPGetAction{
......
......@@ -450,7 +450,7 @@ func Test_NewDeployment(t *testing.T) {
{
name: "with-resources",
nginxFn: func(n v1alpha1.Nginx) v1alpha1.Nginx {
n.Spec.PodTemplate.Resources = corev1.ResourceRequirements{
n.Spec.Resources = corev1.ResourceRequirements{
Limits: corev1.ResourceList(map[corev1.ResourceName]resource.Quantity{
corev1.ResourceMemory: *resource.NewQuantity(int64(100), resource.DecimalSI),
}),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment