Skip to content

Commit

Permalink
Add support for the compliance history API
Browse files Browse the repository at this point in the history
When the governance-policy-database Secret is defined, an OpenShift
Route (only on OpenShift) is created to expose the compliance events
history API on the hub.

Additionally, if the user sets the complianceHistoryAPIURL custom
variable, it will set the --compliance-api-url on the
governance-policy-framework container.

This updates the Kind minimum version to match OpenShift 4.12. This
helps the OpenShift Route CRD apply correctly.

Relates:
https://issues.redhat.com/browse/ACM-6870

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
  • Loading branch information
mprahl committed Feb 15, 2024
1 parent 3699932 commit f1ea80d
Show file tree
Hide file tree
Showing 15 changed files with 424 additions and 82 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ $(KIND_KUBECONFIG):
kind get kubeconfig --name $(KIND_NAME) > $(KIND_KUBECONFIG)
kind get kubeconfig --name $(KIND_NAME) --internal > $(KIND_KUBECONFIG_INTERNAL)
KUBECONFIG=$(KIND_KUBECONFIG) kubectl apply -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/v0.64.1/example/prometheus-operator-crd-full/monitoring.coreos.com_servicemonitors.yaml
KUBECONFIG=$(KIND_KUBECONFIG) kubectl create -f https://raw.githubusercontent.com/openshift/api/release-4.12/route/v1/route.crd.yaml

.PHONY: kind-delete-cluster
kind-delete-cluster: ## Delete a kind cluster.
Expand Down
2 changes: 1 addition & 1 deletion build/common/Makefile.common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ KIND_VERSION ?= latest
# Set the Kind version tag
ifdef KIND_VERSION
ifeq ($(KIND_VERSION), minimum)
KIND_ARGS = --image kindest/node:v1.19.16
KIND_ARGS = --image kindest/node:v1.25.16
else ifneq ($(KIND_VERSION), latest)
KIND_ARGS = --image kindest/node:$(KIND_VERSION)
endif
Expand Down
10 changes: 2 additions & 8 deletions build/manage-clusters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ if [[ -n "${MANAGED_CLUSTER_COUNT//[0-9]}" ]] || [[ "${MANAGED_CLUSTER_COUNT}" =
exit 1
fi

HUB_KIND_VERSION=$KIND_VERSION
if [[ "${KIND_VERSION}" == "minimum" ]]; then
# The hub supports fewer Kubernetes versions than the managed cluster.
HUB_KIND_VERSION=v1.23.13
fi

KIND_PREFIX=${KIND_PREFIX:-"policy-addon-ctrl"}
CLUSTER_PREFIX=${CLUSTER_PREFIX:-"cluster"}

Expand All @@ -36,10 +30,10 @@ case ${RUN_MODE} in
make e2e-debug
;;
create)
KIND_VERSION="${HUB_KIND_VERSION}" make kind-deploy-controller
make kind-deploy-controller
;;
create-dev)
KIND_VERSION="${HUB_KIND_VERSION}" make kind-prep-ocm
make kind-prep-ocm
;;
deploy-addons)
make kind-deploy-addons
Expand Down
27 changes: 27 additions & 0 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ rules:
- signers
verbs:
- approve
- apiGroups:
- cluster.open-cluster-management.io
resourceNames:
- id.k8s.io
resources:
- clusterclaims
verbs:
- get
- apiGroups:
- cluster.open-cluster-management.io
resources:
Expand Down Expand Up @@ -150,6 +158,7 @@ rules:
- apiGroups:
- ""
resourceNames:
- governance-policy-database
- policy-encryption-key
resources:
- secrets
Expand Down Expand Up @@ -219,6 +228,24 @@ rules:
- get
- patch
- update
- apiGroups:
- route.openshift.io
resources:
- routes
verbs:
- create
- apiGroups:
- route.openshift.io
resourceNames:
- governance-history-api
resources:
- routes
verbs:
- delete
- get
- list
- update
- watch
- apiGroups:
- work.open-cluster-management.io
resources:
Expand Down
33 changes: 18 additions & 15 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ require (
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.64.1
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stolostron/kubernetes-dependency-watches v0.5.2
k8s.io/apimachinery v0.29.0
k8s.io/client-go v0.29.0
k8s.io/component-base v0.29.0
k8s.io/klog/v2 v2.110.1
open-cluster-management.io/addon-framework v0.8.1-0.20240123051722-71f1b13cbb63
open-cluster-management.io/api v0.12.1-0.20240122084346-e7bd1bd9ea6a
sigs.k8s.io/controller-runtime v0.16.2
Expand All @@ -35,16 +37,16 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand All @@ -54,17 +56,17 @@ require (
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/pprof v0.0.0-20231023181126-ff6d637d2a7b // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/imdario/mergo v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
Expand All @@ -74,10 +76,10 @@ require (
github.com/openshift/client-go v0.0.0-20231218140158-47f6d749b9d9 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pkg/profile v1.3.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/spf13/cast v1.4.1 // indirect
Expand All @@ -102,15 +104,15 @@ require (
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.0 // indirect
golang.org/x/tools v0.14.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230726155614-23370e0ffb3e // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect
Expand All @@ -124,7 +126,7 @@ require (
k8s.io/api v0.29.0 // indirect
k8s.io/apiextensions-apiserver v0.29.0 // indirect
k8s.io/apiserver v0.29.0 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/klog v1.0.0 // indirect
k8s.io/kms v0.29.0 // indirect
k8s.io/kube-aggregator v0.29.0 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
Expand All @@ -138,6 +140,7 @@ require (
)

replace (
github.com/imdario/mergo => github.com/imdario/mergo v0.3.16 // Replaced so that 'go get -u' works. Remove/bump when upgrading.
golang.org/x/net => golang.org/x/net v0.17.0 // CVE-2023-39325
golang.org/x/text => golang.org/x/text v0.13.0 // CVE-2022-32149
)
Loading

0 comments on commit f1ea80d

Please sign in to comment.