Skip to content

Commit 7e150d8

Browse files
authored
Merge pull request #15 from jetstack/deploy-preflight-agent
Deploy the preflight agent
2 parents 46c5293 + bd1a738 commit 7e150d8

File tree

6 files changed

+118
-13
lines changed

6 files changed

+118
-13
lines changed

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ gcloud container clusters create foo --region us-east1 --num-nodes=1 --preemptib
1818
--workload-pool=$(gcloud config get-value project | tr ':' '/').svc.id.goog
1919
```
2020

21+
This application re-tags the various images (cert-manager, cas-issuer, ubbagent, preflight-agent) using
22+
a unified tag that we call "application version". Although it does not appear to be a requirement for
23+
releasing to the Google Marketplace, we were not able to set "default" tags for each image and thus
24+
resolved to just having a unified tag; this means that we will have to keep this difference in tags when
25+
supporting [jetstack-secure-for-cert-manager][].
26+
27+
[jetstack-secure-for-cert-manager]: https://console.cloud.google.com/partner/editor/jetstack-public/jetstack-secure-for-cert-manager?project=jetstack-public
28+
2129
Re-publish the images to the project:
2230

2331
```sh
@@ -27,19 +35,22 @@ docker pull quay.io/jetstack/cert-manager-controller:v1.1.0
2735
docker pull quay.io/jetstack/cert-manager-cainjector:v1.1.0
2836
docker pull quay.io/jetstack/cert-manager-webhook:v1.1.0
2937
docker pull quay.io/jetstack/cert-manager-google-cas-issuer:0.1.0
30-
docker tag quay.io/jetstack/cert-manager-controller:v1.1.0 $REGISTRY/$APP_NAME/cert-manager-controller:1.1.0
31-
docker tag quay.io/jetstack/cert-manager-cainjector:v1.1.0 $REGISTRY/$APP_NAME/cert-manager-cainjector:1.1.0
32-
docker tag quay.io/jetstack/cert-manager-webhook:v1.1.0 $REGISTRY/$APP_NAME/cert-manager-webhook:1.1.0
33-
docker tag quay.io/jetstack/cert-manager-google-cas-issuer:latest $REGISTRY/$APP_NAME/cert-manager-google-cas-issuer:0.1.0
34-
docker push $REGISTRY/$APP_NAME/cert-manager-controller:1.1.0
35-
docker push $REGISTRY/$APP_NAME/cert-manager-cainjector:1.1.0
36-
docker push $REGISTRY/$APP_NAME/cert-manager-webhook:1.1.0
37-
docker push $REGISTRY/$APP_NAME/cert-manager-google-cas-issuer:0.1.0
38+
docker pull quay.io/jetstack/preflight:0.1.27
39+
docker tag quay.io/jetstack/cert-manager-controller:v1.1.0 $REGISTRY/$APP_NAME/cert-manager-controller:1.0.0
40+
docker tag quay.io/jetstack/cert-manager-cainjector:v1.1.0 $REGISTRY/$APP_NAME/cert-manager-cainjector:1.0.0
41+
docker tag quay.io/jetstack/cert-manager-webhook:v1.1.0 $REGISTRY/$APP_NAME/cert-manager-webhook:1.0.0
42+
docker tag quay.io/jetstack/cert-manager-google-cas-issuer:latest $REGISTRY/$APP_NAME/cert-manager-google-cas-issuer:1.0.0
43+
docker tag quay.io/jetstack/preflight:latest $REGISTRY/$APP_NAME/cert-manager-preflight:1.0.0
44+
docker push $REGISTRY/$APP_NAME/cert-manager-controller:1.0.0
45+
docker push $REGISTRY/$APP_NAME/cert-manager-cainjector:1.0.0
46+
docker push $REGISTRY/$APP_NAME/cert-manager-webhook:1.0.0
47+
docker push $REGISTRY/$APP_NAME/cert-manager-google-cas-issuer:1.0.0
48+
docker push $REGISTRY/$APP_NAME/cert-manager-preflight:1.0.0
3849
```
3950

40-
> Note: although cert-manager's tags are of the form "v1.1.0", we chose to
41-
> use tags of the form "1.1.0" for the Google Marketplace for the sake of
42-
> consistency.
51+
> Note: although cert-manager's tags are of the form "v1.1.0", we
52+
> use the same JSP version tag for all the Google Marketplace images,
53+
> for consistency with other marketplace packages.
4354
4455
Then, build and push the deployer image:
4556

chart/jetstacksecure-mp/Chart.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# The appVersion below are overridden by the `publishedVersion` that is set in
2+
# `schema.yaml`. Changing the below version will not change the actual versions
3+
# being pulled when the application is deployed from the Google Marketplace.
4+
# Instead, you should update the image tags that are being re-tagged in
5+
# `cloudbuild.yml`.
16
apiVersion: v2
27
engine: gotpl
38
name: jetstacksecure-mp
@@ -10,3 +15,7 @@ dependencies:
1015
- name: google-cas-issuer
1116
appVersion: 0.1.0
1217
repository: ./charts/google-cas-issuer
18+
- name: preflight
19+
version: 0.1.0
20+
appVersion: 0.1.27
21+
repository: ./charts/preflight

chart/jetstacksecure-mp/charts/preflight/templates/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: apps/v1
22
kind: Deployment
33
metadata:
4-
name: agent
4+
name: {{ include "preflight.fullname" . }}
55
labels:
66
{{- include "preflight.labels" . | nindent 4 }}
77
spec:
@@ -28,7 +28,7 @@ spec:
2828
secret:
2929
secretName: agent-credentials
3030
containers:
31-
- name: agent
31+
- name: {{ .Chart.Name }}
3232
image: "{{ .Values.image.repository }}:v{{ .Chart.AppVersion }}"
3333
args:
3434
- "agent"

chart/jetstacksecure-mp/values.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ google-cas-issuer:
2222
installCRDs: true
2323
serviceAccount:
2424
create: false # see note (1)
25+
26+
preflight:
27+
serviceAccount:
28+
create: false # see note (1)
29+
rbac:
30+
create: false # see note (1)

cloudbuild.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,32 @@ substitutions:
66
_APP_VERSION: 1.0.0
77
_CERT_MANAGER_VERSION: 1.1.0
88
_CAS_ISSUER_VERSION: 0.1.0
9+
_PREFLIGHT_VERSION: 0.1.27
910
steps:
11+
- id: pull-preflight
12+
name: gcr.io/cloud-builders/docker
13+
args:
14+
- pull
15+
- quay.io/jetstack/preflight:v${_PREFLIGHT_VERSION}
16+
waitFor: ["-"]
17+
18+
- id: tag-preflight
19+
name: gcr.io/cloud-builders/docker
20+
args:
21+
- tag
22+
- quay.io/jetstack/preflight:v${_PREFLIGHT_VERSION}
23+
- gcr.io/$PROJECT_ID/${_SOLUTION_NAME}/cert-manager-preflight:${_APP_VERSION}
24+
waitFor:
25+
- pull-preflight
26+
27+
- id: push-preflight
28+
name: gcr.io/cloud-builders/docker
29+
args:
30+
- push
31+
- gcr.io/$PROJECT_ID/${_SOLUTION_NAME}/cert-manager-preflight:${_APP_VERSION}
32+
waitFor:
33+
- tag-preflight
34+
1035
- id: pull-cas-issuer
1136
name: gcr.io/cloud-builders/docker
1237
args:
@@ -217,6 +242,7 @@ steps:
217242
- push-cainjector
218243
- push-webhook
219244
- push-cas-issuer
245+
- push-preflight
220246
- push-ubbagent
221247

222248
- id: publish
@@ -238,5 +264,6 @@ images:
238264
- gcr.io/$PROJECT_ID/${_SOLUTION_NAME}/cert-manager-cainjector:${_APP_VERSION}
239265
- gcr.io/$PROJECT_ID/${_SOLUTION_NAME}/cert-manager-webhook:${_APP_VERSION}
240266
- gcr.io/$PROJECT_ID/${_SOLUTION_NAME}/cert-manager-google-cas-issuer:${_APP_VERSION}
267+
- gcr.io/$PROJECT_ID/${_SOLUTION_NAME}/cert-manager-preflight:${_APP_VERSION}
241268
- gcr.io/$PROJECT_ID/${_SOLUTION_NAME}/deployer:${_APP_VERSION}
242269
- gcr.io/$PROJECT_ID/${_SOLUTION_NAME}/ubbagent:${_APP_VERSION}

schema.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ x-google-marketplace:
5050
type: REPO_WITH_REGISTRY
5151
google-cas-issuer.image.tag:
5252
type: TAG
53+
cert-manager-preflight:
54+
properties:
55+
preflight.image.repository:
56+
type: REPO_WITH_REGISTRY
57+
preflight.image.tag:
58+
type: TAG
5359

5460
# Allow the deployer to create CRDs and webhook configurations
5561
# See https://github.com/GoogleCloudPlatform/marketplace-k8s-app-tools/blob/master/docs/schema.md#deployerserviceaccount
@@ -302,6 +308,52 @@ properties:
302308
resources: [certificaterequests/status]
303309
verbs: [get, patch, update]
304310

311+
preflight.serviceAccount.name:
312+
type: string
313+
x-google-marketplace:
314+
type: SERVICE_ACCOUNT
315+
serviceAccount:
316+
description: Service account used by preflight
317+
roles:
318+
- type: ClusterRole
319+
rulesType: CUSTOM
320+
rules:
321+
- apiGroups: [""]
322+
resources: ["nodes"]
323+
verbs: ["get", "list"]
324+
- type: ClusterRole
325+
rulesType: CUSTOM
326+
rules:
327+
- apiGroups: [""]
328+
resources: ["secrets"]
329+
verbs: ["get", "list"]
330+
- type: ClusterRole
331+
rulesType: CUSTOM
332+
rules:
333+
- apiGroups: ["cert-manager.io"]
334+
resources:
335+
- certificates
336+
- certificaterequests
337+
- issuers
338+
- clusterissuers
339+
verbs: ["get", "list"]
340+
- type: ClusterRole
341+
rulesType: CUSTOM
342+
rules:
343+
- apiGroups: ["cas-issuer.jetstack.io"]
344+
resources:
345+
- googlecasissuers
346+
- googlecasclusterissuers
347+
verbs: ["get", "list"]
348+
- type: ClusterRole
349+
rulesType: CUSTOM
350+
rules:
351+
- apiGroups: ["admissionregistration.k8s.io"]
352+
resources:
353+
- validatingwebhookconfigurations
354+
- mutatingwebhookconfigurations
355+
verbs: ["get", "list"]
356+
305357
required:
306358
- name
307359
- namespace

0 commit comments

Comments
 (0)