Skip to content

Commit

Permalink
Specify static entries namespaces
Browse files Browse the repository at this point in the history
This commit fill the namespaces of some static custom entries, and
renames the variable name of cloudStaticEntries to be cloud generic
and not specific for AWS.

Adding DHCP port (67) as well.

Signed-off-by: Lior Noy <[email protected]>
  • Loading branch information
liornoy committed May 27, 2024
1 parent fb1b862 commit 3e554b1
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 61 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Use the `generate` Makefile target to create the matrix.
The following environment variables are used to configure:
```
FORMAT (csv/json/yaml)
CLUSTER_ENV (baremetal/aws)
CLUSTER_ENV (baremetal/cloud)
DEST_DIR (path to the directory containing the artifacts)
DEPLOYMENT (mno/sno)
```
Expand Down
6 changes: 3 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func main() {

flag.StringVar(&destDir, "destDir", "communication-matrix", "Output files dir")
flag.StringVar(&format, "format", "csv", "Desired format (json,yaml,csv)")
flag.StringVar(&envStr, "env", "baremetal", "Cluster environment (baremetal/aws)")
flag.StringVar(&envStr, "env", "baremetal", "Cluster environment (baremetal/cloud)")
flag.StringVar(&deploymentStr, "deployment", "mno", "Deployment type (mno/sno)")
flag.StringVar(&customEntriesPath, "customEntriesPath", "", "Add custom entries from a JSON file to the matrix")

Expand All @@ -58,8 +58,8 @@ func main() {
switch envStr {
case "baremetal":
env = commatrix.Baremetal
case "aws":
env = commatrix.AWS
case "cloud":
env = commatrix.Cloud
default:
panic(fmt.Sprintf("invalid cluster environment: %s", envStr))
}
Expand Down
8 changes: 4 additions & 4 deletions commatrix/commatrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Env int

const (
Baremetal Env = iota
AWS
Cloud
)

type Deployment int
Expand Down Expand Up @@ -104,12 +104,12 @@ func getStaticEntries(e Env, d Deployment) ([]types.ComDetails, error) {
break
}
comDetails = append(comDetails, baremetalStaticEntriesWorker...)
case AWS:
comDetails = append(comDetails, awsCloudStaticEntriesMaster...)
case Cloud:
comDetails = append(comDetails, cloudStaticEntriesMaster...)
if d == SNO {
break
}
comDetails = append(comDetails, awsCloudStaticEntriesWorker...)
comDetails = append(comDetails, cloudStaticEntriesWorker...)
default:
return nil, fmt.Errorf("invalid value for cluster environment")
}
Expand Down
139 changes: 86 additions & 53 deletions commatrix/static-custom-entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,35 @@ package commatrix
import "github.com/openshift-kni/commatrix/types"

var generalStaticEntriesWorker = []types.ComDetails{
{
Direction: "ingress",
Protocol: "TCP",
Port: "8080",
NodeRole: "worker",
Service: "network-check-target",
Namespace: "openshift-network-diagnostics",
Pod: "network-check-target",
Container: "network-check-target-container",
Optional: false,
},
{
Direction: "ingress",
Protocol: "TCP",
Port: "22",
NodeRole: "worker",
Service: "sshd",
Namespace: "",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: true,
},
{
Direction: "ingress",
Protocol: "TCP",
Port: "67",
NodeRole: "worker",
Service: "DHCP",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: true,
Expand All @@ -29,7 +51,7 @@ var generalStaticEntriesWorker = []types.ComDetails{
Port: "10250",
NodeRole: "worker",
Service: "kubelet",
Namespace: "",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: false,
Expand All @@ -49,7 +71,7 @@ var generalStaticEntriesWorker = []types.ComDetails{
Port: "111",
NodeRole: "worker",
Service: "rpcbind",
Namespace: "",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: true,
Expand All @@ -59,7 +81,7 @@ var generalStaticEntriesWorker = []types.ComDetails{
Port: "111",
NodeRole: "worker",
Service: "rpcbind",
Namespace: "",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: true,
Expand All @@ -69,7 +91,7 @@ var generalStaticEntriesWorker = []types.ComDetails{
Port: "10256",
NodeRole: "worker",
Service: "ovnkube",
Namespace: "openshift-sdn",
Namespace: "openshift-ovn-kubernetes",
Pod: "ovnkube",
Container: "ovnkube-controller",
Optional: true,
Expand All @@ -79,14 +101,25 @@ var generalStaticEntriesWorker = []types.ComDetails{
Port: "9537",
NodeRole: "worker",
Service: "crio-metrics",
Namespace: "",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: false,
},
}

var generalStaticEntriesMaster = []types.ComDetails{
{
Direction: "ingress",
Protocol: "TCP",
Port: "8080",
NodeRole: "master",
Service: "network-check-target",
Namespace: "openshift-network-diagnostics",
Pod: "network-check-target",
Container: "network-check-target-container",
Optional: false,
},
{
Direction: "ingress",
Protocol: "TCP",
Expand All @@ -102,10 +135,10 @@ var generalStaticEntriesMaster = []types.ComDetails{
Protocol: "TCP",
Port: "10256",
NodeRole: "master",
Service: "openshift-sdn",
Namespace: "",
Pod: "",
Container: "",
Service: "ovnkube",
Namespace: "openshift-ovn-kubernetes",
Pod: "ovnkube",
Container: "ovnkube-controller",
Optional: false,
}, {
Direction: "ingress",
Expand All @@ -123,7 +156,7 @@ var generalStaticEntriesMaster = []types.ComDetails{
Port: "10250",
NodeRole: "master",
Service: "kubelet",
Namespace: "",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: false,
Expand All @@ -143,7 +176,7 @@ var generalStaticEntriesMaster = []types.ComDetails{
Port: "111",
NodeRole: "master",
Service: "rpcbind",
Namespace: "",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: true,
Expand All @@ -153,7 +186,7 @@ var generalStaticEntriesMaster = []types.ComDetails{
Port: "111",
NodeRole: "master",
Service: "rpcbind",
Namespace: "",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: true,
Expand All @@ -163,7 +196,18 @@ var generalStaticEntriesMaster = []types.ComDetails{
Port: "22",
NodeRole: "master",
Service: "sshd",
Namespace: "",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: true,
},
{
Direction: "ingress",
Protocol: "TCP",
Port: "67",
NodeRole: "master",
Service: "DHCP",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: true,
Expand Down Expand Up @@ -263,7 +307,7 @@ var generalStaticEntriesMaster = []types.ComDetails{
Port: "6080",
NodeRole: "master",
Service: "",
Namespace: "openshift-kube-apiserver-readyz",
Namespace: "openshift-kube-apiserver",
Pod: "kube-apiserver",
Container: "kube-apiserver-insecure-readyz",
Optional: false,
Expand Down Expand Up @@ -420,88 +464,77 @@ var baremetalStaticEntriesMaster = []types.ComDetails{
Protocol: "TCP",
Port: "9447",
NodeRole: "master",
Service: "baremetal-operator-webhook-baremetal provisioning",
Namespace: "",
Service: "crio",
Namespace: "<RHCOS System>",
Pod: "",
Container: "",
Optional: false,
},
}

var awsCloudStaticEntriesWorker = []types.ComDetails{
var cloudStaticEntriesWorker = []types.ComDetails{
{
Direction: "ingress",
Protocol: "TCP",
Port: "10304",
NodeRole: "worker",
Service: "csi-node-driver",
Namespace: "",
Pod: "",
Container: "",
Service: "csi-node-driver-registrar",
Namespace: "openshift-cluster-csi-drivers",
Pod: "csi-driver-node",
Container: "csi-node-driver-registrar",
Optional: false,
}, {
Direction: "ingress",
Protocol: "TCP",
Port: "10300",
NodeRole: "worker",
Service: "csi-livenessprobe",
Namespace: "",
Pod: "",
Container: "",
Namespace: "openshift-cluster-csi-drivers",
Pod: "csi-driver-node",
Container: "csi-driver",
Optional: false,
},
}

var awsCloudStaticEntriesMaster = []types.ComDetails{
var cloudStaticEntriesMaster = []types.ComDetails{
{
Direction: "ingress",
Protocol: "TCP",
Port: "8080",
NodeRole: "master",
Service: "cluster-network",
Namespace: "",
Pod: "",
Container: "",
Optional: false,
}, {
Direction: "ingress",
Protocol: "TCP",
Port: "10260",
NodeRole: "master",
Service: "aws-cloud-controller",
Namespace: "",
Pod: "",
Container: "",
Service: "cloud-controller",
Namespace: "openshift-cloud-controller-manager-operator",
Pod: "cloud-controller-manager",
Container: "cloud-controller-manager",
Optional: false,
}, {
Direction: "ingress",
Protocol: "TCP",
Port: "10258",
NodeRole: "master",
Service: "aws-cloud-controller",
Namespace: "",
Pod: "",
Container: "",
Service: "cloud-controller",
Namespace: "openshift-cloud-controller-manager-operator",
Pod: "cloud-controller-manager",
Container: "cloud-controller-manager",
Optional: false,
}, {
Direction: "ingress",
Protocol: "TCP",
Port: "10304",
NodeRole: "master",
Service: "csi-node-driver",
Namespace: "",
Pod: "",
Container: "",
Optional: false,
Service: "csi-node-driver-registrar",
Namespace: "openshift-cluster-csi-drivers",
Pod: "csi-driver-node",
Container: "csi-node-driver-registrar",
}, {
Direction: "ingress",
Protocol: "TCP",
Port: "10300",
NodeRole: "master",
Service: "csi-livenessprobe",
Namespace: "",
Pod: "",
Container: "",
Service: "csi-drivers-livenessprobe",
Namespace: "openshift-cluster-csi-drivers",
Pod: "csi-driver-node",
Container: "csi-driver",
Optional: false,
},
}
Expand Down

0 comments on commit 3e554b1

Please sign in to comment.