diff --git a/DistTestCore/Codex/CodexContainerRecipe.cs b/DistTestCore/Codex/CodexContainerRecipe.cs index 834f7af..dfaf3a1 100644 --- a/DistTestCore/Codex/CodexContainerRecipe.cs +++ b/DistTestCore/Codex/CodexContainerRecipe.cs @@ -7,10 +7,10 @@ namespace DistTestCore.Codex public class CodexContainerRecipe : ContainerRecipeFactory { #if Arm64 - public const string DockerImage = "emizzle/nim-codex-arm64:sha-c7af585"; + public const string DockerImage = "codexstorage/nim-codex:sha-7b88ea0"; #else - //public const string DockerImage = "thatbenbierens/nim-codex:sha-9716635"; - public const string DockerImage = "thatbenbierens/codexlocal:latest"; + //public const string DockerImage = "codexstorage/nim-codex:sha-7b88ea0"; + public const string DockerImage = "codexstorage/nim-codex:sha-7b88ea0"; #endif public const string MetricsPortTag = "metrics_port"; public const string DiscoveryPortTag = "discovery-port"; diff --git a/KubernetesWorkflow/K8sController.cs b/KubernetesWorkflow/K8sController.cs index fd42d07..782632d 100644 --- a/KubernetesWorkflow/K8sController.cs +++ b/KubernetesWorkflow/K8sController.cs @@ -148,10 +148,7 @@ namespace KubernetesWorkflow }, Spec = new V1NetworkPolicySpec { - PodSelector = new V1LabelSelector - { - MatchLabels = GetSelector() - }, + PodSelector = new V1LabelSelector {}, PolicyTypes = new[] { "Ingress", @@ -165,16 +162,23 @@ namespace KubernetesWorkflow { new V1NetworkPolicyPeer { - NamespaceSelector = new V1LabelSelector - { - MatchLabels = GetMyNamespaceSelector() - } + PodSelector = new V1LabelSelector {} } } } }, Egress = new List { + new V1NetworkPolicyEgressRule + { + To = new List + { + new V1NetworkPolicyPeer + { + PodSelector = new V1LabelSelector {} + } + } + }, new V1NetworkPolicyEgressRule { To = new List @@ -183,11 +187,62 @@ namespace KubernetesWorkflow { NamespaceSelector = new V1LabelSelector { - MatchLabels = GetMyNamespaceSelector() + MatchLabels = new Dictionary { { "kubernetes.io/metadata.name", "kube-system" } } } + }, + new V1NetworkPolicyPeer + { + PodSelector = new V1LabelSelector + { + MatchLabels = new Dictionary { { "k8s-app", "kube-dns" } } + } + } + }, + Ports = new List + { + new V1NetworkPolicyPort + { + Port = new IntstrIntOrString + { + Value = "53" + }, + Protocol = "UDP" + } + } + }, + new V1NetworkPolicyEgressRule + { + To = new List + { + new V1NetworkPolicyPeer + { + IpBlock = new V1IPBlock + { + Cidr = "0.0.0.0/0" + } + } + }, + Ports = new List + { + new V1NetworkPolicyPort + { + Port = new IntstrIntOrString + { + Value = "80" + }, + Protocol = "TCP" + }, + new V1NetworkPolicyPort + { + Port = new IntstrIntOrString + { + Value = "443" + }, + Protocol = "TCP" } } } + } } }; @@ -255,11 +310,6 @@ namespace KubernetesWorkflow return new Dictionary { { "codex-test-node", "dist-test-" + workflowNumberSource.WorkflowNumber } }; } - private IDictionary GetMyNamespaceSelector() - { - return new Dictionary { { "name", "thatisincorrect" } }; - } - private V1ObjectMeta CreateDeploymentMetadata() { return new V1ObjectMeta @@ -333,7 +383,7 @@ namespace KubernetesWorkflow if (!ports.Any()) { - // None of these container-recipes wish to expose anything via a serice port. + // None of these container-recipes wish to expose anything via a service port. // So, we don't have to create a service. return (string.Empty, result); } diff --git a/README.md b/README.md index 34b3ab1..9f5ebef 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # Distributed System Tests for Nim-Codex -Using a common dotnet unit-test framework and a few other libraries, this project allows you to write tests that use multiple Codex node instances in various configurations to test the distributed system in a controlled, reproducable environment. -Nim-Codex: https://github.com/status-im/nim-codex +Using a common dotnet unit-test framework and a few other libraries, this project allows you to write tests that use multiple Codex node instances in various configurations to test the distributed system in a controlled, reproducible environment. + + +Nim-Codex: https://github.com/codex-storage/nim-codex Dotnet: v6.0 Kubernetes: v1.25.4 Dotnet-kubernetes SDK: v10.1.4 https://github.com/kubernetes-client/csharp diff --git a/codexnode-manifest.yml b/codexnode-manifest.yml index dafddec..fdd4262 100644 --- a/codexnode-manifest.yml +++ b/codexnode-manifest.yml @@ -24,7 +24,7 @@ spec: spec: containers: - name: codex-node1 - image: thatbenbierens/nim-codex:sha-b204837 + image: codexstorage/nim-codex:sha-7b88ea0 ports: - containerPort: 8080 name: api-1 @@ -38,7 +38,7 @@ spec: - name: LISTEN_ADDRS value: "/ip4/0.0.0.0/tcp/8082" - name: codex-node2 - image: thatbenbierens/nim-codex:sha-b204837 + image: codexstorage/nim-codex:sha-7b88ea0 ports: - containerPort: 8083 name: api-2