types

package
v0.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatJSON = "json"
	FormatYAML = "yaml"
	FormatCSV  = "csv"
	FormatNFT  = "nft"
)

Variables

View Source
var BaremetalStaticEntriesMaster = []ComDetails{
	{
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      53,
		NodeGroup: "master",
		Service:   "dns-default",
		Namespace: "openshift-dns",
		Pod:       "dnf-default",
		Container: "dns",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "UDP",
		Port:      53,
		NodeGroup: "master",
		Service:   "dns-default",
		Namespace: "openshift-dns",
		Pod:       "dnf-default",
		Container: "dns",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      9444,
		NodeGroup: "master",
		Service:   "",
		Namespace: "openshift-kni-infra",
		Pod:       "haproxy",
		Container: "haproxy",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      9445,
		NodeGroup: "master",
		Service:   "",
		Namespace: "openshift-kni-infra",
		Pod:       "haproxy",
		Container: "haproxy",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      9454,
		NodeGroup: "master",
		Service:   "",
		Namespace: "openshift-kni-infra",
		Pod:       "haproxy",
		Container: "haproxy",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      18080,
		NodeGroup: "master",
		Service:   "",
		Namespace: "openshift-kni-infra",
		Pod:       "coredns",
		Container: "coredns",
		Optional:  false,
	},
}
View Source
var BaremetalStaticEntriesWorker = []ComDetails{
	{
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      53,
		NodeGroup: "worker",
		Service:   "dns-default",
		Namespace: "openshift-dns",
		Pod:       "dnf-default",
		Container: "dns",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "UDP",
		Port:      53,
		NodeGroup: "worker",
		Service:   "dns-default",
		Namespace: "openshift-dns",
		Pod:       "dnf-default",
		Container: "dns",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      18080,
		NodeGroup: "worker",
		Service:   "",
		Namespace: "openshift-kni-infra",
		Pod:       "coredns",
		Container: "coredns",
		Optional:  false,
	},
}
View Source
var GeneralIPv6StaticEntriesMaster = []ComDetails{
	{
		Direction: "Ingress",
		Protocol:  "UDP",
		Port:      546,
		NodeGroup: "master",
		Service:   "NetworkManager",
		Namespace: "",
		Pod:       "",
		Container: "",
		Optional:  false,
	},
}
View Source
var GeneralIPv6StaticEntriesWorker = []ComDetails{
	{
		Direction: "Ingress",
		Protocol:  "UDP",
		Port:      546,
		NodeGroup: "worker",
		Service:   "NetworkManager",
		Namespace: "",
		Pod:       "",
		Container: "",
		Optional:  false,
	},
}

General IPv6-only static entries that should be applied when the cluster supports IPv6.

View Source
var GeneralStaticEntriesMaster = []ComDetails{
	{
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      8080,
		NodeGroup: "master",
		Service:   "",
		Namespace: "openshift-network-operator",
		Pod:       "network-operator",
		Container: "network-operator",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      10256,
		NodeGroup: "master",
		Service:   "ovnkube",
		Namespace: "openshift-ovn-kubernetes",
		Pod:       "ovnkube",
		Container: "ovnkube-controller",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      10250,
		NodeGroup: "master",
		Service:   "kubelet",
		Namespace: "Host system service",
		Pod:       "",
		Container: "",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      9107,
		NodeGroup: "master",
		Service:   "egressip-node-healthcheck",
		Namespace: "openshift-ovn-kubernetes",
		Pod:       "ovnkube-node",
		Container: "ovnkube-controller",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      111,
		NodeGroup: "master",
		Service:   "rpcbind",
		Namespace: "Host system service",
		Pod:       "",
		Container: "",
		Optional:  true,
	}, {
		Direction: "Ingress",
		Protocol:  "UDP",
		Port:      111,
		NodeGroup: "master",
		Service:   "rpcbind",
		Namespace: "Host system service",
		Pod:       "",
		Container: "",
		Optional:  true,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      22,
		NodeGroup: "master",
		Service:   "sshd",
		Namespace: "Host system service",
		Pod:       "",
		Container: "",
		Optional:  true,
	},
}
View Source
var GeneralStaticEntriesWorker = []ComDetails{
	{
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      22,
		NodeGroup: "worker",
		Service:   "sshd",
		Namespace: "Host system service",
		Pod:       "",
		Container: "",
		Optional:  true,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      10250,
		NodeGroup: "worker",
		Service:   "kubelet",
		Namespace: "Host system service",
		Pod:       "",
		Container: "",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      9107,
		NodeGroup: "worker",
		Service:   "egressip-node-healthcheck",
		Namespace: "openshift-ovn-kubernetes",
		Pod:       "ovnkube-node",
		Container: "ovnkube-controller",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      111,
		NodeGroup: "worker",
		Service:   "rpcbind",
		Namespace: "Host system service",
		Pod:       "",
		Container: "",
		Optional:  true,
	}, {
		Direction: "Ingress",
		Protocol:  "UDP",
		Port:      111,
		NodeGroup: "worker",
		Service:   "rpcbind",
		Namespace: "Host system service",
		Pod:       "",
		Container: "",
		Optional:  true,
	}, {
		Direction: "Ingress",
		Protocol:  "TCP",
		Port:      10256,
		NodeGroup: "worker",
		Service:   "ovnkube",
		Namespace: "openshift-ovn-kubernetes",
		Pod:       "ovnkube",
		Container: "ovnkube-controller",
		Optional:  false,
	},
}
View Source
var KubeletNodePortDefaultDynamicRange = []DynamicRange{
	{
		Direction:   "Ingress",
		Protocol:    "TCP",
		MinPort:     30000,
		MaxPort:     32767,
		Description: "Kubelet node ports",
		Optional:    false,
	},
	{
		Direction:   "Ingress",
		Protocol:    "UDP",
		MinPort:     30000,
		MaxPort:     32767,
		Description: "Kubelet node ports",
		Optional:    false,
	},
}
View Source
var LinuxDynamicPrivateDefaultDynamicRange = []DynamicRange{
	{
		Direction:   "Ingress",
		Protocol:    "TCP",
		MinPort:     32768,
		MaxPort:     60999,
		Description: "Linux dynamic/private ports",
		Optional:    true,
	},
	{
		Direction:   "Ingress",
		Protocol:    "UDP",
		MinPort:     32768,
		MaxPort:     60999,
		Description: "Linux dynamic/private ports",
		Optional:    true,
	},
}
View Source
var StandardStaticEntries = []ComDetails{
	{
		Direction: "Ingress",
		Protocol:  "UDP",
		Port:      6081,
		NodeGroup: "worker",
		Service:   "ovn-kubernetes geneve",
		Namespace: "openshift-ovn-kubernetes",
		Pod:       "",
		Container: "",
		Optional:  false,
	}, {
		Direction: "Ingress",
		Protocol:  "UDP",
		Port:      6081,
		NodeGroup: "master",
		Service:   "ovn-kubernetes geneve",
		Namespace: "openshift-ovn-kubernetes",
		Pod:       "",
		Container: "",
		Optional:  false,
	},
}

Functions

func BuildNodeToGroupMap added in v0.0.5

func BuildNodeToGroupMap(c rtclient.Client) (map[string]string, error)

BuildNodeToGroupMap builds a node->group map for clusters without MCP: - Prefer HyperShift NodePool label when present. - Otherwise fall back to Kubernetes node role derived from labels.

func GetComMatrixHeadersByFormat

func GetComMatrixHeadersByFormat(format string) (string, error)

func GetNodeRole

func GetNodeRole(node *corev1.Node) (string, error)

func IsSupportedTopology added in v0.0.5

func IsSupportedTopology(topology configv1.TopologyMode) bool

IsSupportedTopology returns true if the given topology is supported by commatrix.

func ParsePortRangeHyphen added in v0.0.5

func ParsePortRangeHyphen(s string) (int, int, error)

parsePortRangeHyphen parses strings like "MIN-MAX" (hyphen-separated) into numeric bounds.

func ParsePortRangeSpace added in v0.0.5

func ParsePortRangeSpace(s string) (int, int, error)

parsePortRangeSpace parses strings like "MIN MAX" (space-separated) into numeric bounds.

func SupportedTopologiesList added in v0.0.5

func SupportedTopologiesList() []configv1.TopologyMode

SupportedTopologiesList returns the list of supported topologies.

Types

type ComDetails

type ComDetails struct {
	Direction string `json:"direction" yaml:"direction" csv:"Direction"`
	Protocol  string `json:"protocol" yaml:"protocol" csv:"Protocol"`
	Port      int    `json:"port" yaml:"port" csv:"Port"`
	Namespace string `json:"namespace" yaml:"namespace" csv:"Namespace"`
	Service   string `json:"service" yaml:"service" csv:"Service"`
	Pod       string `json:"pod" yaml:"pod" csv:"Pod"`
	Container string `json:"container" yaml:"container" csv:"Container"`
	NodeGroup string `json:"nodeGroup" yaml:"nodeGroup" csv:"NodeGroup"`
	Optional  bool   `json:"optional" yaml:"optional" csv:"Optional"`
}

func (ComDetails) Equals

func (cd ComDetails) Equals(other ComDetails) bool

func (ComDetails) String

func (cd ComDetails) String() string

type ComMatrix

type ComMatrix struct {
	Ports         []ComDetails
	DynamicRanges []DynamicRange
}

func ParseToComMatrix added in v0.0.5

func ParseToComMatrix(content []byte, format string) (*ComMatrix, error)

ParseToComMatrix parses input content in one of the supported formats (json, yaml, csv) and returns a ComMatrix that includes both ComDetails (Ports) and DynamicRanges.

func (*ComMatrix) Contains

func (m *ComMatrix) Contains(cd ComDetails) bool

func (*ComMatrix) SeparateMatrixByGroup added in v0.0.5

func (m *ComMatrix) SeparateMatrixByGroup() map[string]ComMatrix

SeparateMatrixByGroup groups matrix entries by their group name (stored in NodeGroup).

func (*ComMatrix) SortAndRemoveDuplicates

func (m *ComMatrix) SortAndRemoveDuplicates()

SortAndRemoveDuplicates removes duplicates in the matrix and sort it.

func (*ComMatrix) String

func (m *ComMatrix) String() string

func (*ComMatrix) ToCSV

func (m *ComMatrix) ToCSV() ([]byte, error)

func (*ComMatrix) ToJSON

func (m *ComMatrix) ToJSON() ([]byte, error)

func (*ComMatrix) ToNFTables

func (m *ComMatrix) ToNFTables() ([]byte, error)

func (*ComMatrix) ToYAML

func (m *ComMatrix) ToYAML() ([]byte, error)

func (*ComMatrix) WriteMatrixToFileByType

func (m *ComMatrix) WriteMatrixToFileByType(utilsHelpers utils.UtilsInterface, fileNamePrefix, format string, destDir string) error

type ContainerInfo

type ContainerInfo struct {
	Containers []struct {
		Labels struct {
			ContainerName string `json:"io.kubernetes.container.name"`
			PodName       string `json:"io.kubernetes.pod.name"`
			PodNamespace  string `json:"io.kubernetes.pod.namespace"`
		} `json:"labels"`
	} `json:"containers"`
}

type DynamicRange added in v0.0.5

type DynamicRange struct {
	Direction   string `json:"direction" yaml:"direction" csv:"Direction"`
	Protocol    string `json:"protocol" yaml:"protocol" csv:"Protocol"`
	MinPort     int    `json:"minPort" yaml:"minPort" csv:"MinPort"`
	MaxPort     int    `json:"maxPort" yaml:"maxPort" csv:"MaxPort"`
	Description string `json:"description" yaml:"description" csv:"Description"`
	Optional    bool   `json:"optional" yaml:"optional" csv:"Optional"`
}

func (*DynamicRange) PortRangeString added in v0.0.5

func (dr *DynamicRange) PortRangeString() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL