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

feat(deploy): deploy cryostat 3.0 #727

Merged
merged 35 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
71a8999
feat(discovery): options to configure discovery port names and number…
mergify[bot] Feb 12, 2024
ff950e8
Deploy cryostat 3.0
Josh-Matsuoka Feb 13, 2024
7a518cc
Remove extraneous file
Josh-Matsuoka Feb 13, 2024
3dfd0bd
test adjustments
Josh-Matsuoka Feb 14, 2024
60de1b6
feat(discovery): options to configure discovery port names and number…
tthvo Feb 12, 2024
2be24b7
Fix typo in environment variable breaking reconciler test, fix missin…
Josh-Matsuoka Feb 26, 2024
1bdbc88
Fix conflict with cluster cryostat removal
Josh-Matsuoka Feb 26, 2024
6b2e997
ci(gh): add comment when /build_test is finished (#745)
mwangggg Feb 28, 2024
2af4362
add scorecard test/suite selection (#746)
mwangggg Feb 28, 2024
cfcbfc7
test(scorecard): scorecard tests for recording management (#698)
tthvo Mar 5, 2024
bf8df15
test(scorecard): scorecard test for Cryostat CR configuration changes…
mwangggg Mar 8, 2024
96ea4cb
test(scorecard): scorecard test for report generator (#753)
mwangggg Mar 15, 2024
2201704
fix(build-ci): fix scorecard image tag returned as null (#760)
tthvo Mar 15, 2024
d01e0d2
test(scorecard): add container logs to scorecard results (#758)
tthvo Mar 19, 2024
6498b0f
add permission to publish comment when ci fails (#769)
mwangggg Mar 19, 2024
73714b2
Update NewCoreContainer and associated tests
Josh-Matsuoka Mar 26, 2024
903e93f
build(go): update Golang to 1.21 (#777)
ebaron Mar 27, 2024
baebe17
test(scorecard): logWorkloadEvent for cryostat-recording errors (#759)
mwangggg Mar 27, 2024
b397095
test(scorecard): fix rebasing skipped commit (#780)
mwangggg Mar 27, 2024
ea9b99d
Merge remote-tracking branch 'upstream/main' into cryostat3
Josh-Matsuoka Mar 27, 2024
c349366
Review fixes
Josh-Matsuoka Mar 28, 2024
b1eff2b
generate storage key, create expected Secret
andrewazores Apr 11, 2024
59cbb9e
fixup! generate storage key, create expected Secret
andrewazores Apr 11, 2024
db8f6c6
database secret handling corrections
andrewazores Apr 11, 2024
abee942
combine database connection password and encryption key into one secret
andrewazores Apr 11, 2024
33d70e0
correct storage secret key/access key
andrewazores Apr 11, 2024
02b1d91
update datasource port number to not conflict with storage
andrewazores Apr 11, 2024
63a6d23
precreate eventtemplates bucket
andrewazores Apr 11, 2024
0687867
remove storage volume parameter overrides
andrewazores Apr 11, 2024
64ceb78
use HTTP for Cryostat probe even when TLS is enabled - TLS will be do…
andrewazores Apr 11, 2024
4c73c8e
correct environment variable names for proxy awareness
andrewazores Apr 11, 2024
d2830ed
Fixing merge conflicts, syncing with upstream
Josh-Matsuoka Apr 15, 2024
b24679f
Fix remaining merge conflict
Josh-Matsuoka Apr 15, 2024
2ccd83d
Fix makefile
Josh-Matsuoka Apr 16, 2024
7fd9443
config cleanup and test fixup
andrewazores Apr 18, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
- name: Get scorecard image tag
id: get-image-tag
run: |
SCORECARD_TAG=$(yq '[.stages[0].tests[].image | capture("cryostat-operator-scorecard:(?P<tag>[\w.\-_]+)$")][0].tag' bundle/tests/scorecard/config.yaml)
SCORECARD_TAG=$(yq '[.stages[1].tests[].image | capture("cryostat-operator-scorecard:(?P<tag>[\w.\-_]+)$")][0].tag' bundle/tests/scorecard/config.yaml)
echo "tag=$SCORECARD_TAG" >> $GITHUB_OUTPUT
- name: Check if scorecard image tag already exists
id: check-tag-exists
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/test-ci-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,42 @@ jobs:
ref: ${{ needs.checkout-branch.outputs.PR_head_ref }}
tag: ${{ needs.get-test-image-tag.outputs.tag }}
sha: ${{ needs.checkout-branch.outputs.PR_head_sha }}

successful-test:
runs-on: ubuntu-latest
needs: [run-test-jobs]
permissions:
pull-requests: write
steps:
- name: Leave Actions Run Comment
uses: actions/github-script@v6
with:
script: |
const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`;
const commentBody = `\`/build_test\` completed successfully ✅. \n[View Actions Run](${runURL}).`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});

cancelled-test:
if: (always() && contains(needs.*.result, 'failure'))
runs-on: ubuntu-latest
needs: [run-test-jobs]
permissions:
pull-requests: write
steps:
- name: Leave Actions Run Comment
uses: actions/github-script@v6
with:
script: |
const runURL = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${{ github.run_id }}`;
const commentBody = `\`/build_test\` : At least one test failed ❌. \n[View Actions Run](${runURL}).`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
});
28 changes: 22 additions & 6 deletions .github/workflows/test-ci-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
ref: ${{ inputs.ref }}
- uses: actions/setup-go@v4
with:
go-version: '1.20.*'
go-version: '1.21.*'
- name: Run controller tests
run: make test-envtest
- name: Set latest commit status as ${{ job.status }}
Expand Down Expand Up @@ -118,11 +118,29 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Kind cluster
uses: helm/kind-action@v1.8.0
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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM docker.io/library/golang:1.20 as builder
FROM docker.io/library/golang:1.21 as builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
26 changes: 21 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ OS = $(shell go env GOOS)
ARCH = $(shell go env GOARCH)

# Current Operator version
export OPERATOR_VERSION ?= 2.5.0-dev
export OPERATOR_VERSION ?= 3.0.0-dev
IMAGE_VERSION ?= $(OPERATOR_VERSION)
BUNDLE_VERSION ?= $(IMAGE_VERSION)
DEFAULT_NAMESPACE ?= quay.io/cryostat
Expand Down Expand Up @@ -62,7 +62,7 @@ export APP_NAME ?= Cryostat
# Images used by the operator
CORE_NAMESPACE ?= $(DEFAULT_NAMESPACE)
CORE_NAME ?= cryostat
CORE_VERSION ?= latest
CORE_VERSION ?= 3.0.0-snapshot
export CORE_IMG ?= $(CORE_NAMESPACE)/$(CORE_NAME):$(CORE_VERSION)
DATASOURCE_NAMESPACE ?= $(DEFAULT_NAMESPACE)
DATASOURCE_NAME ?= jfr-datasource
Expand All @@ -76,6 +76,14 @@ REPORTS_NAMESPACE ?= $(DEFAULT_NAMESPACE)
REPORTS_NAME ?= cryostat-reports
REPORTS_VERSION ?= latest
export REPORTS_IMG ?= $(REPORTS_NAMESPACE)/$(REPORTS_NAME):$(REPORTS_VERSION)
DATABASE_NAMESPACE ?= $(DEFAULT_NAMESPACE)
DATABASE_NAME ?= cryostat-db
DATABASE_VERSION ?= latest
export DATABASE_IMG ?= $(DATABASE_NAMESPACE)/$(DATABASE_NAME):$(DATABASE_VERSION)
STORAGE_NAMESPACE ?= $(DEFAULT_NAMESPACE)
STORAGE_NAME ?= cryostat-storage
STORAGE_VERSION ?= latest
export STORAGE_IMG ?= $(STORAGE_NAMESPACE)/$(STORAGE_NAME):$(STORAGE_VERSION)

CERT_MANAGER_VERSION ?= 1.11.5
CERT_MANAGER_MANIFEST ?= \
Expand Down Expand Up @@ -134,6 +142,14 @@ else
KUSTOMIZE_DIR ?= config/default
endif

# Specify which scorecard tests/suites to run
ifneq ($(SCORECARD_TEST_SELECTION),)
SCORECARD_TEST_SELECTOR := --selector='test in ($(SCORECARD_TEST_SELECTION))'
endif
ifneq ($(SCORECARD_TEST_SUITE),)
SCORECARD_TEST_SELECTOR := --selector=suite=$(SCORECARD_TEST_SUITE)
endif

##@ General

.PHONY: all
Expand All @@ -158,9 +174,9 @@ endif
test-scorecard: check_cert_manager kustomize operator-sdk ## Run scorecard tests.
ifneq ($(SKIP_TESTS), true)
$(call scorecard-setup)
$(call scorecard-cleanup); \
trap cleanup EXIT; \
$(OPERATOR_SDK) scorecard -n $(SCORECARD_NAMESPACE) -s cryostat-scorecard -w 20m $(BUNDLE_IMG) --pod-security=restricted
$(call scorecard-cleanup) ; \
trap cleanup EXIT ; \
$(OPERATOR_SDK) scorecard -n $(SCORECARD_NAMESPACE) -s cryostat-scorecard -w 20m $(BUNDLE_IMG) --pod-security=restricted $(SCORECARD_TEST_SELECTOR)
endif

.PHONY: clean-scorecard
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ kubectl get secret ${CRYOSTAT_NAME}-jmx-auth -o jsonpath='{$.data.CRYOSTAT_RJMX_

# Building
## Requirements
- `go` v1.20
- `go` v1.21
- [`operator-sdk`](https://github.com/operator-framework/operator-sdk) v1.31.0
- [`cert-manager`](https://github.com/cert-manager/cert-manager) v1.11.5+ (Recommended)
- `podman` or `docker`
Expand Down
20 changes: 20 additions & 0 deletions api/v1beta1/cryostat_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ type CryostatStatus struct {
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=status,order=2,xDescriptors={"urn:alm:descriptor:io.kubernetes:Secret"}
GrafanaSecret string `json:"grafanaSecret,omitempty"`
// Name of the Secret containing the cryostat storage connection key
StorageSecret string `json:"storageSecret,omitempty"`
// Address of the deployed Cryostat web application.
// +operator-sdk:csv:customresourcedefinitions:type=status,order=1,xDescriptors={"urn:alm:descriptor:org.w3:link"}
ApplicationURL string `json:"applicationUrl"`
Expand Down Expand Up @@ -287,6 +289,13 @@ type GrafanaServiceConfig struct {
ServiceConfig `json:",inline"`
}

type StorageServiceConfig struct {
// HTTP port number for the cryostat storage service.
// Defaults to 8333
HTTPPort *int32 `json:"httpPort,omitempty"`
ServiceConfig `json:",inline"`
}

// ReportsServiceConfig provides customization for the service handling
// traffic for the cryostat-reports sidecars.
type ReportsServiceConfig struct {
Expand All @@ -309,6 +318,9 @@ type ServiceConfigList struct {
// Specification for the service responsible for the cryostat-reports sidecars.
// +optional
ReportsConfig *ReportsServiceConfig `json:"reportsConfig,omitempty"`
// Specification for the service responsible for the cryostat storage container.
// +optional
StorageConfig *StorageServiceConfig `json:"storageConfig,omitEmpty"`
}

// NetworkConfiguration provides customization for how to expose a Cryostat
Expand Down Expand Up @@ -502,6 +514,14 @@ type SecurityOptions struct {
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
GrafanaSecurityContext *corev1.SecurityContext `json:"grafanaSecurityContext,omitempty"`
// Security Context to apply to the storage container.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
StorageSecurityContext *corev1.SecurityContext `json:"storageSecurityContext,omitempty"`
// Security Context to apply to the storage container.
Josh-Matsuoka marked this conversation as resolved.
Show resolved Hide resolved
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
DatabaseSecurityContext *corev1.SecurityContext `json:"databaseSecurityContext,omitempty"`
}

// ReportsSecurityOptions contains Security Context customizations for the
Expand Down
36 changes: 36 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions api/v1beta2/cryostat_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,14 @@ type SecurityOptions struct {
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
GrafanaSecurityContext *corev1.SecurityContext `json:"grafanaSecurityContext,omitempty"`
// Security Context to apply to the storage container.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
StorageSecurityContext *corev1.SecurityContext `json:"storageSecurityContext,omitempty"`
// Security Context to apply to the storage container.
Josh-Matsuoka marked this conversation as resolved.
Show resolved Hide resolved
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
DatabaseSecurityContext *corev1.SecurityContext `json:"databaseSecurityContext,omitempty"`
}

// ReportsSecurityOptions contains Security Context customizations for the
Expand Down
10 changes: 10 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bundle.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=cryostat-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.31.0
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.32.0
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3

Expand Down
Loading
Loading