Skip to content

Commit f1bdfa9

Browse files
committed
Review comments
Signed-off-by: Jean Rouge <[email protected]>
1 parent a09031d commit f1bdfa9

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

pkg/kubelet/dockershim/docker_container_windows.go

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ import (
2929
dockertypes "github.com/docker/docker/api/types"
3030
dockercontainer "github.com/docker/docker/api/types/container"
3131

32-
utilfeature "k8s.io/apiserver/pkg/util/feature"
33-
kubefeatures "k8s.io/kubernetes/pkg/features"
3432
runtimeapi "k8s.io/kubernetes/pkg/kubelet/apis/cri/runtime/v1alpha2"
3533
"k8s.io/kubernetes/pkg/kubelet/kuberuntime"
3634
)
@@ -45,10 +43,8 @@ type containerCreationCleanupInfo struct {
4543
func (ds *dockerService) applyPlatformSpecificDockerConfig(request *runtimeapi.CreateContainerRequest, createConfig *dockertypes.ContainerCreateConfig) (*containerCreationCleanupInfo, error) {
4644
cleanupInfo := &containerCreationCleanupInfo{}
4745

48-
if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.WindowsGMSA) {
49-
if err := applyGMSAConfig(request.GetConfig(), createConfig, cleanupInfo); err != nil {
50-
return nil, err
51-
}
46+
if err := applyGMSAConfig(request.GetConfig(), createConfig, cleanupInfo); err != nil {
47+
return nil, err
5248
}
5349

5450
return cleanupInfo, nil
@@ -60,7 +56,8 @@ func (ds *dockerService) applyPlatformSpecificDockerConfig(request *runtimeapi.C
6056
// whose location could potentially change down the line, or even be unknown (eg if docker is not installed on the
6157
// C: drive)
6258
// When docker supports passing a credential spec's contents directly, we should switch to using that
63-
// as it will avoid cluttering the registry.
59+
// as it will avoid cluttering the registry - there is a moby PR out for this:
60+
// https://github.com/moby/moby/pull/38777
6461
func applyGMSAConfig(config *runtimeapi.ContainerConfig, createConfig *dockertypes.ContainerCreateConfig, cleanupInfo *containerCreationCleanupInfo) error {
6562
credSpec := config.Annotations[kuberuntime.GMSASpecContainerAnnotationKey]
6663
if credSpec == "" {
@@ -163,10 +160,8 @@ func randomString(length int) (string, error) {
163160
// after a container creation. Any errors it returns are simply logged, but do not fail the container
164161
// creation.
165162
func (ds *dockerService) performPlatformSpecificContainerCreationCleanup(cleanupInfo *containerCreationCleanupInfo) (errors []error) {
166-
if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.WindowsGMSA) {
167-
if err := removeGMSARegistryValue(cleanupInfo); err != nil {
168-
errors = append(errors, err)
169-
}
163+
if err := removeGMSARegistryValue(cleanupInfo); err != nil {
164+
errors = append(errors, err)
170165
}
171166

172167
return
@@ -194,10 +189,7 @@ func removeGMSARegistryValue(cleanupInfo *containerCreationCleanupInfo) error {
194189
// creating containers.
195190
// Errors are simply logged, but don't prevent dockershim from starting.
196191
func (ds *dockerService) platformSpecificContainerCreationInitCleanup() (errors []error) {
197-
if utilfeature.DefaultFeatureGate.Enabled(kubefeatures.WindowsGMSA) {
198-
errors = removeAllGMSARegistryValues()
199-
}
200-
return
192+
return removeAllGMSARegistryValues()
201193
}
202194

203195
func removeAllGMSARegistryValues() (errors []error) {

0 commit comments

Comments
 (0)