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

test(scorecard): scorecard tests for recording management (backport #698) #752

Merged
merged 2 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
26 changes: 21 additions & 5 deletions .github/workflows/test-ci-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,29 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Kind cluster
uses: helm/[email protected]
with:
config: .github/kind-config.yaml
cluster_name: ci-${{ github.run_id }}
wait: 1m
ignore_failed_clean: true
- name: Set up Ingress Controller
run: |
kind create cluster --config=".github/kind-config.yaml" -n ci-${{ github.run_id }}
# Enabling Ingress
# Install nginx ingress controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
kubectl rollout status -w deployment/ingress-nginx-controller -n ingress-nginx --timeout 5m
kubectl rollout status -w \
deployment/ingress-nginx-controller \
-n ingress-nginx --timeout 5m

# Lower the number of worker processes
kubectl patch cm/ingress-nginx-controller \
--type merge \
-p '{"data":{"worker-processes":"1"}}' \
-n ingress-nginx

# Modify /etc/hosts to resolve hostnames
ip_address=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ci-${{ github.run_id }}-control-plane)
echo "$ip_address testing.cryostat" | sudo tee -a /etc/hosts
- name: Install Operator Lifecycle Manager
run: curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.24.0/install.sh | bash -s v0.24.0
- name: Install Cert Manager
Expand All @@ -140,8 +158,6 @@ jobs:
SCORECARD_REGISTRY_PASSWORD="${{ secrets.GITHUB_TOKEN }}" \
BUNDLE_IMG="${{ steps.push-bundle-to-ghcr.outputs.registry-path }}" \
make test-scorecard
- name: Clean up Kind cluster
run: kind delete cluster -n ci-${{ github.run_id }}
- name: Set latest commit status as ${{ job.status }}
uses: myrotvorets/set-commit-status-action@master
if: always()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ metadata:
capabilities: Seamless Upgrades
categories: Monitoring, Developer Tools
containerImage: quay.io/cryostat/cryostat-operator:2.5.0-dev
createdAt: "2024-02-15T20:45:48Z"
createdAt: "2024-03-06T21:13:39Z"
description: JVM monitoring and profiling tool
operatorframework.io/initialization-resource: |-
{
Expand Down Expand Up @@ -182,6 +182,12 @@ spec:
path: jmxCredentialsDatabaseOptions.databaseSecretName
x-descriptors:
- urn:alm:descriptor:io.kubernetes:Secret
- description: The maximum number of WebSocket client connections allowed (minimum
1, default unlimited).
displayName: Max WebSocket Connections
path: maxWsConnections
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:number
- description: Options to control how the operator exposes the application outside
of the cluster, such as using an Ingress or Route.
displayName: Network Options
Expand Down
6 changes: 6 additions & 0 deletions bundle/manifests/operator.cryostat.io_cryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ spec:
credentials database.
type: string
type: object
maxWsConnections:
description: The maximum number of WebSocket client connections allowed
(minimum 1, default unlimited).
format: int32
minimum: 1
type: integer
minimal:
description: Deploy a pared-down Cryostat instance with no Grafana
Dashboard or JFR Data Source.
Expand Down
15 changes: 13 additions & 2 deletions bundle/tests/scorecard/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ stages:
storage:
spec:
mountPath: {}
- tests:
- entrypoint:
- cryostat-scorecard-tests
- operator-install
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20231011144522
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416
labels:
suite: cryostat
test: operator-install
Expand All @@ -79,13 +80,23 @@ stages:
- entrypoint:
- cryostat-scorecard-tests
- cryostat-cr
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20231011144522
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416
labels:
suite: cryostat
test: cryostat-cr
storage:
spec:
mountPath: {}
- entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416
labels:
suite: cryostat
test: cryostat-recording
storage:
spec:
mountPath: {}
storage:
spec:
mountPath: {}
6 changes: 6 additions & 0 deletions config/crd/bases/operator.cryostat.io_cryostats.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ spec:
credentials database.
type: string
type: object
maxWsConnections:
description: The maximum number of WebSocket client connections allowed
(minimum 1, default unlimited).
format: int32
minimum: 1
type: integer
minimal:
description: Deploy a pared-down Cryostat instance with no Grafana
Dashboard or JFR Data Source.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ spec:
path: jmxCredentialsDatabaseOptions.databaseSecretName
x-descriptors:
- urn:alm:descriptor:io.kubernetes:Secret
- description: The maximum number of WebSocket client connections allowed (minimum
1, default unlimited).
displayName: Max WebSocket Connections
path: maxWsConnections
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:number
- description: Options to control how the operator exposes the application outside
of the cluster, such as using an Ingress or Route.
displayName: Network Options
Expand Down
1 change: 0 additions & 1 deletion config/rbac/oauth_client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: oauth-client
rules:
- apiGroups:
Expand Down
4 changes: 3 additions & 1 deletion config/scorecard/bases/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ kind: Configuration
metadata:
name: config
stages:
- parallel: true
- parallel: true # Build-in Tests
tests: []
- parallel: false # Cryostat Custom Tests
tests: []
18 changes: 14 additions & 4 deletions config/scorecard/patches/custom.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,32 @@
path: /serviceaccount
value: cryostat-scorecard
- op: add
path: /stages/0/tests/-
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- operator-install
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20231011144522"
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416"
labels:
suite: cryostat
test: operator-install
- op: add
path: /stages/0/tests/-
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-cr
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20231011144522"
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416"
labels:
suite: cryostat
test: cryostat-cr
- op: add
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: "quay.io/cryostat/cryostat-operator-scorecard:2.5.0-20240305020416"
labels:
suite: cryostat
test: cryostat-recording
14 changes: 12 additions & 2 deletions hack/custom.config.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
path: /serviceaccount
value: cryostat-scorecard
- op: add
path: /stages/0/tests/-
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
Expand All @@ -12,7 +12,7 @@
suite: cryostat
test: operator-install
- op: add
path: /stages/0/tests/-
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
Expand All @@ -21,3 +21,13 @@
labels:
suite: cryostat
test: cryostat-cr
- op: add
path: /stages/1/tests/-
value:
entrypoint:
- cryostat-scorecard-tests
- cryostat-recording
image: "${CUSTOM_SCORECARD_IMG}"
labels:
suite: cryostat
test: cryostat-recording
4 changes: 4 additions & 0 deletions internal/images/custom-scorecard-tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func printValidTests() []scapiv1alpha3.TestResult {
str := fmt.Sprintf("valid tests for this image include: %s", strings.Join([]string{
tests.OperatorInstallTestName,
tests.CryostatCRTestName,
tests.CryostatRecordingTestName,
}, ","))
result.Errors = append(result.Errors, str)

Expand All @@ -90,6 +91,7 @@ func validateTests(testNames []string) bool {
switch testName {
case tests.OperatorInstallTestName:
case tests.CryostatCRTestName:
case tests.CryostatRecordingTestName:
default:
return false
}
Expand All @@ -108,6 +110,8 @@ func runTests(testNames []string, bundle *apimanifests.Bundle, namespace string,
results = append(results, tests.OperatorInstallTest(bundle, namespace))
case tests.CryostatCRTestName:
results = append(results, tests.CryostatCRTest(bundle, namespace, openShiftCertManager))
case tests.CryostatRecordingTestName:
results = append(results, tests.CryostatRecordingTest(bundle, namespace, openShiftCertManager))
default:
log.Fatalf("unknown test found: %s", testName)
}
Expand Down
49 changes: 49 additions & 0 deletions internal/images/custom-scorecard-tests/rbac/scorecard_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,55 @@ rules:
- cryostats/status
verbs:
- get
- apiGroups:
- ""
resources:
- secrets
verbs:
- get
# Permissions for default OAuth configurations
- apiGroups:
- operator.cryostat.io
resources:
- cryostats
verbs:
- create
- patch
- delete
- get
- apiGroups:
- ""
resources:
- pods
- pods/exec
- services
verbs:
- create
- patch
- delete
- get
- apiGroups:
- ""
resources:
- replicationcontrollers
- endpoints
verbs:
- get
- apiGroups:
- apps
resources:
- deployments
verbs:
- create
- get
- apiGroups:
- apps
resources:
- daemonsets
- replicasets
- statefulsets
verbs:
- get
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
Loading
Loading