Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
5b61248
chore: Create release workflow, make rbac configurable in Chart, adju…
m8rmclaren Oct 4, 2023
5fb90a4
chore: CRD openAPIV3Schema bug - incorrect values for command-isuer
m8rmclaren Oct 4, 2023
8b68bb7
chore: Revert README.md from referencing caBundleSecretName to caSecr…
m8rmclaren Oct 4, 2023
4be4d38
chore: CRD openAPIV3Schema - Update descriptions to accurately reflec…
m8rmclaren Oct 4, 2023
52e013a
feat(metadata): Signer recognizes annotation prefix for Command meta…
m8rmclaren Oct 6, 2023
c849c64
chore: Replace string format with
m8rmclaren Oct 6, 2023
ac412fa
bug(release): Force org/repository inside to lowercase
m8rmclaren Oct 6, 2023
5a8369d
bug(release): Force org/repository inside to lowercase with paramete…
m8rmclaren Oct 6, 2023
baf4658
Merge pull request #12 from Keyfactor/metadata
m8rmclaren Oct 9, 2023
5839f48
chore: Create feature parity between cert-manager certificaterequest …
m8rmclaren Oct 11, 2023
050247e
chore: Change action workflow to pull from vars instead of secrets fo…
m8rmclaren Oct 11, 2023
0d0a5e2
fix(signer): Copy CN to DNS SAN for signer test
m8rmclaren Oct 11, 2023
e9cb114
Merge pull request #14 from Keyfactor/cmparity
m8rmclaren Oct 12, 2023
b76c246
chore: Clarify hostname requirements, refactor examples to include ex…
m8rmclaren Oct 17, 2023
df34fe2
chore: Clarify hostname requirements, refactor examples to include ex…
m8rmclaren Oct 17, 2023
3c13468
chore: Refactor Helm steps in readme and update makefile to download …
m8rmclaren Oct 17, 2023
2b23cef
Merge pull request #15 from Keyfactor/docs
m8rmclaren Oct 17, 2023
0a55ed3
chore: Refactor Docs to use doc tree instead of lengthy readme
m8rmclaren Oct 23, 2023
c9e1a7b
Merge pull request #16 from Keyfactor/docs
m8rmclaren Oct 23, 2023
415a856
fix(docs): Fix formatting in install.markdown
m8rmclaren Oct 25, 2023
8d16335
Merge pull request #17 from Keyfactor/install-patch-1
m8rmclaren Oct 25, 2023
a0812c5
fix(makefile): Bug naming convention in deploy-local target
m8rmclaren Oct 30, 2023
037e9d9
Merge pull request #18 from Keyfactor/localdev
m8rmclaren Oct 30, 2023
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
202 changes: 186 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,213 @@
name: helm_release
name: Build and Release
on:
push:
branches:
- '*'
pull_request:
branches:
- 'v*'
types:
# action should run when the pull request is closed
# (regardless of whether it was merged or just closed)
- closed
# Make sure the action runs every time new commits are
# pushed to the pull request's branch
- synchronize

env:
REGISTRY: ghcr.io

jobs:
build:
name: Build Containers
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/arm64
- linux/amd64
- linux/s390x
- linux/ppc64le

permissions:
contents: read
packages: write

steps:

- name: Set IMAGE_NAME
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

# Checkout code
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Set up QEMU
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# Login to Docker registry
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Build and push Docker image with Buildx
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event.pull_request.merged == true }}
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true

# Export digest
- name: Export digest
if: github.event.pull_request.merged == true
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"

# Upload digest
- name: Upload digest
if: github.event.pull_request.merged == true
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: digests
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
needs:
- build
steps:
- name: Set IMAGE_NAME
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

# Download digests
# https://github.com/actions/download-artifact
- name: Download digests
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: digests
path: /tmp/digests

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Login to Docker registry
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Create manifest list and push
- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)

- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}

helm:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
needs:
- merge
steps:
- name: Extract Version Tag
id: extract_version
run: /bin/bash -c 'echo ::set-output name=VERSION::$(echo ${GITHUB_REF##*/} | cut -c2-)'
- name: Set IMAGE_NAME
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

# Checkout code
# https://github.com/actions/checkout
- name: Checkout code
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0

# Extract metadata (tags, labels) to use in Helm chart
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Checkout
uses: actions/checkout@v3
# Set version from DOCKER_METADATA_OUTPUT_VERSION as environment variable
- name: Set Version
run: |
echo "VERSION=${DOCKER_METADATA_OUTPUT_VERSION:1}" >> $GITHUB_ENV

# Change version and appVersion in Chart.yaml to the tag in the closed PR
- name: Update Helm App/Chart Version
shell: bash
run: |
sed -i "s/^version: .*/version: ${{ steps.extract_version.outputs.VERSION }}/g" deploy/charts/command-cert-manager-issuer/Chart.yaml
sed -i "s/^appVersion: .*/appVersion: \"${{ steps.extract_version.outputs.VERSION }}\"/g" deploy/charts/command-cert-manager-issuer/Chart.yaml
sed -i "s/^version: .*/version: ${{ env.VERSION }}/g" deploy/charts/command-cert-manager-issuer/Chart.yaml
sed -i "s/^appVersion: .*/appVersion: \"${{ env.DOCKER_METADATA_OUTPUT_VERSION }}\"/g" deploy/charts/command-cert-manager-issuer/Chart.yaml

# Setup Helm
# https://github.com/Azure/setup-helm
- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
token: ${{ secrets.GITHUB_TOKEN }}

# Helm requires an ident name to be set for chart-releaser to work
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"

- name: Install Helm
uses: azure/setup-helm@v3

# Build and release Helm chart to GitHub Pages
# https://github.com/helm/chart-releaser-action
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.5.0
uses: helm/chart-releaser-action@be16258da8010256c6e82849661221415f031968 # v1.5.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
pages_branch: gh-pages
charts_dir: deploy/charts
mark_as_latest: true
packages_with_index: true
charts_dir: deploy/charts
42 changes: 42 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: test
on: [workflow_dispatch, push, pull_request]
jobs:
build:
name: Build and Lint
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- run: go build -v .
- name: Run linters
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
with:
version: latest
test:
name: Go Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
- name: Set up Go 1.x
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: 'go.mod'
cache: true
- run: go mod download
- env:
COMMAND_CERTIFICATE_AUTHORITY_HOSTNAME: ${{ vars.COMMAND_CERTIFICATE_AUTHORITY_HOSTNAME }}
COMMAND_CERTIFICATE_AUTHORITY_LOGICAL_NAME: ${{ vars.COMMAND_CERTIFICATE_AUTHORITY_LOGICAL_NAME }}
COMMAND_CERTIFICATE_TEMPLATE: ${{ vars.COMMAND_CERTIFICATE_TEMPLATE }}
COMMAND_HOSTNAME: ${{ vars.COMMAND_HOSTNAME }}
COMMAND_USERNAME: ${{ secrets.COMMAND_USERNAME }}
COMMAND_PASSWORD: ${{ secrets.COMMAND_PASSWORD }}
name: Run go test
run: go test -v ./...
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# v1.0.4

## Features
* feat(signer): Signer recognizes `metadata.command-issuer.keyfactor.com/<metadata-field-name>: <metadata-value>` annotations on the CertificateRequest resource and uses them to populate certificate metadata in Command.
* feat(release): Container build and release now uses GitHub Actions.

## Fixes
* fix(helm): CRDs now correspond to correct values for the `command-issuer`.
* fix(helm): Signer Helm Chart now includes a `secureMetrics` value to enable/disable sidecar RBAC container for further protection of the `/metrics` endpoint.
* fix(signer): Signer now returns CA chain bytes instead of appending to the leaf certificate.
* fix(role): Removed permissions for `configmaps` resource types for the `leader-election-role` role.
26 changes: 19 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# The version which will be reported by the --version argument of each binary
# and which will be used as the Docker image tag
VERSION ?= 1.0.3
VERSION ?= latest
# The Docker repository name, overridden in CI.
DOCKER_REGISTRY ?= m8rmclarenkf
DOCKER_IMAGE_NAME ?= command-cert-manager-external-issuer-controller
DOCKER_REGISTRY ?= ""
DOCKER_IMAGE_NAME ?= ""
# Image URL to use all building/pushing image targets
IMG ?= ${DOCKER_REGISTRY}/${DOCKER_IMAGE_NAME}:${VERSION}
#IMG ?= command-issuer-dev:latest

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.26.0
Expand Down Expand Up @@ -67,6 +66,11 @@ test: manifests generate fmt vet envtest ## Run tests.

##@ Build

.PHONY: regcheck
regcheck: ## Check if the docker registry is set.
@test -n "$(DOCKER_REGISTRY)" || (echo "DOCKER_REGISTRY is not set" && exit 1)
@test -n "$(DOCKER_IMAGE_NAME)" || (echo "DOCKER_IMAGE_NAME is not set" && exit 1)

.PHONY: build
build: manifests generate fmt vet ## Build manager binary.
go build -o bin/manager main.go
Expand All @@ -79,10 +83,10 @@ run: manifests generate fmt vet ## Run a controller from your host.
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
.PHONY: docker-build
docker-build: test ## Build docker image with the manager.
docker-build: regcheck ## Build docker image with the manager.
docker build -t ${IMG} .

.PHONY: docker-push
.PHONY: docker-push regcheck
docker-push: ## Push docker image with the manager.
docker push ${IMG}

Expand All @@ -94,7 +98,7 @@ docker-push: ## Push docker image with the manager.
# To properly provided solutions that supports more than one platform you should use this option.
PLATFORMS ?= linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
.PHONY: docker-buildx
docker-buildx: test ## Build and push docker image for the manager for cross-platform support
docker-buildx: regcheck ## Build and push docker image for the manager for cross-platform support
# copy existing Dockerfile and insert --platform=${BUILDPLATFORM} into Dockerfile.cross, and preserve the original Dockerfile
sed -e '1 s/\(^FROM\)/FROM --platform=\$$\{BUILDPLATFORM\}/; t' -e ' 1,// s//FROM --platform=\$$\{BUILDPLATFORM\}/' Dockerfile > Dockerfile.cross
- docker buildx create --name project-v3-builder
Expand Down Expand Up @@ -122,6 +126,14 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -

# Build the manager image for local development. This image is not intended to be used in production.
# Then, install it into the K8s cluster
.PHONY: deploy-local
deploy-local: manifests kustomize ## Build docker image with the manager.
docker build -t command-issuer-dev:latest -f Dockerfile .
cd config/manager && $(KUSTOMIZE) edit set image controller=command-issuer-dev:latest
$(KUSTOMIZE) build config/default | kubectl apply -f -

.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
$(KUSTOMIZE) build config/default | kubectl delete --ignore-not-found=$(ignore-not-found) -f -
Expand Down
Loading