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

use the framework to create the UDN testing namespaces #29372

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions pkg/resourcewatch/controller/configmonitor/crd_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"k8s.io/client-go/dynamic/dynamicinformer"
"k8s.io/klog/v2"

kapi "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/tools/cache"
)
Expand Down Expand Up @@ -32,6 +33,9 @@ func WireResourceInformersToGitRepo(
dynamicInformer.AddEventHandler(
cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
if pod, ok := obj.(*kapi.Pod); ok {
klog.Errorf("KEYWORD: got add for pod %s/%s", pod.Namespace, pod.Name)
}
gitStorage.OnAdd(resourceToWatch, obj)
},
UpdateFunc: func(oldObj, newObj interface{}) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/resourcewatch/operator/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func RunResourceWatch() error {
return err
}

repositoryPath := "/repository"
repositoryPath := "./repository"
if repositoryPathEnv := os.Getenv("REPOSITORY_PATH"); len(repositoryPathEnv) > 0 {
repositoryPath = repositoryPathEnv
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/resourcewatch/storage/git_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (

"gopkg.in/src-d/go-git.v4"

kapi "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
Expand Down Expand Up @@ -228,6 +229,9 @@ func (s *GitStorage) OnUpdate(gvr schema.GroupVersionResource, oldObj, obj inter
// start new go func to allow parallel processing where possible and to avoid blocking all progress on retries.
go func() {
defer s.currentlyRecording.release(key)
if pod, ok := obj.(*kapi.Pod); ok {
klog.Errorf("KEYWORD: starting goroutine for %s/%s", pod.Namespace, pod.Name)
}
s.handle(gvr, oldObjUnstructured, objUnstructured, false)
}()
}
Expand Down
33 changes: 9 additions & 24 deletions test/extended/networking/network_segmentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,32 +372,17 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User

red := "red"
blue := "blue"

namespaceRed := f.Namespace.Name + "-" + red
namespaceBlue := f.Namespace.Name + "-" + blue
namespaceRed, err := f.CreateNamespace(context.Background(), "network-segmentation-"+red, nil)
Expect(err).NotTo(HaveOccurred())
namespaceBlue, err := f.CreateNamespace(context.Background(), "network-segmentation-"+blue, nil)
Expect(err).NotTo(HaveOccurred())

netConfig := networkAttachmentConfigParams{
topology: topology,
cidr: correctCIDRFamily(oc, userDefinedv4Subnet, userDefinedv6Subnet),
role: "primary",
}
for _, namespace := range []string{namespaceRed, namespaceBlue} {
By("Creating namespace " + namespace)
_, err := cs.CoreV1().Namespaces().Create(context.Background(), &v1.Namespace{
ObjectMeta: metav1.ObjectMeta{
Name: namespace,
},
}, metav1.CreateOptions{})
Expect(err).NotTo(HaveOccurred())
defer func() {
Expect(cs.CoreV1().Namespaces().Delete(
context.Background(),
namespace,
metav1.DeleteOptions{},
)).To(Succeed())
}()
}
networkNamespaceMap := map[string]string{namespaceRed: red, namespaceBlue: blue}
networkNamespaceMap := map[string]string{namespaceRed.Name: red, namespaceBlue.Name: blue}
for namespace, network := range networkNamespaceMap {
By("creating the network " + network + " in namespace " + namespace)
netConfig.namespace = namespace
Expand Down Expand Up @@ -481,7 +466,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User

By("Deleting pods in network blue except " + fmt.Sprintf("%s-pod-%d", blue, numberOfPods-1))
for i := 0; i < numberOfPods-1; i++ {
err := cs.CoreV1().Pods(namespaceBlue).Delete(
err := cs.CoreV1().Pods(namespaceBlue.Name).Delete(
context.Background(),
fmt.Sprintf("%s-pod-%d", blue, i),
metav1.DeleteOptions{},
Expand All @@ -491,9 +476,9 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User

podIP, err := podIPsForUserDefinedPrimaryNetwork(
cs,
namespaceBlue,
namespaceBlue.Name,
fmt.Sprintf("%s-pod-%d", blue, numberOfPods-1),
namespacedName(namespaceBlue, blue),
namespacedName(namespaceBlue.Name, blue),
0,
)
Expect(err).NotTo(HaveOccurred())
Expand All @@ -505,7 +490,7 @@ var _ = Describe("[sig-network][OCPFeatureGate:NetworkSegmentation][Feature:User
continue
}
_, err := e2ekubectl.RunKubectl(
namespaceBlue,
namespaceBlue.Name,
"exec",
fmt.Sprintf("%s-pod-%d", blue, numberOfPods-1),
"--",
Expand Down