diff --git a/config/configStruct.go b/config/configStruct.go index 5361b7a1f..5431fee6c 100644 --- a/config/configStruct.go +++ b/config/configStruct.go @@ -14,7 +14,21 @@ const ( ) func CreateDefaultConfig() ConfigStruct { - return ConfigStruct{} + return ConfigStruct{ + Tap: configStructs.TapConfig{ + NodeSelectorTerms: []v1.NodeSelectorTerm{ + { + MatchExpressions: []v1.NodeSelectorRequirement{ + { + Key: "kubernetes.io/os", + Operator: v1.NodeSelectorOpIn, + Values: []string{"linux"}, + }, + }, + }, + }, + }, + } } type KubeConfig struct { diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 5cb521b5b..c2cbd5501 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -1,38 +1,76 @@ +config: {} +dumplogs: false +headless: false +kube: + configpath: "" + context: "" +license: "" +logs: + file: "" +manifests: + dump: false +scripting: + env: null + source: "" + watchscripts: true tap: + annotations: {} + auth: + approveddomains: [] + approvedemails: [] + enabled: false + debug: false docker: + imagepullpolicy: Always + imagepullsecrets: null registry: docker.io/kubeshark tag: latest - imagepullpolicy: Always - imagepullsecrets: [] + dryrun: false + ignoretainted: false + ingress: + certmanager: letsencrypt-prod + classname: kubeshark-ingress-class + controller: k8s.io/ingress-nginx + enabled: false + host: ks.svc.cluster.local + tls: null + ipv6: true + kmm: + enabled: true + labels: {} + namespaces: [] + nodeselectorterms: + - matchExpressions: + - key: kubernetes.io/os + operator: In + values: + - linux + packetcapture: libpcap + pcap: "" + persistentstorage: false proxy: - worker: - srvport: 8897 - hub: - port: 8898 - srvport: 8898 front: port: 8899 host: 127.0.0.1 + hub: + port: 8898 + srvport: 8898 + worker: + srvport: 8897 regex: .* - namespaces: [] release: - repo: https://helm.kubeshark.co name: kubeshark namespace: default - persistentstorage: false - storagelimit: 200Mi - storageclass: standard - dryrun: false - pcap: "" + repo: https://helm.kubeshark.co resources: - worker: + hub: limits: cpu: 750m memory: 1Gi requests: cpu: 50m memory: 50Mi - hub: + worker: limits: cpu: 750m memory: 1Gi @@ -40,36 +78,6 @@ tap: cpu: 50m memory: 50Mi servicemesh: true + storageclass: standard + storagelimit: 200Mi tls: true - packetcapture: libpcap - ignoretainted: false - labels: {} - annotations: {} - nodeselectorterms: [] - auth: - enabled: false - approvedemails: [] - approveddomains: [] - ingress: - enabled: false - classname: kubeshark-ingress-class - controller: k8s.io/ingress-nginx - host: ks.svc.cluster.local - tls: [] - certmanager: letsencrypt-prod - kmm: - enabled: true - ipv6: true - debug: false -logs: - file: "" -kube: - configpath: "" - context: "" -dumplogs: false -headless: false -license: "" -scripting: - env: {} - source: "" - watchscripts: true diff --git a/utils/pretty.go b/utils/pretty.go index 7237a57de..949a5d03d 100644 --- a/utils/pretty.go +++ b/utils/pretty.go @@ -2,6 +2,7 @@ package utils import ( "bytes" + "encoding/json" "gopkg.in/yaml.v3" ) @@ -11,14 +12,27 @@ const ( tab = "\t" ) -func PrettyYaml(data interface{}) (string, error) { +func PrettyYaml(data interface{}) (result string, err error) { + var marshalled []byte + marshalled, err = json.Marshal(data) + if err != nil { + return + } + + var unmarshalled interface{} + err = json.Unmarshal(marshalled, &unmarshalled) + if err != nil { + return + } + buffer := new(bytes.Buffer) encoder := yaml.NewEncoder(buffer) encoder.SetIndent(2) - err := encoder.Encode(data) + err = encoder.Encode(unmarshalled) if err != nil { - return empty, err + return } - return buffer.String(), nil + result = buffer.String() + return }