Skip to content

Commit bfae5f7

Browse files
authored
Merge pull request #22 from Keyfactor/helmdeps-53458
v1.0.6: Upgrade packages, implement `metrics.metricsAddress` and `containerPorts` in Helm chart, refactor release process
2 parents 31dd7dd + 564c07e commit bfae5f7

File tree

13 files changed

+100
-223
lines changed

13 files changed

+100
-223
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
name: Build and Release
1+
name: Build and Release Helm Chart
22
on:
3-
push:
4-
branches:
5-
- '*'
63
pull_request:
74
branches:
85
- 'v*'
@@ -14,152 +11,10 @@ on:
1411
# pushed to the pull request's branch
1512
- synchronize
1613

17-
env:
18-
REGISTRY: ghcr.io
19-
2014
jobs:
21-
build:
22-
name: Build Containers
23-
runs-on: ubuntu-latest
24-
strategy:
25-
fail-fast: false
26-
matrix:
27-
platform:
28-
- linux/arm64
29-
- linux/amd64
30-
- linux/s390x
31-
- linux/ppc64le
32-
33-
permissions:
34-
contents: read
35-
packages: write
36-
37-
steps:
38-
39-
- name: Set IMAGE_NAME
40-
run: |
41-
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
42-
43-
# Checkout code
44-
# https://github.com/actions/checkout
45-
- name: Checkout code
46-
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
47-
48-
# Extract metadata (tags, labels) for Docker
49-
# https://github.com/docker/metadata-action
50-
- name: Extract Docker metadata
51-
id: meta
52-
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
53-
with:
54-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
55-
56-
# Set up QEMU
57-
# https://github.com/docker/setup-qemu-action
58-
- name: Set up QEMU
59-
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
60-
61-
# Set up BuildKit Docker container builder to be able to build
62-
# multi-platform images and export cache
63-
# https://github.com/docker/setup-buildx-action
64-
- name: Set up Docker Buildx
65-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
66-
67-
# Login to Docker registry
68-
# https://github.com/docker/login-action
69-
- name: Log into registry ${{ env.REGISTRY }}
70-
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
71-
with:
72-
registry: ${{ env.REGISTRY }}
73-
username: ${{ github.actor }}
74-
password: ${{ secrets.GITHUB_TOKEN }}
75-
76-
# Build and push Docker image with Buildx
77-
# https://github.com/docker/build-push-action
78-
- name: Build and push Docker image
79-
id: build
80-
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
81-
with:
82-
context: .
83-
platforms: ${{ matrix.platform }}
84-
labels: ${{ steps.meta.outputs.labels }}
85-
push: ${{ github.event.pull_request.merged == true }}
86-
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true
87-
88-
# Export digest
89-
- name: Export digest
90-
if: github.event.pull_request.merged == true
91-
run: |
92-
mkdir -p /tmp/digests
93-
digest="${{ steps.build.outputs.digest }}"
94-
touch "/tmp/digests/${digest#sha256:}"
95-
96-
# Upload digest
97-
- name: Upload digest
98-
if: github.event.pull_request.merged == true
99-
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
100-
with:
101-
name: digests
102-
path: /tmp/digests/*
103-
if-no-files-found: error
104-
retention-days: 1
105-
106-
merge:
107-
runs-on: ubuntu-latest
108-
if: github.event.pull_request.merged == true
109-
needs:
110-
- build
111-
steps:
112-
- name: Set IMAGE_NAME
113-
run: |
114-
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
115-
116-
# Download digests
117-
# https://github.com/actions/download-artifact
118-
- name: Download digests
119-
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
120-
with:
121-
name: digests
122-
path: /tmp/digests
123-
124-
# Set up BuildKit Docker container builder to be able to build
125-
# multi-platform images and export cache
126-
# https://github.com/docker/setup-buildx-action
127-
- name: Set up Docker Buildx
128-
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
129-
130-
# Extract metadata (tags, labels) for Docker
131-
# https://github.com/docker/metadata-action
132-
- name: Extract Docker metadata
133-
id: meta
134-
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
135-
with:
136-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
137-
138-
# Login to Docker registry
139-
# https://github.com/docker/login-action
140-
- name: Log into registry ${{ env.REGISTRY }}
141-
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
142-
with:
143-
registry: ${{ env.REGISTRY }}
144-
username: ${{ github.actor }}
145-
password: ${{ secrets.GITHUB_TOKEN }}
146-
147-
# Create manifest list and push
148-
- name: Create manifest list and push
149-
working-directory: /tmp/digests
150-
run: |
151-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
152-
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
153-
154-
- name: Inspect image
155-
run: |
156-
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
157-
15815
helm:
15916
runs-on: ubuntu-latest
16017
if: github.event.pull_request.merged == true
161-
needs:
162-
- merge
16318
steps:
16419
- name: Set IMAGE_NAME
16520
run: |

CHANGELOG.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# v1.0.4
1+
# v1.0.6
22

33
## Features
4-
* 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.
5-
* feat(release): Container build and release now uses GitHub Actions.
4+
* feat(helm): Rename `secureMetrics` to `metrics` and add `metrics.secure` and `metrics.metricsAddress` as configuration values. This way, Prometheus can scrape the controller manager metrics without the secure metrics proxy.
5+
* feat(helm): Add configuration element in Helm chart default values file to configure container ports on the controller manager container.
66

77
## Fixes
8-
* fix(helm): CRDs now correspond to correct values for the `command-issuer`.
9-
* fix(helm): Signer Helm Chart now includes a `secureMetrics` value to enable/disable sidecar RBAC container for further protection of the `/metrics` endpoint.
10-
* fix(signer): Signer now returns CA chain bytes instead of appending to the leaf certificate.
11-
* fix(role): Removed permissions for `configmaps` resource types for the `leader-election-role` role.
8+
* fix(deps): Update golang.org/x/net to v0.19.0
9+
* fix(dockerfile): Upgrade builder image to golang:1.20 to address [CVE-2023-38408](https://scout.docker.com/vulnerabilities/id/CVE-2023-38408?utm_source=hub&utm_medium=ExternalLink&_gl=1*hbs4zp*_ga*MTU5MTQ4Mzk3MC4xNjkxNDI2NjAy*_ga_XJWPQMJYHQ*MTcwMzE4NzcyNC4xMDEuMS4xNzAzMTg4OTUxLjM3LjAuMA..)
1210

1311
# v1.0.5
1412

@@ -18,3 +16,15 @@
1816
## Fixes
1917
* fix(helm): Add configuration flag to configure chart to either grant cluster-scoped or namespace-scoped access to Secret and ConfigMap API
2018
* fix(controller): Add logic to read secret from reconciler namespace or Issuer namespace depending on Helm configuration.
19+
20+
# v1.0.4
21+
22+
## Features
23+
* 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.
24+
* feat(release): Container build and release now uses GitHub Actions.
25+
26+
## Fixes
27+
* fix(helm): CRDs now correspond to correct values for the `command-issuer`.
28+
* fix(helm): Signer Helm Chart now includes a `secureMetrics` value to enable/disable sidecar RBAC container for further protection of the `/metrics` endpoint.
29+
* fix(signer): Signer now returns CA chain bytes instead of appending to the leaf certificate.
30+
* fix(role): Removed permissions for `configmaps` resource types for the `leader-election-role` role.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM golang:1.19 as builder
2+
FROM golang:1.20 as builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

deploy/charts/command-cert-manager-issuer/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,6 @@ The following table lists the configurable parameters of the `command-cert-manag
8585
| `resources` | CPU/Memory resource requests/limits | `{}` (with commented out options) |
8686
| `nodeSelector` | Node labels for pod assignment | `{}` |
8787
| `tolerations` | Tolerations for pod assignment | `[]` |
88-
| `secureMetrics.enabled` | Whether to enable and configure the kube-rbac-proxy sidecar for authorized and authenticated use of the /metrics endpoint by Prometheus. | `false` |
88+
| `metrics.secure` | Whether to enable and configure the kube-rbac-proxy sidecar for authorized and authenticated use of the /metrics endpoint by Prometheus. | `false` |
8989
| `secretConfig.useClusterRoleForSecretAccess` | Specifies if the ServiceAccount should be granted access to the Secret resource using a ClusterRole | `false` |
90+
| `containerPorts` | Defines the ports that the controller manager container exposes. If you change this, you will need to configure your Prometheus instance to scrape these metrics. | `[{"containerPort": 8080, "name": "http-metrics", "protocol": "TCP"}]` |

deploy/charts/command-cert-manager-issuer/templates/clusterrole.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ rules:
4545
- issuers/finalizers
4646
verbs:
4747
- update
48-
{{- if .Values.secureMetrics.enabled }}
48+
{{- if .Values.metrics.secure }}
4949
---
5050
apiVersion: rbac.authorization.k8s.io/v1
5151
kind: ClusterRole

deploy/charts/command-cert-manager-issuer/templates/clusterrolebinding.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ subjects:
1212
- kind: ServiceAccount
1313
name: {{ include "command-cert-manager-issuer.serviceAccountName" . }}
1414
namespace: {{ .Release.Namespace }}
15-
{{- if .Values.secureMetrics.enabled }}
15+
{{- if .Values.metrics.secure }}
1616
---
1717
apiVersion: rbac.authorization.k8s.io/v1
1818
kind: ClusterRoleBinding

deploy/charts/command-cert-manager-issuer/templates/deployment.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
securityContext:
2727
{{- toYaml .Values.podSecurityContext | nindent 8 }}
2828
containers:
29-
{{- if .Values.secureMetrics.enabled }}
29+
{{- if .Values.metrics.secure }}
3030
- args:
3131
- --secure-listen-address=0.0.0.0:8443
3232
- --upstream=http://127.0.0.1:8080/
@@ -53,7 +53,7 @@ spec:
5353
{{- end }}
5454
- args:
5555
- --health-probe-bind-address=:8081
56-
- --metrics-bind-address=127.0.0.1:8080
56+
- --metrics-bind-address={{ .Values.metrics.metricsAddress }}
5757
- --leader-elect
5858
{{- if .Values.secretConfig.useClusterRoleForSecretAccess}}
5959
- --secret-access-granted-at-cluster-level
@@ -75,6 +75,10 @@ spec:
7575
port: 8081
7676
initialDelaySeconds: 5
7777
periodSeconds: 10
78+
{{- with .Values.containerPorts }}
79+
ports:
80+
{{- toYaml . | nindent 12 }}
81+
{{- end }}
7882
resources:
7983
{{- toYaml .Values.resources | nindent 12 }}
8084
securityContext:

deploy/charts/command-cert-manager-issuer/templates/service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{- if .Values.secureMetrics.enabled }}
1+
{{- if .Values.metrics.secure }}
22
apiVersion: v1
33
kind: Service
44
metadata:

deploy/charts/command-cert-manager-issuer/values.yaml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
replicaCount: 1
55

66
image:
7-
repository: ""
7+
repository: "keyfactor/command-cert-manager-issuer"
88
pullPolicy: IfNotPresent
99
# Overrides the image tag whose default is the chart appVersion.
1010
tag: ""
@@ -13,10 +13,23 @@ imagePullSecrets: []
1313
nameOverride: ""
1414
fullnameOverride: ""
1515

16-
# Whether to enable and configure the kube-rbac-proxy sidecar for authorized and authenticated
17-
# use of the /metrics endpoint by Prometheus.
18-
secureMetrics:
19-
enabled: false
16+
metrics:
17+
# Whether to enable and configure the kube-rbac-proxy sidecar for authorized and authenticated
18+
# use of the /metrics endpoint by Prometheus.
19+
secure: false
20+
# The address and port to expose the metrics endpoint. This will only be configured as a container
21+
# port; you will need to configure your Prometheus instance to scrape this endpoint.
22+
# Example: ":8080" (default)
23+
metricsAddress: ":8080"
24+
25+
# Define the ports that the controller manager container exposes.
26+
# If you change this, you will need to configure your Prometheus instance to scrape these metrics.
27+
# If metrics.secure is true, Prometheus must scrape port 8443 with HTTPS.
28+
containerPorts:
29+
# Values must be in the format expected by the ports field of the Kubernetes v1 core API type ContainerPort.
30+
- containerPort: 8080
31+
name: http-metrics
32+
protocol: TCP
2033

2134
secretConfig:
2235
# If true, when using Issuer resources, the credential secret must be created in the same namespace as the

docs/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<a href="https://kubernetes.io">
2+
<img src="https://raw.githubusercontent.com/cert-manager/cert-manager/d53c0b9270f8cd90d908460d69502694e1838f5f/logo/logo-small.png" alt="Terraform logo" title="K8s" align="left" height="50" />
3+
</a>
4+
5+
# Keyfactor Command Issuer for cert-manager
6+
7+
[![Go Report Card](https://goreportcard.com/badge/github.com/Keyfactor/command-cert-manager-issuer)](https://goreportcard.com/report/github.com/Keyfactor/command-cert-manager-issuer)
8+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://img.shields.io/badge/License-Apache%202.0-blue.svg)
9+
10+
The Command external issuer for cert-manager allows users to enroll certificates with a CA managed by Keyfactor Command using cert-manager. This allows security administrators to manage the lifecycle of certificates for Kubernetes applications.
11+
12+
Cert-manager is a native Kubernetes certificate management controller which allows applications to get their certificates from a variety of CAs (Certification Authorities). It ensures certificates are valid and up to date, it also attempts to renew certificates at a configured time before expiration.
13+
14+
* [Installation](install.markdown)
15+
* [Usage](config_usage.markdown)
16+
* [Example Usage](example.markdown)
17+
* [Customization](annotations.markdown)
18+
* [Testing the Source](testing.markdown)

0 commit comments

Comments
 (0)