Skip to content

Commit

Permalink
Adding cert-manager test
Browse files Browse the repository at this point in the history
  • Loading branch information
cniackz committed Nov 1, 2023
1 parent a73ce13 commit b84de05
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 1 deletion.
24 changes: 23 additions & 1 deletion .github/workflows/kubernetes-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,29 @@ jobs:
- name: Tenant KES
run: |
"${GITHUB_WORKSPACE}/testing/console-tenant+kes.sh"
test-cert-manager:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
needs:
- operator
strategy:
matrix:
go-version: [ 1.21.x ]
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: actions/cache@v3
name: Operator Binary Cache
with:
path: |
./minio-operator
key: ${{ runner.os }}-binary-${{ github.run_id }}
- name: Deploy Tenant with cert-manager
run: |
"${GITHUB_WORKSPACE}/testing/deploy-cert-manager-tenant.sh"
test-policy-binding:
timeout-minutes: 30
runs-on: ${{ matrix.os }}
Expand Down
15 changes: 15 additions & 0 deletions testing/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ function setup_kind() {
try kubectl get nodes
}

# Function Intended to Test cert-manager for Tenant's certificate.
function install_cert_manager() {
# https://github.com/minio/operator/blob/master/docs/cert-manager.md
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.2/cert-manager.yaml
}

function install_operator() {

# To compile current branch
Expand Down Expand Up @@ -244,6 +250,15 @@ function check_tenant_status() {
echo "Done."
}

# To install tenant with cert-manager from our example provided.
function install_cert_manager_tenant() {
kubectl apply -k github.com/minio/operator/examples/kustomization/tenant-certmanager
# https://github.com/minio/operator/blob/master/docs/cert-manager.md
kubectl get secrets -n tenant-certmanager tenant-certmanager-tls -o=jsonpath='{.data.ca\.crt}' | base64 -d > public.crt
kubectl create secret generic operator-ca-tls --from-file=public.crt -n minio-operator
kubectl rollout restart deployment.apps/minio-operator -n minio-operator
}

# Install tenant function is being used by deploy-tenant and check-prometheus
function install_tenant() {
# Check if we are going to install helm, latest in this branch or a particular version
Expand Down
39 changes: 39 additions & 0 deletions testing/deploy-cert-manager-tenant.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Copyright (C) 2022, MinIO, Inc.
#
# This code is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3,
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License, version 3,
# along with this program. If not, see <http://www.gnu.org/licenses/>

# This script requires: kubectl, kind

SCRIPT_DIR=$(dirname "$0")
export SCRIPT_DIR

source "${SCRIPT_DIR}/common.sh"

function main() {
destroy_kind

setup_kind

install_cert_manager

install_operator

install_cert_manager_tenant

check_tenant_status tenant-lite myminio

destroy_kind
}

main "$@"

0 comments on commit b84de05

Please sign in to comment.