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

chore: replace deprecated function #6024

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/projectcontour/v1alpha1/contourdeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type ContourDeploymentSpec struct {
type ContourSettings struct {
// Deprecated: Use `DeploymentSettings.Replicas` instead.
//
// Replicas is the desired number of Contour replicas. If if unset,
// Replicas is the desired number of Contour replicas. If unset,
// defaults to 2.
//
// if both `DeploymentSettings.Replicas` and this one is set, use `DeploymentSettings.Replicas`.
Expand Down
6 changes: 3 additions & 3 deletions examples/contour/01-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1467,9 +1467,9 @@ spec:
type: object
replicas:
description: "Deprecated: Use `DeploymentSettings.Replicas` instead.
\n Replicas is the desired number of Contour replicas. If if
unset, defaults to 2. \n if both `DeploymentSettings.Replicas`
and this one is set, use `DeploymentSettings.Replicas`."
\n Replicas is the desired number of Contour replicas. If unset,
defaults to 2. \n if both `DeploymentSettings.Replicas` and
this one is set, use `DeploymentSettings.Replicas`."
format: int32
minimum: 0
type: integer
Expand Down
6 changes: 3 additions & 3 deletions examples/render/contour-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1686,9 +1686,9 @@ spec:
type: object
replicas:
description: "Deprecated: Use `DeploymentSettings.Replicas` instead.
\n Replicas is the desired number of Contour replicas. If if
unset, defaults to 2. \n if both `DeploymentSettings.Replicas`
and this one is set, use `DeploymentSettings.Replicas`."
\n Replicas is the desired number of Contour replicas. If unset,
defaults to 2. \n if both `DeploymentSettings.Replicas` and
this one is set, use `DeploymentSettings.Replicas`."
format: int32
minimum: 0
type: integer
Expand Down
6 changes: 3 additions & 3 deletions examples/render/contour-gateway-provisioner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1478,9 +1478,9 @@ spec:
type: object
replicas:
description: "Deprecated: Use `DeploymentSettings.Replicas` instead.
\n Replicas is the desired number of Contour replicas. If if
unset, defaults to 2. \n if both `DeploymentSettings.Replicas`
and this one is set, use `DeploymentSettings.Replicas`."
\n Replicas is the desired number of Contour replicas. If unset,
defaults to 2. \n if both `DeploymentSettings.Replicas` and
this one is set, use `DeploymentSettings.Replicas`."
format: int32
minimum: 0
type: integer
Expand Down
6 changes: 3 additions & 3 deletions examples/render/contour-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1689,9 +1689,9 @@ spec:
type: object
replicas:
description: "Deprecated: Use `DeploymentSettings.Replicas` instead.
\n Replicas is the desired number of Contour replicas. If if
unset, defaults to 2. \n if both `DeploymentSettings.Replicas`
and this one is set, use `DeploymentSettings.Replicas`."
\n Replicas is the desired number of Contour replicas. If unset,
defaults to 2. \n if both `DeploymentSettings.Replicas` and
this one is set, use `DeploymentSettings.Replicas`."
format: int32
minimum: 0
type: integer
Expand Down
6 changes: 3 additions & 3 deletions examples/render/contour.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1686,9 +1686,9 @@ spec:
type: object
replicas:
description: "Deprecated: Use `DeploymentSettings.Replicas` instead.
\n Replicas is the desired number of Contour replicas. If if
unset, defaults to 2. \n if both `DeploymentSettings.Replicas`
and this one is set, use `DeploymentSettings.Replicas`."
\n Replicas is the desired number of Contour replicas. If unset,
defaults to 2. \n if both `DeploymentSettings.Replicas` and
this one is set, use `DeploymentSettings.Replicas`."
format: int32
minimum: 0
type: integer
Expand Down
4 changes: 2 additions & 2 deletions internal/dag/accessors.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ import (
// namespace, name and port, and returns a DAG service for it. If a matching service
// cannot be found in the cache, an error is returned.
func (d *DAG) EnsureService(meta types.NamespacedName, port int, healthPort int, cache *KubernetesCache, enableExternalNameSvc bool) (*Service, error) {
svc, svcPort, err := cache.LookupService(meta, intstr.FromInt(port))
svc, svcPort, err := cache.LookupService(meta, intstr.FromInt32(int32(port)))
if err != nil {
return nil, err
}

healthSvcPort := svcPort
if healthPort != 0 && healthPort != port {
_, healthSvcPort, err = cache.LookupService(meta, intstr.FromInt(healthPort))
_, healthSvcPort, err = cache.LookupService(meta, intstr.FromInt32(int32(healthPort)))
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/dag/accessors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func makeServicePort(name string, protocol v1.Protocol, port int32, extras ...an
}

if len(extras) > 0 {
p.TargetPort = intstr.FromInt(extras[0].(int))
p.TargetPort = intstr.FromInt32(extras[0].(int32))
}

if len(extras) > 1 {
Expand Down
10 changes: 5 additions & 5 deletions internal/dag/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6036,7 +6036,7 @@ func TestDAGInsert(t *testing.T) {
IngressRuleValue: networking_v1.IngressRuleValue{
HTTP: &networking_v1.HTTPIngressRuleValue{
Paths: []networking_v1.HTTPIngressPath{{
Backend: *backendv1("kuard", intstr.FromInt(8080)),
Backend: *backendv1("kuard", intstr.FromInt32(8080)),
}},
},
},
Expand All @@ -6057,7 +6057,7 @@ func TestDAGInsert(t *testing.T) {
IngressRuleValue: networking_v1.IngressRuleValue{
HTTP: &networking_v1.HTTPIngressRuleValue{
Paths: []networking_v1.HTTPIngressPath{{
Backend: *backendv1("kuard", intstr.FromInt(8080)),
Backend: *backendv1("kuard", intstr.FromInt32(8080)),
}},
},
},
Expand All @@ -6073,7 +6073,7 @@ func TestDAGInsert(t *testing.T) {
},
Spec: networking_v1.IngressSpec{
Rules: []networking_v1.IngressRule{{
IngressRuleValue: ingressrulev1value(backendv1("kuard", intstr.FromInt(8080))),
IngressRuleValue: ingressrulev1value(backendv1("kuard", intstr.FromInt32(8080))),
}},
},
}
Expand Down Expand Up @@ -6105,7 +6105,7 @@ func TestDAGInsert(t *testing.T) {
}},
Rules: []networking_v1.IngressRule{{
Host: "kuard.example.com",
IngressRuleValue: ingressrulev1value(backendv1("kuard", intstr.FromInt(8080))),
IngressRuleValue: ingressrulev1value(backendv1("kuard", intstr.FromInt32(8080))),
}},
},
}
Expand Down Expand Up @@ -6245,7 +6245,7 @@ func TestDAGInsert(t *testing.T) {
Backend: *backendv1("kuard", intstr.FromString("http")),
}, {
Path: "/kuarder",
Backend: *backendv1("kuarder", intstr.FromInt(8080)),
Backend: *backendv1("kuarder", intstr.FromInt32(8080)),
}},
},
},
Expand Down
8 changes: 4 additions & 4 deletions internal/dag/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1790,7 +1790,7 @@ func TestLookupService(t *testing.T) {
"service and port exist with valid service protocol, lookup by port num": {
cache: cache(service("default", "service-1", makeServicePort("http", v1.ProtocolTCP, 80))),
meta: types.NamespacedName{Namespace: "default", Name: "service-1"},
port: intstr.FromInt(80),
port: intstr.FromInt32(80),
wantSvc: service("default", "service-1", makeServicePort("http", v1.ProtocolTCP, 80)),
wantPort: makeServicePort("http", v1.ProtocolTCP, 80),
},
Expand All @@ -1804,7 +1804,7 @@ func TestLookupService(t *testing.T) {
"service and port exist with valid service protocol, lookup by wrong port num": {
cache: cache(service("default", "service-1", makeServicePort("http", v1.ProtocolTCP, 80))),
meta: types.NamespacedName{Namespace: "default", Name: "service-1"},
port: intstr.FromInt(9999),
port: intstr.FromInt32(9999),
wantErr: errors.New(`port "9999" on service "default/service-1" not matched`),
},
"service and port exist with valid service protocol, lookup by wrong port name": {
Expand All @@ -1823,7 +1823,7 @@ func TestLookupService(t *testing.T) {
"service does not exist": {
cache: cache(service("default", "service-1", makeServicePort("http", v1.ProtocolTCP, 80))),
meta: types.NamespacedName{Namespace: "default", Name: "nonexistent-service"},
port: intstr.FromInt(80),
port: intstr.FromInt32(80),
wantErr: errors.New(`service "default/nonexistent-service" not found`),
},
}
Expand Down Expand Up @@ -1901,7 +1901,7 @@ func TestServiceTriggersRebuild(t *testing.T) {
Namespace: namespace,
},
Spec: networking_v1.IngressSpec{
DefaultBackend: backendv1(name, intstr.FromInt(80)),
DefaultBackend: backendv1(name, intstr.FromInt32(80)),
Rules: []networking_v1.IngressRule{{
Host: "test.projectcontour.io",
}},
Expand Down
2 changes: 1 addition & 1 deletion internal/dag/extension_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func (p *ExtensionServiceProcessor) buildExtensionService(
Name: target.Name,
}

svc, port, err := cache.LookupService(svcName, intstr.FromInt(target.Port))
svc, port, err := cache.LookupService(svcName, intstr.FromInt32(int32(target.Port)))
if err != nil {
validCondition.AddErrorf(contour_api_v1.ConditionTypeServiceError, "ServiceUnresolvedReference",
"unresolved service %q: %s", svcName, err)
Expand Down
4 changes: 2 additions & 2 deletions internal/dag/ingress_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestHttpPaths(t *testing.T) {
Backend: *backendv1("kuard", intstr.FromString("http")),
}, {
Path: "/kuarder",
Backend: *backendv1("kuarder", intstr.FromInt(8080)),
Backend: *backendv1("kuarder", intstr.FromInt32(8080)),
}},
},
},
Expand All @@ -55,7 +55,7 @@ func TestHttpPaths(t *testing.T) {
Backend: *backendv1("kuard", intstr.FromString("http")),
}, {
Path: "/kuarder",
Backend: *backendv1("kuarder", intstr.FromInt(8080)),
Backend: *backendv1("kuarder", intstr.FromInt32(8080)),
}},
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/dag/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func TestDAGStatus(t *testing.T) {
}},
Rules: []networking_v1.IngressRule{{
Host: "example.com",
IngressRuleValue: ingressrulev1value(backendv1(fixture.ServiceRootsNginx.Name, intstr.FromInt(80))),
IngressRuleValue: ingressrulev1value(backendv1(fixture.ServiceRootsNginx.Name, intstr.FromInt32(80))),
}},
},
}
Expand Down
2 changes: 1 addition & 1 deletion internal/debug/dot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func newTestService() *dag.Service {
Name: "http",
Protocol: "TCP",
Port: 8080,
TargetPort: intstr.FromInt(8080),
TargetPort: intstr.FromInt32(8080),
},
},
}
Expand Down
6 changes: 3 additions & 3 deletions internal/envoy/v3/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestCluster(t *testing.T) {
Name: "http",
Protocol: "TCP",
Port: 443,
TargetPort: intstr.FromInt(8080),
TargetPort: intstr.FromInt32(8080),
}},
},
}
Expand All @@ -66,7 +66,7 @@ func TestCluster(t *testing.T) {
Name: "http",
Protocol: "TCP",
Port: 443,
TargetPort: intstr.FromInt(8080),
TargetPort: intstr.FromInt32(8080),
}},
},
}
Expand Down Expand Up @@ -250,7 +250,7 @@ func TestCluster(t *testing.T) {
"externalName service - dns-lookup-family not defined": {
cluster: &dag.Cluster{
Upstream: service(s2),
//DNSLookupFamily: "auto",
// DNSLookupFamily: "auto",
},
want: &envoy_cluster_v3.Cluster{
Name: "default/kuard/443/da39a3ee5e",
Expand Down
2 changes: 1 addition & 1 deletion internal/envoy/v3/listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,7 @@ func TestTCPProxy(t *testing.T) {
ServicePort: v1.ServicePort{
Protocol: "TCP",
Port: 443,
TargetPort: intstr.FromInt(8443),
TargetPort: intstr.FromInt32(8443),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion internal/provisioner/objects/dataplane/dataplane.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func desiredContainers(contour *model.Contour, contourImage, envoyImage string)
PreStop: &corev1.LifecycleHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/shutdown",
Port: intstr.FromInt(8090),
Port: intstr.FromInt32(8090),
Scheme: "HTTP",
},
},
Expand Down
2 changes: 1 addition & 1 deletion site/content/docs/main/config/api-reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -6119,7 +6119,7 @@ <h3 id="projectcontour.io/v1alpha1.ContourSettings">ContourSettings
<td>
<em>(Optional)</em>
<p>Deprecated: Use <code>DeploymentSettings.Replicas</code> instead.</p>
<p>Replicas is the desired number of Contour replicas. If if unset,
<p>Replicas is the desired number of Contour replicas. If unset,
defaults to 2.</p>
<p>if both <code>DeploymentSettings.Replicas</code> and this one is set, use <code>DeploymentSettings.Replicas</code>.</p>
</td>
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ var _ = Describe("Benchmark", func() {
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/health",
Port: intstr.FromInt(3000),
Port: intstr.FromInt32(3000),
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (e *Echo) DeployN(ns, name string, replicas int32) (func(), *appsv1.Deploym
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/health",
Port: intstr.FromInt(3000),
Port: intstr.FromInt32(3000),
},
},
},
Expand Down Expand Up @@ -365,7 +365,7 @@ func (e *EchoSecure) Deploy(ns, name string) func() {
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/health",
Port: intstr.FromInt(3000),
Port: intstr.FromInt32(3000),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/httpproxy/cookie_rewrite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,7 @@ func deployEchoServer(t require.TestingT, c client.Client, ns, name string) {
ProbeHandler: corev1.ProbeHandler{
HTTPGet: &corev1.HTTPGetAction{
Path: "/ping",
Port: intstr.FromInt(3000),
Port: intstr.FromInt32(3000),
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/httpproxy/external_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func testExternalAuth(namespace string) {
Name: "auth",
Protocol: corev1.ProtocolTCP,
Port: 9443,
TargetPort: intstr.FromInt(9443),
TargetPort: intstr.FromInt32(9443),
},
},
Selector: map[string]string{
Expand Down
Loading