Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Trivy as Vulnerability plugin #228

Merged
merged 105 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
f745556
remove kubeconfig flags from plugins cmd
matheusfm Jul 21, 2023
6979f03
add default-container annotation on plugin pods
matheusfm Jul 21, 2023
4e2651e
set KUBECONFIG env only if the Cluster has kubeconfigKeyRef
matheusfm Jul 21, 2023
621c812
add view permissions to zora-plugins ClusterRole
matheusfm Jul 21, 2023
ba7fb30
remove kubeconfigRef from Cluster sample
matheusfm Jul 21, 2023
37227d5
feat: add agent mode flag in helm chart
matheusfm Jul 24, 2023
c1c5701
fix: operator should have the same permissions as the plugins
matheusfm Jul 24, 2023
18a1c1c
update plugins role
matheusfm Aug 3, 2023
4af04d6
set runAsNonRoot in container level
matheusfm Aug 3, 2023
7359ab8
create vulnerabilityreport crd
matheusfm Aug 8, 2023
35e45af
create namespace on `make install`
matheusfm Aug 8, 2023
521b513
create trivy plugin sample
matheusfm Aug 8, 2023
981cad8
Merge branch 'main' into feat/trivy-plugin
matheusfm Aug 10, 2023
b8940fe
chore: update trivy plugin
matheusfm Aug 11, 2023
6afbb68
chore: apply trivy plugin on make install
matheusfm Aug 11, 2023
ffc13d0
feat: set security context on worker container
matheusfm Aug 11, 2023
5c8ffa5
feat: set security context on init container
matheusfm Aug 11, 2023
1888bde
feat: do not set security context pod level
matheusfm Aug 11, 2023
f22510b
feat: update plugins role
matheusfm Aug 11, 2023
1017ac2
feat: set allowPrivilegeEscalation to false in plugins security context
matheusfm Aug 11, 2023
c05f3a7
feat: add type field in Plugin
matheusfm Aug 11, 2023
7b888af
chore: set PLUGIN_TYPE to worker env
matheusfm Aug 11, 2023
1891485
chore: set type field on plugin manifests
matheusfm Aug 11, 2023
51b46c5
chore: handle misc plugins
matheusfm Aug 11, 2023
145d014
feat: implement trivy parse function
matheusfm Aug 18, 2023
1329d18
chore: handle vulnerabilities in worker
matheusfm Aug 18, 2023
04fa665
chore: generate clientset for VulnerabilityReport
matheusfm Aug 18, 2023
980d678
chore: add license header
matheusfm Aug 18, 2023
ef5dcee
chore: update operator role
matheusfm Aug 18, 2023
8cbf4ae
chore: update plugins role
matheusfm Aug 18, 2023
1246ac7
feat: creating vulnerability reports in worker
matheusfm Aug 18, 2023
9dbc59a
chore: update test error messages
matheusfm Aug 18, 2023
2e7be1d
chore: testing parseVulnResults function
matheusfm Aug 18, 2023
8ac3109
chore: add totalResources, summary, type and score in Vulnerability t…
matheusfm Aug 19, 2023
cd85576
test: add sha256 test case
matheusfm Aug 19, 2023
2606663
ci: set go-version-file in setup-go@v4
matheusfm Aug 19, 2023
2ab75ea
feat: add vuln reports column markers
matheusfm Aug 19, 2023
a4ceac5
chore: remove non-alphanumeric from vuln reports name
matheusfm Aug 19, 2023
30bf280
chore: log trivy report errors as info
matheusfm Aug 19, 2023
a2bded8
feat: update clusterscans and customchecks short names
matheusfm Aug 19, 2023
031acb1
feat: update clusterissues short names
matheusfm Aug 19, 2023
b45f419
chore: bump curl image
matheusfm Aug 21, 2023
618639f
chore: always apply plugins
matheusfm Aug 21, 2023
d1d2be9
ci: update helm chart repository
matheusfm Aug 22, 2023
064d6fe
chore: add --no-progress flag in trivy plugin
matheusfm Aug 22, 2023
cb935ca
chore: update logs
matheusfm Aug 22, 2023
28facd7
docs: add slack badge on README.md
matheusfm Aug 30, 2023
aab9c26
chore: delete unused file
matheusfm Aug 31, 2023
4872f2a
chore: add trivy plugin in helm chart
matheusfm Aug 31, 2023
7f5c8dd
chore: update imagePullSecret template name in helm chart
matheusfm Aug 31, 2023
fa7c1a8
feat: apply scans for both misc and vuln in helm chart
matheusfm Aug 31, 2023
ddf0fcb
chore: rename clusterscan template file in helm chart
matheusfm Aug 31, 2023
8975c15
zora v0.7.0-rc3
matheusfm Aug 31, 2023
2993029
Merge branch 'main' into feat/trivy-plugin
matheusfm Sep 1, 2023
bfd55a4
chore: using "misconfig" to abbreviate "misconfigurations", instead o…
matheusfm Sep 1, 2023
706bbe0
chore: remove suspend and schedule fields from plugin reference in cl…
matheusfm Sep 1, 2023
4329d87
chore: rename `issueCount` to `totalIssues` in clusterscan status;
matheusfm Sep 4, 2023
1f6889a
docs: update description of successfulScansHistoryLimit and failedSca…
matheusfm Sep 4, 2023
e7ee82e
chore: add successfulScansHistoryLimit and failedScansHistoryLimit fi…
matheusfm Sep 4, 2023
a1153a5
chore: update NOTES.txt
matheusfm Sep 4, 2023
503c622
chore: remove default trivy resources in helm chart
matheusfm Sep 4, 2023
ef24f84
chore: bump zora chart 0.7.0-rc4
matheusfm Sep 5, 2023
b9fc063
chore: update chart NOTES.txt
matheusfm Sep 21, 2023
8ee8285
chore: create a chart pre-delete hook to delete the default cluster
matheusfm Sep 21, 2023
f3ff40d
chore: set label zora.undistro.io/default to "true" in default cluste…
matheusfm Sep 21, 2023
a300eb1
feat: add description field in Vulnerability
matheusfm Sep 21, 2023
37a694c
feat: delete hook image as helm parameter
matheusfm Sep 21, 2023
f44769a
bump trivy 0.45.1
matheusfm Sep 21, 2023
fe99bb3
bump gh actions
matheusfm Sep 21, 2023
4cdf3c1
pre release v0.7.0-rc5
matheusfm Sep 21, 2023
ae3f317
chg: set plugin env variables in worker container
matheusfm Sep 26, 2023
e96eb15
feat: add ignoreUnfixed and ignoreDescriptions parameters in helm chart
matheusfm Sep 26, 2023
02bd611
chore: add kind targets in Makefile
matheusfm Sep 26, 2023
7b5016a
bump zora chart to v0.7.0-rc6
matheusfm Sep 26, 2023
c105db7
fix clusterscan saas hook
matheusfm Oct 5, 2023
919f3db
docs: update docs
matheusfm Oct 25, 2023
4fe0bed
docs: add pages for plugins
matheusfm Oct 25, 2023
8ead3ec
docs: update chart description
matheusfm Oct 26, 2023
3cf2876
docs: update chart readme
matheusfm Oct 26, 2023
290cf67
docs: update README.md
matheusfm Oct 26, 2023
320fb3c
docs: update bold in plugins page
matheusfm Oct 26, 2023
27ef95c
chg: update clusterscan samples
matheusfm Oct 26, 2023
349fcf8
zora 0.7.0-rc7
matheusfm Oct 26, 2023
f0dc1a9
docs: add a button to zora dashboard
matheusfm Oct 26, 2023
e6aeb8a
docs: update helm chart readme
matheusfm Oct 26, 2023
a0cbe48
docs: fix helm chart page link
matheusfm Oct 26, 2023
cbd127c
docs: add resources page
matheusfm Oct 26, 2023
770a022
docs: update resources page title
matheusfm Oct 26, 2023
0a78faf
docs: add suspending scan page
matheusfm Oct 26, 2023
5f4c6f5
docs: add faq page
matheusfm Oct 27, 2023
53bfe6a
docs: update faq
matheusfm Oct 27, 2023
caa3812
docs: update logo
matheusfm Oct 27, 2023
ae836c4
docs: add retain issues page
matheusfm Oct 27, 2023
7bff921
docs: add admonition note in suspend scan page
matheusfm Oct 27, 2023
15cbd15
docs: update key features sorting
matheusfm Oct 27, 2023
7243da8
docs: update trivy.md page
matheusfm Oct 27, 2023
98983a3
docs: add "ignore unfixed vulnerability" in sidebar
matheusfm Oct 27, 2023
ea20dcf
docs: update switch theme icon
matheusfm Oct 27, 2023
b6b6378
docs: center try zora dashboard button
matheusfm Oct 27, 2023
8e00edf
docs: add note about vulnerability reports in Zora Dashboard
matheusfm Oct 27, 2023
b982721
docs: fix version links
matheusfm Oct 27, 2023
9f19e8b
docs: add OCI registry support with helm
matheusfm Oct 29, 2023
1a1a461
docs: add oss vs dashboard session in index.md
matheusfm Oct 29, 2023
294daee
docs: add note about zora dashboard arch in overview page
matheusfm Oct 30, 2023
c574b9a
release zora 0.7.0
matheusfm Oct 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,34 @@ jobs:
image: worker
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: setup qemu
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: setup docker buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: login
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: metadata
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.image }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr,prefix=pr-
type=sha,prefix=,format=long

- name: create dockerfile.cross
run: |
sed -e '1 s/\(^FROM\)/FROM --platform=\$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$\{BUILDPLATFORM\}/' ${{ matrix.dockerfile }} > ${{ matrix.dockerfile }}.cross
cat ${{ matrix.dockerfile }}.cross

- name: build and push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
file: ${{ matrix.dockerfile }}.cross
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: '~1.20'
go-version-file: 'go.mod'
cache: true

- name: install mkdocs and mike
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
needs: [docker]
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -36,11 +36,11 @@ jobs:
- name: setup go
uses: actions/setup-go@v4
with:
go-version: '~1.20'
go-version-file: 'go.mod'
cache: true

- name: release
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
Expand All @@ -53,14 +53,14 @@ jobs:
needs: [goreleaser]
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: main

- name: checkout charts
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: undistro/charts.undistro.io
repository: undistro/helm-charts
ref: main
fetch-depth: 1
token: ${{ secrets.BOT_TOKEN }} # GITHUB_TOKEN is scoped to the current repository, so we need a PAT to checkout a different repository and commit on it.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: '~1.20'
go-version-file: 'go.mod'
cache: true

- name: test
Expand Down
42 changes: 35 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Image URL to use all building/pushing image targets
IMG ?= controller:latest
WORKER_IMG ?= worker:latest

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.27.1

Expand Down Expand Up @@ -33,7 +35,7 @@ all: build

.PHONY: help
help: ## Display this help.
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Development

Expand Down Expand Up @@ -101,12 +103,16 @@ docker-build: test ## Build docker image with the manager.

.PHONY: docker-build-worker
docker-build-worker: test ## Build docker image with worker.
docker build -t worker:latest -f cmd/worker/Dockerfile .
docker build -t ${WORKER_IMG} -f cmd/worker/Dockerfile .

.PHONY: docker-push
docker-push: ## Push docker image with the manager.
docker push ${IMG}

.PHONY: docker-push-worker
docker-push-worker: ## Push docker image with worker.
docker push ${WORKER_IMG}

# PLATFORMS defines the target platforms for the manager image be build to provide support to multiple
# architectures. (i.e. make docker-buildx IMG=myregistry/myoperator:0.0.1). To use this option you need to:
# - able to use docker buildx . More info: https://docs.docker.com/build/buildx/
Expand All @@ -130,12 +136,15 @@ ifndef ignore-not-found
ignore-not-found = false
endif

NAMESPACE ?= zora-system
.PHONY: install
install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | $(KUBECTL) apply -f -
@$(KUBECTL) apply -f config/samples/zora_v1alpha1_plugin_popeye_all.yaml
@$(KUBECTL) apply -f config/samples/zora_v1alpha1_plugin_marvin.yaml
@$(KUBECTL) apply -f config/samples/zora_v1alpha1_customcheck_labels.yaml
@$(KUBECTL) create namespace $(NAMESPACE) || true
@$(KUBECTL) apply -f config/samples/zora_v1alpha1_plugin_popeye_all.yaml -n $(NAMESPACE)
@$(KUBECTL) apply -f config/samples/zora_v1alpha1_plugin_marvin.yaml -n $(NAMESPACE)
@$(KUBECTL) apply -f config/samples/zora_v1alpha1_plugin_trivy.yaml -n $(NAMESPACE)
@$(KUBECTL) apply -f config/samples/zora_v1alpha1_customcheck_labels.yaml -n $(NAMESPACE)
@$(KUBECTL) apply -f config/rbac/zora_plugins_role.yaml
@$(KUBECTL) create -f config/rbac/zora_plugins_role_binding.yaml || true

Expand All @@ -156,6 +165,18 @@ template: manifests kustomize ## Build kustomize configurations.
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/default | $(KUBECTL) delete --ignore-not-found=$(ignore-not-found) -f -

##@ Kind

CLUSTER_NAME ?= kind
.PHONY: kind-create-cluster
kind-create-cluster: kind ## Create a local Kubernetes cluster with Kind
$(KIND) create cluster --name $(CLUSTER_NAME)

.PHONY: kind-load-images
kind-load-images: kind docker-build docker-build-worker ## Build and load docker images into Kind nodes
$(KIND) load docker-image ${IMG}
$(KIND) load docker-image ${WORKER_IMG}

##@ Build Dependencies

## Location to install dependencies to
Expand All @@ -170,10 +191,13 @@ CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
ADDLICENSE ?= $(LOCALBIN)/addlicense
HELM_DOCS ?= $(LOCALBIN)/helm-docs
KIND ?= $(LOCALBIN)/kind

## Tool Versions
KUSTOMIZE_VERSION ?= v5.0.0
CONTROLLER_TOOLS_VERSION ?= v0.11.3
HELM_DOCS_VERSION ?= v1.11.2
KIND_VERSION ?= v0.20.0

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand Down Expand Up @@ -202,7 +226,11 @@ $(ADDLICENSE): $(LOCALBIN)
test -s $(LOCALBIN)/addlicense || GOBIN=$(LOCALBIN) go install github.com/google/addlicense@latest

.PHONY: helm-docs
helm-docs: $(HELM_DOCS) ## Download helm-docs if necessary
helm-docs: $(HELM_DOCS) ## Download helm-docs locally if necessary
$(HELM_DOCS): $(LOCALBIN)
test -s $(LOCALBIN)/helm-docs || GOBIN=$(LOCALBIN) go install github.com/norwoodj/helm-docs/cmd/helm-docs@v1.8.1
test -s $(LOCALBIN)/helm-docs || GOBIN=$(LOCALBIN) go install github.com/norwoodj/helm-docs/cmd/helm-docs@$(HELM_DOCS_VERSION)

.PHONY: kind
kind: $(KIND) ## Download kind locally if necessary
$(KIND): $(LOCALBIN)
test -s $(LOCALBIN)/kind || GOBIN=$(LOCALBIN) go install sigs.k8s.io/kind@$(KIND_VERSION)
8 changes: 8 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,12 @@ resources:
kind: CustomCheck
path: github.com/undistro/zora/api/zora/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: undistro.io
group: zora
kind: VulnerabilityReport
path: github.com/undistro/zora/api/zora/v1alpha1
version: v1alpha1
version: "3"
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,30 @@
[![license](https://img.shields.io/github/license/undistro/zora)](https://github.com/undistro/zora/blob/main/LICENSE)
![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/undistro/zora?display_name=tag&sort=semver&color=blue)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fundistro%2Fzora.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fundistro%2Fzora?ref=badge_shield)
[![slack](https://img.shields.io/badge/Slack-Join-4a154b?logo=slack)](https://join.slack.com/t/undistrocommunity/shared_invite/zt-21slyrao4-dTW_XtOB90QVj05txOX6rA)

</div>

## Introduction

Zora is a multi-cluster scan that helps you identify potential issues and vulnerabilities
in your Kubernetes clusters in a centralized way, ensuring that the recommended best practices are in place.
Zora is an open-source solution that helps you achieve compliance with Kubernetes best practices recommended by
industry-leading frameworks.

Zora is the first product created by Undistro's initiative. Visit our [website](https://undistro.io) for more information about the project and sign up for our newsletter to stay up to date with Zora's new features and Undistro's new initiatives.
By scanning your cluster with multiple plugins at scheduled times, Zora identifies potential issues, misconfigurations,
and vulnerabilities.

_Please [star :star:](https://github.com/undistro/zora/stargazers) the repo if you want us to continue developing and improving Zora!_ :grin:

## Getting Started

Check out our live [documentation](https://zora-docs.undistro.io) for details about how to install Zora and start to scan your clusters.

## Contributing

We are in alpha stage and we'd love it if you contributed to Zora. For information on contributing to this project, please see our [guideline](https://github.com/undistro/zora/blob/main/CONTRIBUTING.md).
Please refer to the [contributing guide](https://github.com/undistro/zora/blob/main/CONTRIBUTING.md) and the
[code of conduct](https://github.com/undistro/zora/blob/main/CODE_OF_CONDUCT.md)
for more information on how to contribute.

## License

Zora is a Undistro product, backed by [Getup.io](https://getup.io) under the [Apache License 2.0](LICENSE).
Zora is released under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details.
2 changes: 1 addition & 1 deletion api/zora/v1alpha1/clusterissue_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type ClusterIssueStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:shortName="ci"
//+kubebuilder:resource:shortName={issue,issues,misconfig,misconfigs,misconfigurations}
//+kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".spec.cluster",priority=0
//+kubebuilder:printcolumn:name="ID",type="string",JSONPath=".spec.id",priority=0
//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".spec.message",priority=0
Expand Down
32 changes: 8 additions & 24 deletions api/zora/v1alpha1/clusterscan_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,14 @@ type ClusterScanSpec struct {
// The list of Plugin references that are used to scan the referenced Cluster. Defaults to 'popeye'
Plugins []PluginReference `json:"plugins,omitempty"`

// SuccessfulScansHistoryLimit specifies the amount of successfully
// completed scan Jobs to be kept in the cluster. This field is analogous
// to <Cronjob.Spec.SuccessfulJobsHistoryLimit> from the <batch> package.
// The number of successful finished scans and their issues to retain. Value must be non-negative integer.
// Defaults to 3.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=3
SuccessfulScansHistoryLimit *int32 `json:"successfulScansHistoryLimit,omitempty"`

// FailedScansHistoryLimit specifies the amount of failed scan Jobs to be
// kept in the cluster. This field is analogous to
// <Cronjob.Spec.FailedScansHistoryLimit> from the <batch> package.
// The number of failed finished scans to retain. Value must be non-negative integer.
// Defaults to 1.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:default=1
FailedScansHistoryLimit *int32 `json:"failedScansHistoryLimit,omitempty"`
Expand All @@ -61,13 +59,6 @@ type PluginReference struct {
// Namespace defines the space within which the Plugin name must be unique.
Namespace string `json:"namespace,omitempty"`

// This flag tells the controller to suspend subsequent executions, it does
// not apply to already started executions. Defaults to false.
Suspend *bool `json:"suspend,omitempty"`

// The schedule in Cron format for this Plugin, see https://en.wikipedia.org/wiki/Cron.
Schedule string `json:"schedule,omitempty"`

// List of environment variables to set in the Plugin container.
Env []corev1.EnvVar `json:"env,omitempty"`
}
Expand Down Expand Up @@ -221,30 +212,23 @@ type PluginScanStatus struct {
// LastErrorMsg contains a plugin error message from the last failed scan.
LastErrorMsg string `json:"lastErrorMsg,omitempty"`

// IssueCount holds the sum of ClusterIssues found in the last successful scan.
IssueCount *int `json:"issueCount,omitempty"`

// Suspend field value from ClusterScan spec.plugins.*.suspend
Suspend bool `json:"suspend,omitempty"`

// The Cron schedule of this plugin
Schedule string `json:"schedule,omitempty"`
// TotalIssues holds the sum of ClusterIssues found in the last successful scan.
TotalIssues *int `json:"totalIssues,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:shortName="cscan"
//+kubebuilder:resource:shortName={scan,scans}
//+kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".spec.clusterRef.name",priority=0
//+kubebuilder:printcolumn:name="Schedule",type="string",JSONPath=".spec.schedule",priority=0
//+kubebuilder:printcolumn:name="Suspend",type="boolean",JSONPath=".status.suspend",priority=0
//+kubebuilder:printcolumn:name="Plugins",type="string",JSONPath=".status.pluginNames",priority=0
//+kubebuilder:printcolumn:name="Last Status",type="string",JSONPath=".status.lastStatus",priority=0
//+kubebuilder:printcolumn:name="Last Schedule",type="date",JSONPath=".status.lastScheduleTime",priority=0
//+kubebuilder:printcolumn:name="Last Successful",type="date",JSONPath=".status.lastSuccessfulTime",priority=0
//+kubebuilder:printcolumn:name="Issues",type="integer",JSONPath=".status.totalIssues",priority=0
//+kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",priority=0
//+kubebuilder:printcolumn:name="SaaS",type="string",JSONPath=".status.conditions[?(@.type==\"SaaS\")].reason",priority=0
//+kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",priority=0
//+kubebuilder:printcolumn:name="SaaS",type="string",JSONPath=".status.conditions[?(@.type==\"SaaS\")].reason",priority=1
//+kubebuilder:printcolumn:name="Next Schedule",type="string",JSONPath=".status.nextScheduleTime",priority=1

// ClusterScan is the Schema for the clusterscans API
Expand Down
2 changes: 1 addition & 1 deletion api/zora/v1alpha1/clusterscan_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func TestSyncStatus(t *testing.T) {
css.Plugins = tt.plugins
css.SyncStatus()
if !reflect.DeepEqual(css, tt.want) {
t.Errorf("SyncStatus() = %s", cmp.Diff(css, tt.want))
t.Errorf("SyncStatus() mismatch (-want +got):\n%s", cmp.Diff(tt.want, css))
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion api/zora/v1alpha1/customcheck_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type CustomCheckStatus struct {

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:shortName="checks"
//+kubebuilder:resource:shortName={check,checks}
//+kubebuilder:printcolumn:name="Message",type="string",JSONPath=".spec.message",priority=0
//+kubebuilder:printcolumn:name="Severity",type="string",JSONPath=".spec.severity",priority=0
//+kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type==\"Ready\")].status",priority=0
Expand Down
Loading