Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
199 changes: 99 additions & 100 deletions go.mod

Large diffs are not rendered by default.

369 changes: 187 additions & 182 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions images/hello-openshift/Dockerfile.rhel
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.19-openshift-4.13 AS builder
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.20-openshift-4.14 AS builder
WORKDIR /go/src/github.com/openshift/hello-openshift
COPY examples/hello-openshift .
RUN go build -o /hello-openshift

FROM registry.ci.openshift.org/ocp/4.13:base
FROM registry.ci.openshift.org/ocp/4.14:base
COPY --from=builder /hello-openshift /hello-openshift
EXPOSE 8080 8888
USER 1001
Expand Down
6 changes: 3 additions & 3 deletions pkg/monitor/resourcewatch/storage/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/util/managedfields"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/endpoints/handlers/fieldmanager"
"sigs.k8s.io/structured-merge-diff/v4/typed"
)

var typeConverter fieldmanager.TypeConverter = fieldmanager.DeducedTypeConverter{}
var typeConverter managedfields.TypeConverter = managedfields.NewDeducedTypeConverter()

func modifiedFields(oldRuntimeObject, newRuntimeObject *unstructured.Unstructured) (*typed.Comparison, error) {
oldObject, err := typeConverter.ObjectToTyped(oldRuntimeObject)
Expand All @@ -36,7 +36,7 @@ func modifiedFields(oldRuntimeObject, newRuntimeObject *unstructured.Unstructure
func whichUsersOwnModifiedFields(obj *unstructured.Unstructured, comparison typed.Comparison) ([]string, error) {
users := sets.NewString()

managers, err := fieldmanager.DecodeManagedFields(obj.GetManagedFields())
managers, err := managedfields.DecodeManagedFields(obj.GetManagedFields())
if err != nil {
return nil, err
}
Expand Down
8 changes: 4 additions & 4 deletions test/e2e/upgrade/adminack/adminack.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (UpgradeTest) DisplayName() string {
}

// Setup creates artifacts to be used by Test
func (t *UpgradeTest) Setup(f *framework.Framework) {
func (t *UpgradeTest) Setup(ctx context.Context, f *framework.Framework) {
g.By("Setting up admin ack test")
oc := exutil.NewCLIWithFramework(f)
t.oc = oc
Expand All @@ -41,8 +41,8 @@ func (t *UpgradeTest) Setup(f *framework.Framework) {
// test first verifies that Upgradeable condition is false for correct reason and with correct message. It then
// modifies the admin-acks configmap to ack the necessary admin-ack gate and then waits for the Upgradeable
// condition to change to true.
func (t *UpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
ctx, cancel := context.WithCancel(context.Background())
func (t *UpgradeTest) Test(ctx context.Context, f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
go func() {
<-done
Expand All @@ -54,6 +54,6 @@ func (t *UpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade
}

// Teardown cleans up any remaining objects.
func (t *UpgradeTest) Teardown(f *framework.Framework) {
func (t *UpgradeTest) Teardown(ctx context.Context, f *framework.Framework) {
// rely on the namespace deletion to clean up everything
}
6 changes: 3 additions & 3 deletions test/e2e/upgrade/alert/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func (UpgradeTest) DisplayName() string {
}

// Setup creates parameters to query Prometheus
func (t *UpgradeTest) Setup(f *framework.Framework) {
func (t *UpgradeTest) Setup(ctx context.Context, f *framework.Framework) {
g.By("Setting up upgrade alert test")

t.oc = exutil.NewCLIWithFramework(f)
Expand All @@ -34,7 +34,7 @@ func (t *UpgradeTest) Setup(f *framework.Framework) {
// Test checks if alerts are firing at various points during upgrade.
// An alert firing during an upgrade is a high severity bug - it either points to a real issue in
// a dependency, or a failure of the component, and therefore must be fixed.
func (t *UpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
func (t *UpgradeTest) Test(ctx context.Context, f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
g.By("Checking for alerts")
startTime := time.Now()

Expand All @@ -53,6 +53,6 @@ func (t *UpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade
}

// Teardown cleans up any remaining resources.
func (t *UpgradeTest) Teardown(f *framework.Framework) {
func (t *UpgradeTest) Teardown(ctx context.Context, f *framework.Framework) {
// rely on the namespace deletion to clean up everything
}
8 changes: 4 additions & 4 deletions test/e2e/upgrade/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (UpgradeTest) DisplayName() string {
}

// Setup creates a DaemonSet to verify DNS availability during and after upgrade
func (t *UpgradeTest) Setup(f *framework.Framework) {
func (t *UpgradeTest) Setup(ctx context.Context, f *framework.Framework) {
ginkgo.By("Setting up upgrade DNS availability test")

ginkgo.By("Getting DNS Service Cluster IP")
Expand All @@ -45,15 +45,15 @@ func (t *UpgradeTest) Setup(f *framework.Framework) {

ginkgo.By("Waiting for DaemonSet pods to become ready")
err := wait.Poll(framework.Poll, framework.PodStartTimeout, func() (bool, error) {
return e2edaemonset.CheckRunningOnAllNodes(f, ds)
return e2edaemonset.CheckRunningOnAllNodes(ctx, f, ds)
})
framework.ExpectNoError(err)

}

// Test checks for logs from DNS availability test a minute after upgrade finishes
// to cover during and after upgrade phase, and verifies the results.
func (t *UpgradeTest) Test(f *framework.Framework, done <-chan struct{}, _ upgrades.UpgradeType) {
func (t *UpgradeTest) Test(ctx context.Context, f *framework.Framework, done <-chan struct{}, _ upgrades.UpgradeType) {
ginkgo.By("Validating DNS results during upgrade")
t.validateDNSResults(f)

Expand Down Expand Up @@ -156,6 +156,6 @@ func (t *UpgradeTest) validateDNSResults(f *framework.Framework) {

// Teardown cleans up any objects that are created that
// aren't already cleaned up by the framework.
func (t *UpgradeTest) Teardown(_ *framework.Framework) {
func (t *UpgradeTest) Teardown(_ context.Context, _ *framework.Framework) {
// rely on the namespace deletion to clean up everything
}
36 changes: 18 additions & 18 deletions test/e2e/upgrade/manifestdelete/manifest-delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (UpgradeTest) DisplayName() string {
}

// Setup creates artifacts to be used by Test
func (t *UpgradeTest) Setup(f *framework.Framework) {
func (t *UpgradeTest) Setup(ctx context.Context, f *framework.Framework) {
g.By("Setting up upgrade delete test")
oc := exutil.NewCLIWithFramework(f)
t.oc = oc
Expand All @@ -105,7 +105,7 @@ func (t *UpgradeTest) Setup(f *framework.Framework) {

// Test fails if any of the resources specified above in 'deletes' and 'unstructuredDeletes'
// exist on the upgraded cluster.
func (t *UpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
func (t *UpgradeTest) Test(ctx context.Context, f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
if len(deletes) == 0 && len(unstructuredDeletes) == 0 {
framework.Logf("No object deletions in this release to verify")
return
Expand All @@ -121,35 +121,35 @@ func (t *UpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade
kind := strings.ToLower(r.kind)
switch kind {
case "configmap":
_, err = t.oc.AdminKubeClient().CoreV1().ConfigMaps(r.namespace).Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().CoreV1().ConfigMaps(r.namespace).Get(ctx, r.name, metav1.GetOptions{})
case "namespace":
_, err = t.oc.AdminKubeClient().CoreV1().Namespaces().Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().CoreV1().Namespaces().Get(ctx, r.name, metav1.GetOptions{})
case "service":
_, err = t.oc.AdminKubeClient().CoreV1().Services(r.namespace).Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().CoreV1().Services(r.namespace).Get(ctx, r.name, metav1.GetOptions{})
case "serviceaccount":
_, err = t.oc.AdminKubeClient().CoreV1().ServiceAccounts(r.namespace).Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().CoreV1().ServiceAccounts(r.namespace).Get(ctx, r.name, metav1.GetOptions{})
case "customobjectdefinition":
crdClient := apiextensionsclientset.NewForConfigOrDie(t.oc.AdminConfig())
_, err = crdClient.ApiextensionsV1().CustomResourceDefinitions().Get(context.Background(), r.name, metav1.GetOptions{})
_, err = crdClient.ApiextensionsV1().CustomResourceDefinitions().Get(ctx, r.name, metav1.GetOptions{})
case "apiservice":
apiClient := apiregistrationsclientset.NewForConfigOrDie(t.oc.AdminConfig())
_, err = apiClient.ApiregistrationV1().APIServices().Get(context.Background(), r.name, metav1.GetOptions{})
_, err = apiClient.ApiregistrationV1().APIServices().Get(ctx, r.name, metav1.GetOptions{})
case "deployment":
_, err = t.oc.AdminKubeClient().AppsV1().Deployments(r.namespace).Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().AppsV1().Deployments(r.namespace).Get(ctx, r.name, metav1.GetOptions{})
case "daemonset":
_, err = t.oc.AdminKubeClient().AppsV1().DaemonSets(r.namespace).Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().AppsV1().DaemonSets(r.namespace).Get(ctx, r.name, metav1.GetOptions{})
case "job":
_, err = t.oc.AdminKubeClient().BatchV1().Jobs(r.namespace).Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().BatchV1().Jobs(r.namespace).Get(ctx, r.name, metav1.GetOptions{})
case "clusterrolebinding":
_, err = t.oc.AdminKubeClient().RbacV1().ClusterRoleBindings().Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().RbacV1().ClusterRoleBindings().Get(ctx, r.name, metav1.GetOptions{})
case "clusterrole":
_, err = t.oc.AdminKubeClient().RbacV1().ClusterRoles().Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().RbacV1().ClusterRoles().Get(ctx, r.name, metav1.GetOptions{})
case "rolebinding":
_, err = t.oc.AdminKubeClient().RbacV1().RoleBindings(r.namespace).Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().RbacV1().RoleBindings(r.namespace).Get(ctx, r.name, metav1.GetOptions{})
case "role":
_, err = t.oc.AdminKubeClient().RbacV1().Roles(r.namespace).Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminKubeClient().RbacV1().Roles(r.namespace).Get(ctx, r.name, metav1.GetOptions{})
case "securitycontextconstraints":
_, err = t.oc.AdminSecurityClient().SecurityV1().SecurityContextConstraints().Get(context.Background(), r.name, metav1.GetOptions{})
_, err = t.oc.AdminSecurityClient().SecurityV1().SecurityContextConstraints().Get(ctx, r.name, metav1.GetOptions{})
default:
framework.Failf("Unrecognized object kind %s", kind)
}
Expand All @@ -170,7 +170,7 @@ func (t *UpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade
} else {
dynClient = dynamicClient.Resource(gvr).Namespace(u.namespace)
}
_, err := dynClient.Get(context.Background(), u.name, metav1.GetOptions{})
_, err := dynClient.Get(ctx, u.name, metav1.GetOptions{})
check(u.String(), err)
framework.Logf("Object %s deletion verified", u)
}
Expand All @@ -186,6 +186,6 @@ func check(obj string, err error) {
}

// Teardown cleans up any remaining objects.
func (t *UpgradeTest) Teardown(f *framework.Framework) {
func (t *UpgradeTest) Teardown(ctx context.Context, f *framework.Framework) {
// rely on the namespace deletion to clean up everything
}
25 changes: 13 additions & 12 deletions test/e2e/upgrade/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ func (t *serviceLoadBalancerUpgradeTest) loadBalancerSetup(f *framework.Framewor

ns := f.Namespace
cs := f.ClientSet
ctx := context.Background()

ginkgo.By("creating a TCP service " + serviceName + " with type=LoadBalancer in namespace " + ns.Name)
tcpService, err := jig.CreateTCPService(func(s *v1.Service) {
tcpService, err := jig.CreateTCPService(ctx, func(s *v1.Service) {
s.Spec.Type = v1.ServiceTypeLoadBalancer
// ServiceExternalTrafficPolicyTypeCluster performs during disruption, Local does not
s.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeCluster
Expand All @@ -149,15 +150,15 @@ func (t *serviceLoadBalancerUpgradeTest) loadBalancerSetup(f *framework.Framewor
// - thus pods need to stay up for > 32s, so pod shutdown period will will be 45s
})
framework.ExpectNoError(err)
tcpService, err = jig.WaitForLoadBalancer(service.GetServiceLoadBalancerCreationTimeout(cs))
tcpService, err = jig.WaitForLoadBalancer(ctx, service.GetServiceLoadBalancerCreationTimeout(ctx, cs))
framework.ExpectNoError(err)

// Get info to hit it with
tcpIngressIP := service.GetIngressPoint(&tcpService.Status.LoadBalancer.Ingress[0])
svcPort := int(tcpService.Spec.Ports[0].Port)

ginkgo.By("creating RC to be part of service " + serviceName)
rc, err := jig.Run(func(rc *v1.ReplicationController) {
rc, err := jig.Run(ctx, func(rc *v1.ReplicationController) {
// ensure the pod waits long enough during update for the LB to see the newly ready pod, which
// must be longer than the worst load balancer above (GCP at 32s)
rc.Spec.MinReadySeconds = 33
Expand All @@ -179,7 +180,7 @@ func (t *serviceLoadBalancerUpgradeTest) loadBalancerSetup(f *framework.Framewor

if shouldTestPDBs() {
ginkgo.By("creating a PodDisruptionBudget to cover the ReplicationController")
_, err = jig.CreatePDB(rc)
_, err = jig.CreatePDB(ctx, rc)
framework.ExpectNoError(err)
}

Expand All @@ -198,28 +199,28 @@ func (t *serviceLoadBalancerUpgradeTest) loadBalancerSetup(f *framework.Framewor
}

// Test runs a connectivity check to the service.
func (t *serviceLoadBalancerUpgradeTest) Test(f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
func (t *serviceLoadBalancerUpgradeTest) Test(ctx context.Context, f *framework.Framework, done <-chan struct{}, upgrade upgrades.UpgradeType) {
if t.unsupportedPlatform {
return
}

t.backendDisruptionTest.Test(f, done, upgrade)
t.backendDisruptionTest.Test(ctx, f, done, upgrade)

// verify finalizer behavior
defer func() {
ginkgo.By("Check that service can be deleted with finalizer")
service.WaitForServiceDeletedWithFinalizer(t.jig.Client, t.tcpService.Namespace, t.tcpService.Name)
service.WaitForServiceDeletedWithFinalizer(ctx, t.jig.Client, t.tcpService.Namespace, t.tcpService.Name)
}()
ginkgo.By("Check that finalizer is present on loadBalancer type service")
service.WaitForServiceUpdatedWithFinalizer(t.jig.Client, t.tcpService.Namespace, t.tcpService.Name, true)
service.WaitForServiceUpdatedWithFinalizer(ctx, t.jig.Client, t.tcpService.Namespace, t.tcpService.Name, true)
}

func (t *serviceLoadBalancerUpgradeTest) Teardown(f *framework.Framework) {
t.backendDisruptionTest.Teardown(f)
func (t *serviceLoadBalancerUpgradeTest) Teardown(ctx context.Context, f *framework.Framework) {
t.backendDisruptionTest.Teardown(ctx, f)
}

func (t *serviceLoadBalancerUpgradeTest) Setup(f *framework.Framework) {
t.backendDisruptionTest.Setup(f)
func (t *serviceLoadBalancerUpgradeTest) Setup(ctx context.Context, f *framework.Framework) {
t.backendDisruptionTest.Setup(ctx, f)
}

// TestReachableHTTPWithMinSuccessCount tests that the given host serves HTTP on the given port for a minimum of successCount number of
Expand Down
4 changes: 2 additions & 2 deletions test/extended/builds/multistage.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ COPY --from=%[2]s /bin/ping /test/
e2e.Logf("Build logs:\n%s", result)

c := e2epod.PodClientNS(oc.KubeFramework(), oc.Namespace())
pod = c.Create(&corev1.Pod{
pod = c.Create(context.TODO(), &corev1.Pod{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
},
Expand All @@ -118,7 +118,7 @@ COPY --from=%[2]s /bin/ping /test/
},
},
})
c.WaitForSuccess(pod.Name, e2e.PodStartTimeout)
c.WaitForSuccess(context.TODO(), pod.Name, e2e.PodStartTimeout)
data, err := oc.Run("logs").Args("-f", "test", "-c", "run").Output()
o.Expect(err).NotTo(o.HaveOccurred())
m, err := oc.Run("logs").Args("-f", "test", "-c", "check").Output()
Expand Down
3 changes: 2 additions & 1 deletion test/extended/builds/s2i_env.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package builds

import (
"context"
"fmt"
"path/filepath"
"strings"
Expand Down Expand Up @@ -68,7 +69,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][Slow] s2i build with environmen
o.Expect(err).NotTo(o.HaveOccurred())

g.By("waiting for the pod to be running")
err = pod.WaitForPodNameRunningInNamespace(oc.KubeFramework().ClientSet, "build-test-pod", oc.Namespace())
err = pod.WaitForPodNameRunningInNamespace(context.TODO(), oc.KubeFramework().ClientSet, "build-test-pod", oc.Namespace())
o.Expect(err).NotTo(o.HaveOccurred())

g.By("waiting for the service to become available")
Expand Down
3 changes: 2 additions & 1 deletion test/extended/builds/s2i_incremental.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package builds

import (
"context"
"fmt"
"path/filepath"
"strings"
Expand Down Expand Up @@ -67,7 +68,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][Slow] incremental s2i build", f
o.Expect(err).NotTo(o.HaveOccurred())

g.By("waiting for the pod to be running")
err = pod.WaitForPodNameRunningInNamespace(oc.KubeFramework().ClientSet, "build-test-pod", oc.Namespace())
err = pod.WaitForPodNameRunningInNamespace(context.TODO(), oc.KubeFramework().ClientSet, "build-test-pod", oc.Namespace())
o.Expect(err).NotTo(o.HaveOccurred())

g.By("waiting for the service to become available")
Expand Down
5 changes: 3 additions & 2 deletions test/extended/builds/secrets.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package builds

import (
"context"
"path/filepath"

g "github.com/onsi/ginkgo/v2"
Expand Down Expand Up @@ -75,7 +76,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][Slow] can use build secrets", f

g.By("verifying the build sources were available during build and secrets were not present in the output image")
pod := exutil.GetPodForContainer(corev1.Container{Name: "test", Image: image})
e2eoutput.TestContainerOutput(oc.KubeFramework(), "test-build-secret-source", pod, 0, []string{
e2eoutput.TestContainerOutput(context.TODO(), oc.KubeFramework(), "test-build-secret-source", pod, 0, []string{
"testsecret/secret1=secret1",
"testsecret/secret2=secret2",
"testsecret/secret3=secret3",
Expand Down Expand Up @@ -106,7 +107,7 @@ var _ = g.Describe("[sig-builds][Feature:Builds][Slow] can use build secrets", f

g.By("verifying the build sources are present in container output")
pod := exutil.GetPodForContainer(corev1.Container{Name: "test", Image: image})
e2eoutput.TestContainerOutput(oc.KubeFramework(), "test-build-secret-docker", pod, 0, []string{
e2eoutput.TestContainerOutput(context.TODO(), oc.KubeFramework(), "test-build-secret-docker", pod, 0, []string{
"secret1=secret1",
"relative-secret2=secret2",
"foo=bar",
Expand Down
4 changes: 2 additions & 2 deletions test/extended/cli/compat.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ var _ = g.Describe("[sig-cli] oc", func() {
}, metav1.CreateOptions{})
o.Expect(err).NotTo(o.HaveOccurred())

pod := cli.Create(newShellPod(heredoc.Docf(`
pod := cli.Create(context.TODO(), newShellPod(heredoc.Docf(`
set -x

# verify we can make API calls
oc get secrets
oc whoami
`)))
cli.WaitForSuccess(pod.Name, 5*time.Minute)
cli.WaitForSuccess(context.TODO(), pod.Name, 5*time.Minute)
})

g.It("can get list of nodes", func() {
Expand Down
Loading