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

Pass boolean properties to Redpanda configuration #472

Merged
merged 2 commits into from
May 19, 2023
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
125 changes: 125 additions & 0 deletions .github/workflows/pull_requests_from_origin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Test using secrets

on:
pull_request:
branches:
- "**"
paths:
- .github/*.sh
- .github/ct.yaml
- .github/kind.yaml
- .github/workflows/pull_requests.yaml
- charts/**
- '!**/*.md'
jobs:
test:
if: ${{ github.event.pull_request.head.repo.full_name == 'redpanda-data/helm-charts' }}
name: Run ct tests for ci values matching ${{ matrix.testvaluespattern }} for Redpanda version ${{ matrix.version }}
strategy:
matrix:
version:
- ""
- v22.3.17
# - v22.2.x takes too long. Only run nightly.
testvaluespattern:
- '99*'
fail-fast: true
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.1

- name: Set up chart-testing
uses: joejulian/chart-testing-action@v2.3.1-1
with:
version: v3.7.1-2

# we're excluding console from testing until we have a way to test it with Redpanda
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }} --excluded-charts console )
echo $changed
if [[ -n "$changed" ]]; then
echo changed="true" >> "$GITHUB_OUTPUT"
fi

- name: Set up for matrix
if: steps.list-changed.outputs.changed == 'true'
run: |
echo bash -O extglob -c "rm -v charts/redpanda/ci/!(${{ matrix.testvaluespattern }})"
bash -O extglob -c "rm -v charts/redpanda/ci/!(${{ matrix.testvaluespattern }})"

- name: Create kind cluster
uses: helm/kind-action@v1.5.0
if: steps.list-changed.outputs.changed == 'true'
with:
config: .github/kind.yaml

- name: Check kind config worked
if: steps.list-changed.outputs.changed == 'true'
run: kubectl get nodes

- name: Annotate nodes for rack awareness
if: steps.list-changed.outputs.changed == 'true'
run: .github/annotate_kind_nodes.sh chart-testing

- name: Create redpanda license secret
if: steps.list-changed.outputs.changed == 'true'
env:
REDPANDA_LICENSE: ${{ secrets.REDPANDA_LICENSE }}
run: |
kubectl create secret generic redpanda-license \
--from-literal=license-key="$REDPANDA_LICENSE" \
--dry-run=client -o yaml > redpanda-license.yaml.tmp

kubectl annotate -f redpanda-license.yaml.tmp \
helm.sh/hook-delete-policy="before-hook-creation" \
helm.sh/hook="pre-install" \
helm.sh/hook-weight="-100" \
--local --dry-run=none -o yaml > redpanda-license.yaml

rm redpanda-license.yaml.tmp

mv redpanda-license.yaml ./charts/redpanda/templates/

- name: install cert-manager
if: steps.list-changed.outputs.changed == 'true'
run: |
helm repo add jetstack https://charts.jetstack.io &&
helm install cert-manager --namespace cert-manager \
--create-namespace --version v1.11.0 jetstack/cert-manager \
--set installCRDs=true --wait --wait-for-jobs

- name: Run chart-testing (install and upgrade)
if: steps.list-changed.outputs.changed == 'true'
run: |
ct install \
--upgrade \
--config .github/ct.yaml \
--helm-extra-set-args="--set=image.tag=${{ matrix.version }}" \
--skip-missing-values \
--excluded-charts console \
--target-branch ${{ github.event.repository.default_branch }}
2 changes: 1 addition & 1 deletion charts/redpanda/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type: application
# The chart version and the app version are not the same and will not track
# together. The chart version is a semver representation of changes to this
# chart.
version: 4.0.18
version: 4.0.19

# The app version is the default version of Redpanda to install.
appVersion: v23.1.8
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
license_secret_ref:
secret_name: redpanda-license
secret_key: license-key

storage:
tieredConfig:
cloud_storage_enabled: true
cloud_storage_secret_key: test
cloud_storage_access_key: test
cloud_storage_region: test
cloud_storage_bucket: test
storage_zero_value: 0
storage_null_value: null
storage_empty_array_value: []
storage_empty_map_value: {}
storage_empty_string_value: ""

config:
cluster:
enable_idempotence: false
cluster_zero_value: 0
cluster_null_value: null
cluster_empty_array_value: []
cluster_empty_map_value: {}
cluster_empty_string_value: ""
tunable:
tunable_zero_value: 0
tunable_null_value: null
tunable_empty_array_value: []
tunable_empty_map_value: {}
tunable_empty_string_value: ""
node:
node_zero_value: 0
node_null_value: null
node_empty_array_value: []
node_empty_map_value: {}
node_empty_string_value: ""
12 changes: 8 additions & 4 deletions charts/redpanda/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,14 @@ data:
port: {{ $values.listeners.rpc.port }}
{{- end }}
{{- if and (include "is-licensed" . | fromJson).bool .Values.storage.tieredConfig.cloud_storage_enabled }}
{{- if (include "redpanda-atleast-22-3-0" . | fromJson).bool }}
{{- toYaml .Values.storage.tieredConfig | nindent 6 }}
{{- else }}
{{- unset .Values.storage.tieredConfig "cloud_storage_credentials_source" | toYaml | nindent 6 }}
{{- $tieredStorageConfig := deepCopy .Values.storage.tieredConfig }}
{{- if not (include "redpanda-atleast-22-3-0" . | fromJson).bool }}
{{- $tieredStorageConfig = unset $tieredStorageConfig "cloud_storage_credentials_source"}}
{{- end }}
{{- range $key, $element := $tieredStorageConfig}}
{{- if or (eq (typeOf $element) "bool") $element }}
{{ $key }}: {{ $element | toYaml }}
{{- end }}
{{- end }}
{{- end }}
{{- /* Schema Registry API */}}
Expand Down