Skip to content

Commit 51e091b

Browse files
committed
✨ Prep for deployment.
1 parent 93789b0 commit 51e091b

File tree

7 files changed

+189
-271
lines changed

7 files changed

+189
-271
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ COPY webhook/ webhook/
2020
COPY http/ http/
2121

2222
# Build
23-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
24-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o waiter cmd/waiter/main.go
23+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -tags release -o manager main.go
24+
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -tags release -o waiter cmd/waiter/main.go
2525

2626
# Use distroless as minimal base image to package the manager binary
2727
# Refer to https://github.com/GoogleContainerTools/distroless for more details

config/crd/bases/migrations.coderanger.net_migrators.yaml

Lines changed: 142 additions & 206 deletions
Large diffs are not rendered by default.

config/crd/kustomization.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,9 @@ resources:
66
# +kubebuilder:scaffold:crdkustomizeresource
77

88
patchesStrategicMerge:
9-
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix.
10-
# patches here are for enabling the conversion webhook for each CRD
11-
#- patches/webhook_in_migrators.yaml
9+
- patches/webhook_in_migrators.yaml
1210
# +kubebuilder:scaffold:crdkustomizewebhookpatch
13-
14-
# [CERTMANAGER] To enable webhook, uncomment all the sections with [CERTMANAGER] prefix.
15-
# patches here are for enabling the CA injection for each CRD
16-
#- patches/cainjection_in_migrators.yaml
11+
- patches/cainjection_in_migrators.yaml
1712
# +kubebuilder:scaffold:crdkustomizecainjectionpatch
1813

1914
# the following config is for teaching kustomize how to do kustomization for CRDs.

config/default/kustomization.yaml

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -16,55 +16,43 @@ bases:
1616
- ../crd
1717
- ../rbac
1818
- ../manager
19-
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
20-
# crd/kustomization.yaml
21-
#- ../webhook
22-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'. 'WEBHOOK' components are required.
23-
#- ../certmanager
24-
# [PROMETHEUS] To enable prometheus monitor, uncomment all sections with 'PROMETHEUS'.
25-
#- ../prometheus
19+
- ../webhook
20+
- ../certmanager
21+
- ../prometheus
2622

2723
patchesStrategicMerge:
2824
# Protect the /metrics endpoint by putting it behind auth.
2925
# If you want your controller-manager to expose the /metrics
3026
# endpoint w/o any authn/z, please comment the following line.
3127
- manager_auth_proxy_patch.yaml
32-
33-
# [WEBHOOK] To enable webhook, uncomment all the sections with [WEBHOOK] prefix including the one in
34-
# crd/kustomization.yaml
35-
#- manager_webhook_patch.yaml
36-
37-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER'.
38-
# Uncomment 'CERTMANAGER' sections in crd/kustomization.yaml to enable the CA injection in the admission webhooks.
39-
# 'CERTMANAGER' needs to be enabled to use ca injection
40-
#- webhookcainjection_patch.yaml
28+
- manager_webhook_patch.yaml
29+
- webhookcainjection_patch.yaml
4130

4231
# the following config is for teaching kustomize how to do var substitution
4332
vars:
44-
# [CERTMANAGER] To enable cert-manager, uncomment all sections with 'CERTMANAGER' prefix.
45-
#- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
46-
# objref:
47-
# kind: Certificate
48-
# group: cert-manager.io
49-
# version: v1alpha2
50-
# name: serving-cert # this name should match the one in certificate.yaml
51-
# fieldref:
52-
# fieldpath: metadata.namespace
53-
#- name: CERTIFICATE_NAME
54-
# objref:
55-
# kind: Certificate
56-
# group: cert-manager.io
57-
# version: v1alpha2
58-
# name: serving-cert # this name should match the one in certificate.yaml
59-
#- name: SERVICE_NAMESPACE # namespace of the service
60-
# objref:
61-
# kind: Service
62-
# version: v1
63-
# name: webhook-service
64-
# fieldref:
65-
# fieldpath: metadata.namespace
66-
#- name: SERVICE_NAME
67-
# objref:
68-
# kind: Service
69-
# version: v1
70-
# name: webhook-service
33+
- name: CERTIFICATE_NAMESPACE # namespace of the certificate CR
34+
objref:
35+
kind: Certificate
36+
group: cert-manager.io
37+
version: v1alpha2
38+
name: serving-cert # this name should match the one in certificate.yaml
39+
fieldref:
40+
fieldpath: metadata.namespace
41+
- name: CERTIFICATE_NAME
42+
objref:
43+
kind: Certificate
44+
group: cert-manager.io
45+
version: v1alpha2
46+
name: serving-cert # this name should match the one in certificate.yaml
47+
- name: SERVICE_NAMESPACE # namespace of the service
48+
objref:
49+
kind: Service
50+
version: v1
51+
name: webhook-service
52+
fieldref:
53+
fieldpath: metadata.namespace
54+
- name: SERVICE_NAME
55+
objref:
56+
kind: Service
57+
version: v1
58+
name: webhook-service

config/manager/manager.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,12 @@ spec:
2727
- /manager
2828
args:
2929
- --enable-leader-election
30-
image: controller:latest
30+
image: ghcr.io/coderanger/migrations-operator:latest
3131
name: manager
3232
resources:
3333
limits:
34-
cpu: 100m
35-
memory: 30Mi
34+
memory: 256M
3635
requests:
3736
cpu: 100m
38-
memory: 20Mi
37+
memory: 128M
3938
terminationGracePeriodSeconds: 10

config/rbac/role.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ metadata:
77
name: manager-role
88
rules:
99
- apiGroups:
10-
- ""
10+
- batch
1111
resources:
12-
- secrets
12+
- jobs
1313
verbs:
1414
- create
1515
- get
@@ -18,9 +18,9 @@ rules:
1818
- update
1919
- watch
2020
- apiGroups:
21-
- rabbitmq.coderanger.net
21+
- migrations.coderanger.net
2222
resources:
23-
- rabbitusers
23+
- migrators
2424
verbs:
2525
- create
2626
- delete
@@ -30,9 +30,9 @@ rules:
3030
- update
3131
- watch
3232
- apiGroups:
33-
- rabbitmq.coderanger.net
33+
- migrations.coderanger.net
3434
resources:
35-
- rabbitusers/status
35+
- migrators/status
3636
verbs:
3737
- get
3838
- patch

controllers/migrator.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ import (
2424
migrationsv1beta1 "github.com/coderanger/migrations-operator/api/v1beta1"
2525
)
2626

27-
// +kubebuilder:rbac:groups=rabbitmq.coderanger.net,resources=rabbitusers,verbs=get;list;watch;create;update;patch;delete
28-
// +kubebuilder:rbac:groups=rabbitmq.coderanger.net,resources=rabbitusers/status,verbs=get;update;patch
29-
// +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch;create;update;patch
27+
// +kubebuilder:rbac:groups=migrations.coderanger.net,resources=migrators,verbs=get;list;watch;create;update;patch;delete
28+
// +kubebuilder:rbac:groups=migrations.coderanger.net,resources=migrators/status,verbs=get;update;patch
29+
// +kubebuilder:rbac:groups=batch,resources=jobs,verbs=get;list;watch;create;update;patch
3030

3131
func Migrator(mgr ctrl.Manager) error {
3232
return cu.NewReconciler(mgr).

0 commit comments

Comments
 (0)