Remove support for deprecated entrypoint configuration for K8S

parent 379dab02
Pipeline #63395554 passed with stages
in 56 minutes and 18 seconds
......@@ -948,14 +948,14 @@ func TestAllowToOverwriteFeatureFlagWithRunnerVariables(t *testing.T) {
}{
"it has default value of FF": {
variable: "",
expectedValue: true,
expectedValue: false,
},
"it enables FF": {
variable: "FF_K8S_USE_ENTRYPOINT_OVER_COMMAND=true",
variable: "FF_USE_LEGACY_VOLUMES_MOUNTING_ORDER=true",
expectedValue: true,
},
"it disable FF": {
variable: "FF_K8S_USE_ENTRYPOINT_OVER_COMMAND=false",
variable: "FF_USE_LEGACY_VOLUMES_MOUNTING_ORDER=false",
expectedValue: false,
},
}
......@@ -969,7 +969,7 @@ func TestAllowToOverwriteFeatureFlagWithRunnerVariables(t *testing.T) {
},
}
result := build.IsFeatureFlagOn("FF_K8S_USE_ENTRYPOINT_OVER_COMMAND")
result := build.IsFeatureFlagOn("FF_USE_LEGACY_VOLUMES_MOUNTING_ORDER")
assert.Equal(t, test.expectedValue, result)
})
}
......
......@@ -37,7 +37,6 @@ The flags are defined in `./helpers/feature_flags/flags.go` file.
| Feature flag | Default value | Deprecated | To be removed with | Description |
|--------------|---------------|------------|--------------------|-------------|
| `FF_K8S_USE_ENTRYPOINT_OVER_COMMAND` | `true` | ✓ | 12.0 | Enables [the fix](https://gitlab.com/gitlab-org/gitlab-runner/merge_requests/1010) for entrypoint configuration when `kubernetes` executor is used |
| `FF_DOCKER_HELPER_IMAGE_V2` | `false` | ✓ | 12.0 | Enable the helper image to use the new commands when [helper_image](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-runnersdocker-section) is specified. This will start using the new API that will be used in 12.0 and stop showing the warning message in the build log |
| `FF_CMD_DISABLE_DELAYED_ERROR_LEVEL_EXPANSION` | `false` | ✗ | | Disables [EnableDelayedExpansion](https://ss64.com/nt/delayedexpansion.html) for error checking for when using [Window Batch](https://docs.gitlab.com/runner/shells/#windows-batch) shell |
| `FF_USE_LEGACY_GIT_CLEAN_STRATEGY` | `false` | ✓ | 12.0 | Disables the new strategy for `git clean` that moves the clean operation after checkout and enables support for `GIT_CLEAN_FLAGS` |
......
......@@ -10,7 +10,7 @@ import (
"golang.org/x/net/context"
api "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
intstr "k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/client-go/kubernetes"
_ "k8s.io/client-go/plugin/pkg/client/auth" // Register all available authentication methods
......@@ -18,7 +18,6 @@ import (
"gitlab.com/gitlab-org/gitlab-runner/executors"
"gitlab.com/gitlab-org/gitlab-runner/helpers/dns"
"gitlab.com/gitlab-org/gitlab-runner/helpers/docker/helperimage"
"gitlab.com/gitlab-org/gitlab-runner/helpers/featureflags"
"gitlab.com/gitlab-org/gitlab-runner/session/proxy"
)
......@@ -284,30 +283,6 @@ func (s *executor) buildContainer(name, image string, imageDefinition common.Ima
}
func (s *executor) getCommandAndArgs(imageDefinition common.Image, command ...string) ([]string, []string) {
if s.Build.IsFeatureFlagOn(featureflags.K8sEntrypointOverCommand) {
return s.getCommandsAndArgsV2(imageDefinition, command...)
}
return s.getCommandsAndArgsV1(imageDefinition, command...)
}
// TODO: Remove in 12.0
func (s *executor) getCommandsAndArgsV1(imageDefinition common.Image, command ...string) ([]string, []string) {
if len(command) == 0 && len(imageDefinition.Command) > 0 {
command = imageDefinition.Command
}
var args []string
if len(imageDefinition.Entrypoint) > 0 {
args = command
command = imageDefinition.Entrypoint
}
return command, args
}
// TODO: Make this the only proper way to setup command and args in 12.0
func (s *executor) getCommandsAndArgsV2(imageDefinition common.Image, command ...string) ([]string, []string) {
if len(command) == 0 && len(imageDefinition.Entrypoint) > 0 {
command = imageDefinition.Entrypoint
}
......
......@@ -32,7 +32,6 @@ import (
"gitlab.com/gitlab-org/gitlab-runner/helpers"
dns_test "gitlab.com/gitlab-org/gitlab-runner/helpers/dns/test"
"gitlab.com/gitlab-org/gitlab-runner/helpers/docker/helperimage"
"gitlab.com/gitlab-org/gitlab-runner/helpers/featureflags"
"gitlab.com/gitlab-org/gitlab-runner/session"
"gitlab.com/gitlab-org/gitlab-runner/session/proxy"
)
......@@ -1670,8 +1669,7 @@ func TestSetupBuildPod(t *testing.T) {
assert.Equal(t, "port,name-.non-compat!ble", e.ProxyPool["service,name-.non-compat!ble"].Settings.Ports[0].Name)
},
},
// TODO: Remove the mention of Feature Flag in 12.0, make it the only proper test case.
"properly sets command (entrypoint) and args when FF_K8S_USE_ENTRYPOINT_OVER_COMMAND is on": {
"sets command (entrypoint) and args": {
RunnerConfig: common.RunnerConfig{
RunnerSettings: common.RunnerSettings{
Kubernetes: &common.KubernetesConfig{
......@@ -1680,9 +1678,6 @@ func TestSetupBuildPod(t *testing.T) {
},
},
},
Variables: []common.JobVariable{
{Key: featureflags.K8sEntrypointOverCommand, Value: "true"},
},
Options: &kubernetesOptions{
Image: common.Image{
Name: "test-image",
......@@ -1732,68 +1727,6 @@ func TestSetupBuildPod(t *testing.T) {
assert.Equal(t, []string{"argument1", "argument2"}, pod.Spec.Containers[4].Args)
},
},
// TODO: Remove in 12.0
"sets command (entrypoint) and args in old way when FF_K8S_USE_ENTRYPOINT_OVER_COMMAND is off": {
RunnerConfig: common.RunnerConfig{
RunnerSettings: common.RunnerSettings{
Kubernetes: &common.KubernetesConfig{
Namespace: "default",
HelperImage: "custom/helper-image",
},
},
},
Variables: []common.JobVariable{
{Key: featureflags.K8sEntrypointOverCommand, Value: "false"},
},
Options: &kubernetesOptions{
Image: common.Image{
Name: "test-image",
},
Services: common.Services{
{
Name: "test-service-0",
Command: []string{"application", "--debug"},
},
{
Name: "test-service-1",
Entrypoint: []string{"application", "--debug"},
},
{
Name: "test-service-2",
Entrypoint: []string{"application", "--debug"},
Command: []string{"argument1", "argument2"},
},
},
},
VerifyFn: func(t *testing.T, test setupBuildPodTestDef, pod *api.Pod) {
require.Len(t, pod.Spec.Containers, 5)
assert.Equal(t, "build", pod.Spec.Containers[0].Name)
assert.Equal(t, "test-image", pod.Spec.Containers[0].Image)
assert.Empty(t, pod.Spec.Containers[0].Command, "Build container command should be empty")
assert.Empty(t, pod.Spec.Containers[0].Args, "Build container args should be empty")
assert.Equal(t, "helper", pod.Spec.Containers[1].Name)
assert.Equal(t, "custom/helper-image", pod.Spec.Containers[1].Image)
assert.Empty(t, pod.Spec.Containers[1].Command, "Helper container command should be empty")
assert.Empty(t, pod.Spec.Containers[1].Args, "Helper container args should be empty")
assert.Equal(t, "svc-0", pod.Spec.Containers[2].Name)
assert.Equal(t, "test-service-0", pod.Spec.Containers[2].Image)
assert.Equal(t, []string{"application", "--debug"}, pod.Spec.Containers[2].Command)
assert.Empty(t, pod.Spec.Containers[2].Args, "Service container command should be empty")
assert.Equal(t, "svc-1", pod.Spec.Containers[3].Name)
assert.Equal(t, "test-service-1", pod.Spec.Containers[3].Image)
assert.Equal(t, []string{"application", "--debug"}, pod.Spec.Containers[3].Command)
assert.Empty(t, pod.Spec.Containers[3].Args, "Service container args should be empty")
assert.Equal(t, "svc-2", pod.Spec.Containers[4].Name)
assert.Equal(t, "test-service-2", pod.Spec.Containers[4].Image)
assert.Equal(t, []string{"application", "--debug"}, pod.Spec.Containers[4].Command)
assert.Equal(t, []string{"argument1", "argument2"}, pod.Spec.Containers[4].Args)
},
},
"non-DNS-1123-compatible-token": {
RunnerConfig: common.RunnerConfig{
RunnerCredentials: common.RunnerCredentials{
......
......@@ -5,7 +5,6 @@ import (
)
const (
K8sEntrypointOverCommand string = "FF_K8S_USE_ENTRYPOINT_OVER_COMMAND"
DockerHelperImageV2 string = "FF_DOCKER_HELPER_IMAGE_V2"
CmdDisableDelayedErrorLevelExpansion string = "FF_CMD_DISABLE_DELAYED_ERROR_LEVEL_EXPANSION"
UseLegacyGitCleanStrategy string = "FF_USE_LEGACY_GIT_CLEAN_STRATEGY"
......@@ -27,13 +26,6 @@ type FeatureFlag struct {
// properly formatted. It will replace the existing table with the new one, computed
// basing on the values below
var flags = []FeatureFlag{
{
Name: K8sEntrypointOverCommand,
DefaultValue: "true",
Deprecated: true,
ToBeRemovedWith: "12.0",
Description: "Enables [the fix](https://gitlab.com/gitlab-org/gitlab-runner/merge_requests/1010) for entrypoint configuration when `kubernetes` executor is used",
},
{
Name: DockerHelperImageV2,
DefaultValue: "false",
......
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