<commit_before>package rule

import (
	"io"
	"strings"
)

// DefaultRuleSet is the list of rules that are built into the inspector
const defaultRuleSet = `---
# Python 2.5+ is installed on all nodes
# This is required by ansible
- kind: Python2Version
  when: []
  supportedVersions:
   - Python 2.5
   - Python 2.6
   - Python 2.7

# Executables required by kubelet
- kind: ExecutableInPath
  when: ["master","worker"]
  executable: iptables
- kind: ExecutableInPath
  when: ["master","worker"]
  executable: iptables-save
- kind: ExecutableInPath
  when: ["master","worker"]
  executable: iptables-restore

# Ports used by etcd are available
- kind: TCPPortAvailable
  when: ["etcd"]
  port: 2379
- kind: TCPPortAvailable
  when: ["etcd"]
  port: 6666
- kind: TCPPortAvailable
  when: ["etcd"]
  port: 2380
- kind: TCPPortAvailable
  when: ["etcd"]
  port: 6660

# Ports used by etcd are accessible
- kind: TCPPortAccessible
  when: ["etcd"]
  port: 2379
  timeout: 5s
- kind: TCPPortAccessible
  when: ["etcd"]
  port: 6666
  timeout: 5s
- kind: TCPPortAccessible
  when: ["etcd"]
  port: 2380
  timeout: 5s
- kind: TCPPortAccessible
  when: ["etcd"]
  port: 6660
  timeout: 5s

# Ports used by K8s master are available
- kind: TCPPortAvailable
  when: ["master"]
  port: 6443
- kind: TCPPortAvailable
  when: ["master"]
  port: 8080

# Ports used by K8s master are accessible
# Port 8080 is not accessible from outside
- kind: TCPPortAccessible
  when: ["master"]
  port: 6443
  timeout: 5s

# Port used by Docker registry
- kind: TCPPortAvailable
  when: ["master"]
  port: 8443
- kind: TCPPortAccessible
  when: ["master"]
  port: 8443
  timeout: 5s

# Port used by Ingress
- kind: TCPPortAvailable
  when: ["ingress"]
  port: 80
- kind: TCPPortAccessible
  when: ["ingress"]
  port: 80
  timeout: 5s
- kind: TCPPortAvailable
  when: ["ingress"]
  port: 443
- kind: TCPPortAccessible
  when: ["ingress"]
  port: 443
  timeout: 5s

- kind: PackageAvailable
  when: ["etcd", "ubuntu"]
  packageName: kismatic-etcd
  packageVersion: 1.5.1-3
- kind: PackageAvailable
  when: ["master","ubuntu"]
  packageName: kismatic-kubernetes-master
  packageVersion: 1.5.1-3
- kind: PackageAvailable
  when: ["worker","ubuntu"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1-3
- kind: PackageAvailable
  when: ["ingress","ubuntu"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1-3

- kind: PackageAvailable
  when: ["etcd", "centos"]
  packageName: kismatic-etcd
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["master","centos"]
  packageName: kismatic-kubernetes-master
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["worker","centos"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["ingress","centos"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1

- kind: PackageAvailable
  when: ["etcd", "rhel"]
  packageName: kismatic-etcd
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["master","rhel"]
  packageName: kismatic-kubernetes-master
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["worker","rhel"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["ingress","rhel"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1

# Gluster packages
- kind: PackageAvailable
  when: ["storage", "centos"]
  packageName: glusterfs-server
  packageVersion: 3.8.7-1.el7
- kind: PackageAvailable
  when: ["storage", "rhel"]
  packageName: glusterfs-server
  packageVersion: 3.8.7-1.el7
- kind: PackageAvailable
  when: ["storage", "ubuntu"]
  packageName: glusterfs-server
  packageVersion: 3.8.7-ubuntu1~xenial1

# Ports required for NFS<commit_msg>Add worker pkg check for storage nodes<commit_after>package rule

import (
	"io"
	"strings"
)

// DefaultRuleSet is the list of rules that are built into the inspector
const defaultRuleSet = `---
# Python 2.5+ is installed on all nodes
# This is required by ansible
- kind: Python2Version
  when: []
  supportedVersions:
   - Python 2.5
   - Python 2.6
   - Python 2.7

# Executables required by kubelet
- kind: ExecutableInPath
  when: ["master","worker"]
  executable: iptables
- kind: ExecutableInPath
  when: ["master","worker"]
  executable: iptables-save
- kind: ExecutableInPath
  when: ["master","worker"]
  executable: iptables-restore

# Ports used by etcd are available
- kind: TCPPortAvailable
  when: ["etcd"]
  port: 2379
- kind: TCPPortAvailable
  when: ["etcd"]
  port: 6666
- kind: TCPPortAvailable
  when: ["etcd"]
  port: 2380
- kind: TCPPortAvailable
  when: ["etcd"]
  port: 6660

# Ports used by etcd are accessible
- kind: TCPPortAccessible
  when: ["etcd"]
  port: 2379
  timeout: 5s
- kind: TCPPortAccessible
  when: ["etcd"]
  port: 6666
  timeout: 5s
- kind: TCPPortAccessible
  when: ["etcd"]
  port: 2380
  timeout: 5s
- kind: TCPPortAccessible
  when: ["etcd"]
  port: 6660
  timeout: 5s

# Ports used by K8s master are available
- kind: TCPPortAvailable
  when: ["master"]
  port: 6443
- kind: TCPPortAvailable
  when: ["master"]
  port: 8080

# Ports used by K8s master are accessible
# Port 8080 is not accessible from outside
- kind: TCPPortAccessible
  when: ["master"]
  port: 6443
  timeout: 5s

# Port used by Docker registry
- kind: TCPPortAvailable
  when: ["master"]
  port: 8443
- kind: TCPPortAccessible
  when: ["master"]
  port: 8443
  timeout: 5s

# Port used by Ingress
- kind: TCPPortAvailable
  when: ["ingress"]
  port: 80
- kind: TCPPortAccessible
  when: ["ingress"]
  port: 80
  timeout: 5s
- kind: TCPPortAvailable
  when: ["ingress"]
  port: 443
- kind: TCPPortAccessible
  when: ["ingress"]
  port: 443
  timeout: 5s

- kind: PackageAvailable
  when: ["etcd", "ubuntu"]
  packageName: kismatic-etcd
  packageVersion: 1.5.1-3
- kind: PackageAvailable
  when: ["master","ubuntu"]
  packageName: kismatic-kubernetes-master
  packageVersion: 1.5.1-3
- kind: PackageAvailable
  when: ["worker","ubuntu"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1-3
- kind: PackageAvailable
  when: ["ingress","ubuntu"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1-3
- kind: PackageAvailable
  when: ["storage","ubuntu"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1-3

- kind: PackageAvailable
  when: ["etcd", "centos"]
  packageName: kismatic-etcd
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["master","centos"]
  packageName: kismatic-kubernetes-master
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["worker","centos"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["ingress","centos"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["storage","centos"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1

- kind: PackageAvailable
  when: ["etcd", "rhel"]
  packageName: kismatic-etcd
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["master","rhel"]
  packageName: kismatic-kubernetes-master
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["worker","rhel"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["ingress","rhel"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1
- kind: PackageAvailable
  when: ["storage","rhel"]
  packageName: kismatic-kubernetes-node
  packageVersion: 1.5.1_3-1

# Gluster packages
- kind: PackageAvailable
  when: ["storage", "centos"]
  packageName: glusterfs-server
  packageVersion: 3.8.7-1.el7
- kind: PackageAvailable
  when: ["storage", "rhel"]
  packageName: glusterfs-server
  packageVersion: 3.8.7-1.el7
- kind: PackageAvailable
  when: ["storage", "ubuntu"]
  packageName: glusterfs-server
  packageVersion: 3.8.7-ubuntu1~xenial1

# Ports required for NFS
{'fraction_non_alphanumeric': 0.12596336070751737, 'fraction_numerical': 0.04118761844598863, 'mean_word_length': 4.061381074168798, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '752778', 'n_tokens_mistral': 2985, 'n_tokens_neox': 2780, 'n_words': 739}