Skip to content

Commit

Permalink
Deprecate unused TM resource limit env vars (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
regadas authored Oct 7, 2022
1 parent f48fa04 commit 1dcdbb3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 66 deletions.
27 changes: 1 addition & 26 deletions controllers/flinkcluster/flinkcluster_converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,31 +425,6 @@ func newTaskManagerContainer(flinkCluster *v1beta1.FlinkCluster) *corev1.Contain
ports = append(ports, corev1.ContainerPort{Name: port.Name, ContainerPort: port.ContainerPort, Protocol: corev1.Protocol(port.Protocol)})
}

var envVars = []corev1.EnvVar{
{
Name: "TASK_MANAGER_CPU_LIMIT",
ValueFrom: &corev1.EnvVarSource{
ResourceFieldRef: &corev1.ResourceFieldSelector{
ContainerName: "taskmanager",
Resource: "limits.cpu",
Divisor: resource.MustParse("1m"),
},
},
},
{
Name: "TASK_MANAGER_MEMORY_LIMIT",
ValueFrom: &corev1.EnvVarSource{
ResourceFieldRef: &corev1.ResourceFieldSelector{
ContainerName: "taskmanager",
Resource: "limits.memory",
Divisor: resource.MustParse("1Mi"),
},
},
},
}

envVars = append(envVars, flinkCluster.Spec.EnvVars...)

return &corev1.Container{
Name: "taskmanager",
Image: imageSpec.Name,
Expand All @@ -459,7 +434,7 @@ func newTaskManagerContainer(flinkCluster *v1beta1.FlinkCluster) *corev1.Contain
LivenessProbe: taskManagerSpec.LivenessProbe,
ReadinessProbe: taskManagerSpec.ReadinessProbe,
Resources: taskManagerSpec.Resources,
Env: envVars,
Env: flinkCluster.Spec.EnvVars,
EnvFrom: flinkCluster.Spec.EnvFrom,
VolumeMounts: taskManagerSpec.VolumeMounts,
Lifecycle: &corev1.Lifecycle{
Expand Down
40 changes: 0 additions & 40 deletions controllers/flinkcluster/flinkcluster_converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -689,26 +689,6 @@ func TestGetDesiredClusterState(t *testing.T) {
LivenessProbe: &tmLivenessProbe,
ReadinessProbe: &tmReadinessProbe,
Env: []corev1.EnvVar{
{
Name: "TASK_MANAGER_CPU_LIMIT",
ValueFrom: &corev1.EnvVarSource{
ResourceFieldRef: &corev1.ResourceFieldSelector{
ContainerName: "taskmanager",
Resource: "limits.cpu",
Divisor: resource.MustParse("1m"),
},
},
},
{
Name: "TASK_MANAGER_MEMORY_LIMIT",
ValueFrom: &corev1.EnvVarSource{
ResourceFieldRef: &corev1.ResourceFieldSelector{
ContainerName: "taskmanager",
Resource: "limits.memory",
Divisor: resource.MustParse("1Mi"),
},
},
},
{
Name: "FOO",
Value: "abc",
Expand Down Expand Up @@ -1110,26 +1090,6 @@ func TestTmDeploymentTypeDeployment(t *testing.T) {
LivenessProbe: &tmLivenessProbe,
ReadinessProbe: &tmReadinessProbe,
Env: []corev1.EnvVar{
{
Name: "TASK_MANAGER_CPU_LIMIT",
ValueFrom: &corev1.EnvVarSource{
ResourceFieldRef: &corev1.ResourceFieldSelector{
ContainerName: "taskmanager",
Resource: "limits.cpu",
Divisor: resource.MustParse("1m"),
},
},
},
{
Name: "TASK_MANAGER_MEMORY_LIMIT",
ValueFrom: &corev1.EnvVarSource{
ResourceFieldRef: &corev1.ResourceFieldSelector{
ContainerName: "taskmanager",
Resource: "limits.memory",
Divisor: resource.MustParse("1Mi"),
},
},
},
{
Name: "FOO",
Value: "abc",
Expand Down

0 comments on commit 1dcdbb3

Please sign in to comment.