Skip to content

Adding License Testing for Tiered Storage #233

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

Merged
merged 5 commits into from
Dec 3, 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
15 changes: 13 additions & 2 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ steps:
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- REDPANDA_LICENSE
- AWS_DEFAULT_REGION
- label: aws ubuntu tiered large
key: aws-up-ubuntu-ts-large
Expand All @@ -49,6 +50,7 @@ steps:
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- REDPANDA_LICENSE
- AWS_DEFAULT_REGION
- label: aws fedora
key: aws-up-fedora
Expand All @@ -68,7 +70,7 @@ steps:
- AWS_DEFAULT_REGION
- label: aws fedora connect
key: aws-up-fed-con
concurrency_group: aws-fd
concurrency_group: aws-fd-cn
concurrency: 1
command: make ci-aws-rp-connect -e DEPLOYMENT_ID=ci-cn-fd-`tr -dc a-z0-9 </dev/urandom | head -c 4` -e DISTRO=Fedora-Cloud-Base-39 --keep-going
plugins:
Expand Down Expand Up @@ -98,10 +100,11 @@ steps:
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- REDPANDA_LICENSE
- AWS_DEFAULT_REGION
- label: aws fedora tiered connect
key: aws-up-fed-cts
concurrency_group: aws-fd
concurrency_group: aws-fd-cn
concurrency: 1
command: make ci-aws-rp-ts-connect -e DEPLOYMENT_ID=ci-ct-fd-`tr -dc a-z0-9 </dev/urandom | head -c 4` -e DISTRO=Fedora-Cloud-Base-39 --keep-going
plugins:
Expand All @@ -115,6 +118,7 @@ steps:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- AWS_DEFAULT_REGION
- REDPANDA_LICENSE
- CONNECT_RPM_TOKEN
- label: aws fedora tiered large
key: aws-up-fedora-ts-large
Expand All @@ -131,6 +135,7 @@ steps:
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- REDPANDA_LICENSE
- AWS_DEFAULT_REGION
- label: gcp ubuntu basic
key: gcp-up-ubuntu
Expand Down Expand Up @@ -161,6 +166,7 @@ steps:
pre-exit: make destroy-gcp
environment:
- GCP_CREDS
- REDPANDA_LICENSE
- label: gcp fedora basic
key: gcp-up-fedora
concurrency_group: gcp-fd
Expand Down Expand Up @@ -189,6 +195,7 @@ steps:
image: glrp/atgt:latest
environment:
- GCP_CREDS
- REDPANDA_LICENSE
- label: unstable aws fedora tiered
key: aws-us-fedora-tiered
concurrency_group: unstable
Expand All @@ -204,6 +211,7 @@ steps:
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- REDPANDA_LICENSE
- AWS_DEFAULT_REGION
- label: unstable aws fedora tiered large
key: aws-us-fedora-ts-large
Expand All @@ -220,6 +228,7 @@ steps:
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- REDPANDA_LICENSE
- AWS_DEFAULT_REGION
- label: unstable aws ubuntu tiered
key: aws-us-ubuntu-tiered
Expand All @@ -236,6 +245,7 @@ steps:
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- REDPANDA_LICENSE
- AWS_DEFAULT_REGION
- label: unstable aws ubuntu tiered large
key: aws-us-ubuntu-ts-large
Expand All @@ -252,4 +262,5 @@ steps:
environment:
- AWS_ACCESS_KEY_ID
- AWS_SECRET_ACCESS_KEY
- REDPANDA_LICENSE
- AWS_DEFAULT_REGION
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ BUCKET_NAME := $(subst _,-,$(DEPLOYMENT_ID))-bucket
DISTRO ?= ubuntu-focal
IS_USING_UNSTABLE ?= false
CA_CRT ?= $(PWD)/ansible/tls/ca/ca.crt
REDPANDA_LICENSE ?= empty

# RPK
RPK_PATH ?= $(ARTIFACT_DIR)/bin/rpk
Expand Down Expand Up @@ -380,7 +381,7 @@ CLOUD_STORAGE_CREDENTIALS_SOURCE ?= "aws_instance_metadata"
.PHONY: cluster-tiered-storage
cluster-tiered-storage: ansible-prereqs
@mkdir -p $(ARTIFACT_DIR)/logs
ansible-playbook ansible/provision-cluster-tiered-storage.yml --private-key $(PRIVATE_KEY) --extra-vars is_using_unstable=$(IS_USING_UNSTABLE) --extra-vars segment_upload_interval=$(SEGMENT_UPLOAD_INTERVAL) --extra-vars cloud_storage_credentials_source=$(CLOUD_STORAGE_CREDENTIALS_SOURCE)
ansible-playbook ansible/provision-cluster-tiered-storage.yml --private-key $(PRIVATE_KEY) --extra-vars is_using_unstable=$(IS_USING_UNSTABLE) --extra-vars segment_upload_interval=$(SEGMENT_UPLOAD_INTERVAL) --extra-vars cloud_storage_credentials_source=$(CLOUD_STORAGE_CREDENTIALS_SOURCE) --extra-vars redpanda_license=$(REDPANDA_LICENSE)

GOOGLE_APPLICATION_CREDENTIALS ?= "/tmp/gcp_creds.json"
SIMPLE_BUCKET_NAME=$(shell echo $(BUCKET_NAME) | sed 's/-bucket$$//')
Expand Down
36 changes: 36 additions & 0 deletions ansible/operation-apply-license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
- name: Apply Redpanda License
hosts: redpanda
become: true
vars:
rpk_bin: rpk

tasks:
- name: Check cluster health
ansible.builtin.shell: |
{{ rpk_bin }} cluster health | grep -i 'healthy:' | tr -d '[:space:]' | awk -F ':' '{print tolower($2)}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to do something like this and check the return code of grep, rather than trying to parse out the true/false status.

rpk cluster health | grep -q -i 'healthy.*false'

returns 0 if one or more lines matched the regex. returns 1 if zero lines matched.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(though, it would be better if rpk cluster health set a return code of 0 or 1 depending on cluster health state, then we could check the return code directly -- don't think that support exists right now)

register: health_check
run_once: true
failed_when: "health_check.stdout != 'true'"
changed_when: false

- name: Set Redpanda license (string)
ansible.builtin.command: rpk cluster license set {{ redpanda_license }}
run_once: true
changed_when: false
when:
- redpanda_license is defined

- name: Set Redpanda license (path)
ansible.builtin.command: rpk cluster license set --path {{ redpanda_license_path }}
changed_when: false
run_once: true
when:
- redpanda_license_path is defined

- name: Check broker status
ansible.builtin.shell: |
{{ rpk_bin }} redpanda admin brokers list | grep -q 'active.*true'
register: broker_status
changed_when: false
failed_when: broker_status.rc != 0
Loading