Skip to content

Commit

Permalink
refactor ConfigName's of k8s flags
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyLewen committed Apr 24, 2024
1 parent 80d3a4f commit 15e6fca
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 35 deletions.
47 changes: 21 additions & 26 deletions docs/docs/references/configuration/config-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,19 +459,28 @@ kubernetes:
- workload
- infra

# Same as '--k8s-version'
# Default is empty
k8s-version: 1.21.0

# Same as '--tolerations'
# Default is empty
tolerations:
- key1=value1:NoExecute
- key2=value2:NoSchedule

# Same as '--qps'
# Default is 5.0
qps: 5.0
# Same as '--all-namespaces'
# Default is false
all-namespaces: false

# Same as '--burst'
# Default is 10
burst: 10
node-collector:
# Same as '--node-collector-namespace'
# Default is 'trivy-temp'
namespace: ~/.kube/config2

# Same as '--node-collector-imageref'
# Default is 'ghcr.io/aquasecurity/node-collector:0.0.9'
imageref: ghcr.io/aquasecurity/node-collector:0.0.9

exclude:
# Same as '--exclude-owned'
Expand All @@ -484,27 +493,13 @@ kubernetes:
- kubernetes.io/arch:arm64
- team:dev

# Same as '--all-namespaces'
# Default is false
all:
namespaces: false
# Same as '--qps'
# Default is 5.0
qps: 5.0

# Same as '--k8s-version'
# Default is empty
k8s:
version: 1.21.0

# Same as '--node-collector-imageref'
# Default is 'ghcr.io/aquasecurity/node-collector:0.0.9'
node:
collector:
imageref: ghcr.io/aquasecurity/node-collector:0.0.9

# Same as '--node-collector-namespace'
# Default is 'trivy-temp'
node:
collector:
namespace: ~/.kube/config2
# Same as '--burst'
# Default is 10
burst: 10
```
## Repository Options
Expand Down
18 changes: 9 additions & 9 deletions pkg/flag/kubernetes_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var (
}
K8sVersionFlag = Flag[string]{
Name: "k8s-version",
ConfigName: "kubernetes.k8s.version",
ConfigName: "kubernetes.k8s-version",
Usage: "specify k8s version to validate outdated api by it (example: 1.21.0)",
}
TolerationsFlag = Flag[[]string]{
Expand All @@ -54,16 +54,22 @@ var (
}
AllNamespaces = Flag[bool]{
Name: "all-namespaces",
ConfigName: "kubernetes.all.namespaces",
ConfigName: "kubernetes.all-namespaces",
Shorthand: "A",
Usage: "fetch resources from all cluster namespaces",
}
NodeCollectorNamespace = Flag[string]{
Name: "node-collector-namespace",
ConfigName: "node.collector.namespace",
ConfigName: "kubernetes.node-collector.namespace",
Default: "trivy-temp",
Usage: "specify the namespace in which the node-collector job should be deployed",
}
NodeCollectorImageRef = Flag[string]{
Name: "node-collector-imageref",
ConfigName: "kubernetes.node-collector.imageref",
Default: "ghcr.io/aquasecurity/node-collector:0.0.9",
Usage: "indicate the image reference for the node-collector scan job",
}
ExcludeOwned = Flag[bool]{
Name: "exclude-owned",
ConfigName: "kubernetes.exclude.owned",
Expand All @@ -74,12 +80,6 @@ var (
ConfigName: "kubernetes.exclude.nodes",
Usage: "indicate the node labels that the node-collector job should exclude from scanning (example: kubernetes.io/arch:arm64,team:dev)",
}
NodeCollectorImageRef = Flag[string]{
Name: "node-collector-imageref",
ConfigName: "kubernetes.node.collector.imageref",
Default: "ghcr.io/aquasecurity/node-collector:0.0.9",
Usage: "indicate the image reference for the node-collector scan job",
}
QPS = Flag[float64]{
Name: "qps",
ConfigName: "kubernetes.qps",
Expand Down

0 comments on commit 15e6fca

Please sign in to comment.