Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable most admission controllers for the control plane tests #77

Merged
merged 2 commits into from
May 8, 2020

Conversation

zen-dog
Copy link
Contributor

@zen-dog zen-dog commented May 7, 2020

Summary:
we used to be very permissive with admission controllers for the control plane tests by using --admission-control=AlwaysAdmit option. It is deprecated and it effectively disables all admission controllers. This PR introduces a much narrower setup by disabling only two admission controllers: --disable-admission-plugins=ServiceAccount,NamespaceLifecycle which are still needed for some tests.

Signed-off-by: Aleksey Dukhovniy alex.dukhovniy@googlemail.com

Summary:
we used to be very permissive with admission controllers for the control plane tests by using `--admission-control=AlwaysAdmit` option. It is deprecated and it effectively disables all admission controllers. This PR introduces a much narrower setup by disabling only two admission controllers: `--disable-admission-plugins=ServiceAccount,NamespaceLifecycle` which are still needed for some tests.

Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
go.mod Outdated Show resolved Hide resolved
@@ -69,7 +69,7 @@ var APIServerDefaultArgs = []string{
"--insecure-port={{ if .URL }}{{ .URL.Port }}{{ end }}",
"--insecure-bind-address={{ if .URL }}{{ .URL.Hostname }}{{ end }}",
"--secure-port={{ if .SecurePort }}{{ .SecurePort }}{{ end }}",
"--admission-control=AlwaysAdmit",
"--disable-admission-plugins=ServiceAccount,NamespaceLifecycle",
Copy link
Contributor Author

@zen-dog zen-dog May 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change. I also thought about exposing APIServerDefaultArgs to the kuttl users (different tests might require different admission controller set) but wrapping and wiring these through kuttl turned out to be tedious so I just edited it here. Especially, because these are only applied for the controller plane (and to kind or others) tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that you captured the concerns

  1. only affects mock control plane
  2. and I also thought exposing thru testsuite makes sense... but it seems fine to capture that in another PR if we gather consensus around it.

I'm concerned with making sure that many use cases are supported... for which I think expose to end user is necessary. perhaps we can take the route we take with kind config... where the full APIServerDefaultArgs can be provided in a file and can be reference as an override in testsuite and a flag. for expert users.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 valid points, which you already addressed in #78 Let's continue the discussion there 👍

break
}
}
env.Config, err = env.Environment.Start()
Copy link
Contributor Author

@zen-dog zen-dog May 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this loop makes sense anymore. Envtest already has logic to retry starting the controller plane and a mechanism to suggest free ports

kensipe
kensipe previously approved these changes May 7, 2020
Copy link
Member

@kensipe kensipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

nice additions! and fixes!

h.T.Log("started test environment (kube-apiserver and etcd) in", time.Since(started))
h.T.Logf("started test environment (kube-apiserver and etcd) in %v, with following options:\n%s",
time.Since(started),
strings.Join(testenv.Environment.KubeAPIServerFlags, "\n"))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output for other reviewers...

 kuttl: harness.go:195: started test environment (kube-apiserver and etcd) in 4.597689123s, with following options:
        --advertise-address=127.0.0.1
        --etcd-servers={{ if .EtcdURL }}{{ .EtcdURL.String }}{{ end }}
        --cert-dir={{ .CertDir }}
        --insecure-port={{ if .URL }}{{ .URL.Port }}{{ end }}
        --insecure-bind-address={{ if .URL }}{{ .URL.Hostname }}{{ end }}
        --secure-port={{ if .SecurePort }}{{ .SecurePort }}{{ end }}
        --disable-admission-plugins=ServiceAccount,NamespaceLifecycle
        --service-cluster-ip-range=10.0.0.0/24
        --advertise-address={{ if .URL }}{{ .URL.Hostname }}{{ end }}

@@ -69,7 +69,7 @@ var APIServerDefaultArgs = []string{
"--insecure-port={{ if .URL }}{{ .URL.Port }}{{ end }}",
"--insecure-bind-address={{ if .URL }}{{ .URL.Hostname }}{{ end }}",
"--secure-port={{ if .SecurePort }}{{ .SecurePort }}{{ end }}",
"--admission-control=AlwaysAdmit",
"--disable-admission-plugins=ServiceAccount,NamespaceLifecycle",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that you captured the concerns

  1. only affects mock control plane
  2. and I also thought exposing thru testsuite makes sense... but it seems fine to capture that in another PR if we gather consensus around it.

I'm concerned with making sure that many use cases are supported... for which I think expose to end user is necessary. perhaps we can take the route we take with kind config... where the full APIServerDefaultArgs can be provided in a file and can be reference as an override in testsuite and a flag. for expert users.

@@ -1004,7 +998,7 @@ func RunCommands(logger Logger, namespace string, command string, commands []har
}

for _, cmd := range commands {
logger.Logf("running command: %s %s", command, cmd)
logger.Logf("running command: %s %q", command, cmd.Command)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output for other reviewers

kuttl/harness/cli-test: logger.go:41: 16:24:57 | cli-test/1-patch | running command:  "kubectl label pod cli-test-pod test=true"

vs what used to be:

kuttl/harness/cli-test: logger.go:41: 16:33:29 | cli-test/1-patch | running command:  {"kubectl label pod cli-test-pod test=true" %!q(bool=true) %!q(bool=false) %!q(bool=false)}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh thanks! That's a lot cleaner :D

ANeumann82
ANeumann82 previously approved these changes May 8, 2020
Co-authored-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Ken Sipe <kensipe@gmail.com>
@kensipe kensipe dismissed stale reviews from ANeumann82 and themself via 00d2628 May 8, 2020 14:16
@kensipe
Copy link
Member

kensipe commented May 8, 2020

The approvals still stand... we had a PR on a PR both with all needed approvals. The merge of the first PR reset approvals but we will merge without forcing more attention after tests pass.

@kensipe kensipe merged commit ebb44c1 into master May 8, 2020
@kensipe kensipe deleted the ad/admission-controllers branch May 8, 2020 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants