Skip to content

Commit ca2eeef

Browse files
authored
chore: remove unused references of kubernetes-configuration and webhook constants (#2384)
1 parent a0f2758 commit ca2eeef

File tree

8 files changed

+15
-131
lines changed

8 files changed

+15
-131
lines changed

ingress-controller/test/consts/consts.go

Lines changed: 0 additions & 10 deletions
This file was deleted.

ingress-controller/test/e2e/helpers_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ import (
4545

4646
"github.com/kong/kong-operator/ingress-controller/internal/annotations"
4747
"github.com/kong/kong-operator/ingress-controller/test"
48-
conststest "github.com/kong/kong-operator/ingress-controller/test/consts"
4948
"github.com/kong/kong-operator/ingress-controller/test/internal/helpers"
5049
"github.com/kong/kong-operator/ingress-controller/test/internal/testenv"
5150
)
@@ -109,8 +108,9 @@ func setupE2ETest(t *testing.T, addons ...clusters.Addon) (context.Context, envi
109108
require.NoError(t, err)
110109
logClusterInfo(t, env.Cluster())
111110

112-
t.Logf("deploying KIC Incubator CRDs from %s (since they are not packaged with base CRDs)", conststest.IncubatorCRDKustomizeDir)
113-
require.NoError(t, clusters.KustomizeDeployForCluster(ctx, env.Cluster(), conststest.IncubatorCRDKustomizeDir))
111+
const incubatorCRDKustomizeDir = "../../config/crd/incubator"
112+
t.Logf("deploying KIC Incubator CRDs from %s (since they are not packaged with base CRDs)", incubatorCRDKustomizeDir)
113+
require.NoError(t, clusters.KustomizeDeployForCluster(ctx, env.Cluster(), incubatorCRDKustomizeDir))
114114

115115
t.Cleanup(func() {
116116
output := helpers.DumpDiagnosticsIfFailed(ctx, t, env.Cluster())

ingress-controller/test/util/gomod.go

Lines changed: 0 additions & 74 deletions
This file was deleted.

ingress-controller/test/util/kustomize_consts.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ import (
1111
)
1212

1313
const (
14-
// kubernetesConfigurationModulePath is the kubernetes-configuration path used by the kustomize.
15-
// It's different than the path used by Go mod related functions as these do change
16-
// based on the major version of the module used whereas this one doesn't.
17-
kubernetesConfigurationModulePath = "github.com/kong/kubernetes-configuration"
1814
// ingressControllerModulePath points to Kubernetes configuration for KGO, since KIC part
1915
// only needs a subset of it, so a dedicated one is not needed.
2016
ingressControllerLocalPath = "./"

pkg/consts/consts.go

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -137,28 +137,6 @@ const (
137137
KongClusterCertVolumeMountPath = "/etc/secrets/kong-cluster-cert"
138138
)
139139

140-
// -----------------------------------------------------------------------------
141-
// Consts - Webhook-related parameters
142-
// -----------------------------------------------------------------------------
143-
144-
const (
145-
// WebhookCertificateConfigBaseImage is the image to use by the certificate config Jobs.
146-
WebhookCertificateConfigBaseImage = "registry.k8s.io/ingress-nginx/kube-webhook-certgen:v1.3.0"
147-
// WebhookCertificateConfigShellImage is the image to use by the certificate config Jobs.
148-
WebhookCertificateConfigShellImage = "busybox"
149-
// WebhookName is the ValidatingWebhookConfiguration name.
150-
WebhookName = "gateway-operator-validation.konghq.com"
151-
// WebhookCertificateConfigSecretName is the name of the secret containing the webhook certificate.
152-
WebhookCertificateConfigSecretName = "gateway-operator-webhook-certs"
153-
// WebhookCertificateConfigName is the name given to the resources related by the certificate config Jobs.
154-
WebhookCertificateConfigName = "gateway-operator-admission"
155-
// WebhookCertificateConfigLabelvalue is the default label for all the resources related
156-
// to the certificate config Jobs.
157-
WebhookCertificateConfigLabelvalue = "gateway-operator-certificate-config"
158-
// WebhookServiceName is the name of the service that exposes the validating webhook
159-
WebhookServiceName = "gateway-operator-validating-webhook"
160-
)
161-
162140
// -----------------------------------------------------------------------------
163141
// Consts - Kong proxy environment variables
164142
// -----------------------------------------------------------------------------

pkg/utils/test/setup_helpers.go

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@ import (
3030
operatorclient "github.com/kong/kong-operator/pkg/clientset"
3131
)
3232

33-
const (
34-
// KubernetesConfigurationModuleName is the name of the module where we import and install Kong configuration CRDs from.
35-
KubernetesConfigurationModuleName = "github.com/kong/kubernetes-configuration/v2"
36-
// GatewayAPIModuleName is the name of the module where we import and install Gateway API CRDs from.
37-
GatewayAPIModuleName = "sigs.k8s.io/gateway-api"
38-
)
39-
40-
func noOpClose() error {
41-
return nil
42-
}
43-
4433
// SetupControllerLogger sets up the controller logger.
4534
// This functions needs to be called before 30sec after the controller packages
4635
// is loaded, otherwise the logger will not be initialized.
@@ -57,7 +46,10 @@ func SetupControllerLogger(controllerManagerOut string) (func() error, error) {
5746
if controllerManagerOut != "stdout" {
5847
out, err := os.CreateTemp("", "gateway-operator-controller-logs")
5948
if err != nil {
60-
return noOpClose, err
49+
// noOpClose
50+
return func() error {
51+
return nil
52+
}, err
6153
}
6254
fmt.Printf("INFO: controller output is being logged to %s\n", out.Name())
6355
destWriter = out

pkg/utils/test/setup_helpers_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ func TestConstructModulePath(t *testing.T) {
1717
}{
1818
{
1919
name: "simple module",
20-
moduleName: "github.com/kong/kubernetes-configuration",
20+
moduleName: "github.com/kong/example-module",
2121
version: "v1.0.0",
22-
expected: filepath.Join(build.Default.GOPATH, "pkg", "mod", "github.com", "kong", "kubernetes-configuration@v1.0.0"),
22+
expected: filepath.Join(build.Default.GOPATH, "pkg", "mod", "github.com", "kong", "example-module@v1.0.0"),
2323
},
2424
{
2525
name: "simple module v2",
26-
moduleName: "github.com/kong/kubernetes-configuration/v2",
26+
moduleName: "github.com/kong/example-module/v2",
2727
version: "v2.0.0",
28-
expected: filepath.Join(build.Default.GOPATH, "pkg", "mod", "github.com", "kong", "kubernetes-configuration", "[email protected]"),
28+
expected: filepath.Join(build.Default.GOPATH, "pkg", "mod", "github.com", "kong", "example-module", "[email protected]"),
2929
},
3030
{
3131
name: "module with subdomain",

test/envtest/setup.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ import (
2929
func Setup(t *testing.T, ctx context.Context, scheme *k8sruntime.Scheme) (*rest.Config, *corev1.Namespace) {
3030
t.Helper()
3131

32-
gwAPIVersion, err := testutil.ExtractModuleVersion(testutil.GatewayAPIModuleName)
32+
// GatewayAPIModuleName is the name of the module where we import and install Gateway API CRDs from.
33+
const gatewayAPIModuleName = "sigs.k8s.io/gateway-api"
34+
gwAPIVersion, err := testutil.ExtractModuleVersion(gatewayAPIModuleName)
3335
require.NoError(t, err)
3436
gwAPICRDPath := filepath.Join(
35-
testutil.ConstructModulePath(testutil.GatewayAPIModuleName, gwAPIVersion),
37+
testutil.ConstructModulePath(gatewayAPIModuleName, gwAPIVersion),
3638
"config", "crd", "standard",
3739
)
3840

0 commit comments

Comments
 (0)