Fix various golangci-lint errors (#2147)

that we introduced via controller-runtime upgrade and via the removal of legacy pull-based scale triggers (#2001).
This commit is contained in:
Yusuke Kuoka
2023-01-13 07:14:36 +09:00
committed by GitHub
parent a6c4d84234
commit bc4f4fee12
3 changed files with 6 additions and 97 deletions

View File

@@ -57,19 +57,16 @@ func TestAPIs(t *testing.T) {
var _ = BeforeSuite(func(done Done) {
logf.SetLogger(zap.New(zap.UseDevMode(true), zap.WriteTo(GinkgoWriter)))
var apiServerFlags []string
apiServerFlags = append(apiServerFlags, envtest.DefaultKubeAPIServerFlags...)
// Avoids the following error:
// 2021-03-19T15:14:11.673+0900 ERROR controller-runtime.controller Reconciler error {"controller": "testns-tvjzjrunner", "request": "testns-gdnyx/example-runnerdeploy-zps4z-j5562", "error": "Pod \"example-runnerdeploy-zps4z-j5562\" is invalid: [spec.containers[1].image: Required value, spec.containers[1].securityContext.privileged: Forbidden: disallowed by cluster policy]"}
apiServerFlags = append(apiServerFlags, "--allow-privileged=true")
By("bootstrapping test environment")
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases")},
KubeAPIServerFlags: apiServerFlags,
CRDDirectoryPaths: []string{filepath.Join("../..", "config", "crd", "bases")},
}
// Avoids the following error:
// 2021-03-19T15:14:11.673+0900 ERROR controller-runtime.controller Reconciler error {"controller": "testns-tvjzjrunner", "request": "testns-gdnyx/example-runnerdeploy-zps4z-j5562", "error": "Pod \"example-runnerdeploy-zps4z-j5562\" is invalid: [spec.containers[1].image: Required value, spec.containers[1].securityContext.privileged: Forbidden: disallowed by cluster policy]"}
testEnv.ControlPlane.GetAPIServer().Configure().
Append("allow-privileged", "true")
var err error
cfg, err = testEnv.Start()
Expect(err).ToNot(HaveOccurred())