Skip to content

Commit 90c3466

Browse files
committed
IAM improvements and pro-builder with build-time secrets
* Improvements on IAM policy conditions * Build-time secrets are now supported when enabled for the pro-builder Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
1 parent f734df8 commit 90c3466

File tree

9 files changed

+480
-366
lines changed

9 files changed

+480
-366
lines changed

chart/openfaas/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
type: application
33
description: OpenFaaS - Serverless Functions Made Simple
44
name: openfaas
5-
version: 15.0.2
5+
version: 15.0.3
66
sources:
77
- https://github.com/openfaas/faas
88
- https://github.com/openfaas/faas-netes

chart/openfaas/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ eventWorker:
152152

153153
# For OpenFaaS Pro and the Function CRD
154154
operator:
155-
image: ghcr.io/openfaasltd/faas-netes:0.5.88
155+
image: ghcr.io/openfaasltd/faas-netes:0.5.89
156156
create: false
157157
logs:
158158
debug: false
@@ -199,7 +199,7 @@ operator:
199199
successThreshold: 1
200200

201201
faasnetesPro:
202-
image: ghcr.io/openfaasltd/faas-netes:0.5.88
202+
image: ghcr.io/openfaasltd/faas-netes:0.5.89
203203
logs:
204204
debug: false
205205
format: "console"

chart/pro-builder/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
description: Build OpenFaaS functions via a REST API
33
name: pro-builder
4-
version: 0.6.6
4+
version: 0.6.7
55
sources:
66
- https://github.com/openfaas/faas-netes
77
home: https://www.openfaas.com

chart/pro-builder/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,37 @@ kubectl create secret generic payload-secret \
7070
--from-file payload-secret=payload.txt -n openfaas
7171
```
7272

73+
### Optional sealed build secrets
74+
75+
To enable per-build sealed secrets, generate a keypair:
76+
77+
```bash
78+
faas-cli secret keygen -o private.key
79+
80+
kubectl create secret generic -n openfaas \
81+
pro-builder-build-secrets-key \
82+
--from-file private.key=./private.key
83+
```
84+
85+
Distribute `private.key.pub` to build clients. They seal secrets with:
86+
87+
```bash
88+
faas-cli secret seal \
89+
--public-key ./private.key.pub \
90+
--key-id builder-key-1 \
91+
--from-literal pip_token=s3cr3t
92+
```
93+
94+
Then enable the feature in your custom values file:
95+
96+
```yaml
97+
buildSecrets:
98+
keyID: builder-key-1
99+
privateKeySecret: pro-builder-build-secrets-key
100+
```
101+
102+
When enabled, the builder unseals `com.openfaas.secrets` from the build tar and exposes `GET /publickey` so callers can fetch the public key and `key_id`.
103+
73104
## Install the Chart
74105

75106
- Create the required secret with your OpenFaaS Pro license code:

chart/pro-builder/templates/deployment.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ spec:
5252
secret:
5353
defaultMode: 420
5454
secretName: openfaas-license
55+
{{- if .Values.buildSecrets.privateKeySecret }}
56+
- name: build-secrets-key
57+
secret:
58+
secretName: {{ .Values.buildSecrets.privateKeySecret }}
59+
items:
60+
- key: {{ .Values.buildSecrets.privateKeyKey | quote }}
61+
path: {{ .Values.buildSecrets.privateKeyKey | quote }}
62+
{{- end }}
5563
- name: builder-workspace
5664
emptyDir: {}
5765
- name: buildkit-workspace
@@ -85,6 +93,14 @@ spec:
8593
value: {{ .Values.disableHmac | quote }}
8694
- name: "max_inflight"
8795
value: {{ or .Values.proBuilder.maxInflight 0 | quote }}
96+
{{- if .Values.buildSecrets.privateKeySecret }}
97+
- name: build_secrets_private_key_path
98+
value: {{ printf "%s/%s" .Values.buildSecrets.mountPath .Values.buildSecrets.privateKeyKey | quote }}
99+
{{- if .Values.buildSecrets.keyID }}
100+
- name: build_secrets_key_id
101+
value: {{ .Values.buildSecrets.keyID | quote }}
102+
{{- end }}
103+
{{- end }}
88104
{{- if .Values.awsCredentialsSecret }}
89105
- name: AWS_SHARED_CREDENTIALS_FILE
90106
value: /var/secrets/aws-credentials/{{ .Values.awsCredentialsSecret }}
@@ -127,6 +143,11 @@ spec:
127143
- name: license
128144
readOnly: true
129145
mountPath: "/var/secrets/license"
146+
{{- if .Values.buildSecrets.privateKeySecret }}
147+
- name: build-secrets-key
148+
readOnly: true
149+
mountPath: {{ .Values.buildSecrets.mountPath | quote }}
150+
{{- end }}
130151
- name: builder-workspace
131152
mountPath: /tmp/
132153
readOnly: false

chart/pro-builder/values.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ securityContext: {}
1616

1717
# image is for the pro-builder API
1818
proBuilder:
19-
image: ghcr.io/openfaasltd/pro-builder:0.5.3
19+
image: ghcr.io/openfaasltd/pro-builder:0.5.4
2020

2121
# Set to 0 for unlimited, or some non-zero value for a hard limit
2222
# the builder will return a HTTP 429 status code, then the client
@@ -83,6 +83,21 @@ disableHmac: false
8383
# enableLchown is usually set to false
8484
enableLchown: false
8585

86+
buildSecrets:
87+
# Name of the Kubernetes Secret containing the nacl/box private key.
88+
# Set this to enable build secrets — the feature is on when a key is configured.
89+
privateKeySecret: ""
90+
91+
# A stable identifier returned by GET /publickey and validated on incoming
92+
# build secrets envelopes.
93+
keyID: ""
94+
95+
# Key within privateKeySecret to mount into the Pod.
96+
privateKeyKey: private.key
97+
98+
# Directory mount for the private key file within the pro-builder container.
99+
mountPath: /var/secrets/buildkit
100+
86101
imagePullPolicy: IfNotPresent
87102

88103
fullnameOverride: "pro-builder"

0 commit comments

Comments
 (0)