Skip to content

Commit 35a3035

Browse files
authored
Merge pull request #28 from fluxcd/toolkit-compatibility
Towards Toolkit compatibility
2 parents fb26178 + 38b4eb2 commit 35a3035

File tree

6 files changed

+159
-132
lines changed

6 files changed

+159
-132
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
restore-keys: |
2121
${{ runner.os }}-go-
2222
- name: Set up Go
23-
uses: actions/setup-go@v2-beta
23+
uses: actions/setup-go@v2
2424
with:
25-
go-version: 1.14.x
25+
go-version: 1.15.x
2626
- name: Set up kubebuilder
2727
# TODO replace with ../pkg/.. when that's merged
2828
uses: fluxcd/pkg/actions/[email protected]

Dockerfile

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Build the manager binary
2-
FROM golang:1.14 as builder
1+
FROM golang:1.15-alpine as builder
32

43
WORKDIR /workspace
54
# Copy the Go Modules manifests
@@ -16,13 +15,22 @@ COPY pkg/ pkg/
1615
COPY controllers/ controllers/
1716

1817
# Build
19-
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o manager main.go
18+
RUN CGO_ENABLED=0 go build -a -o image-automation-controller main.go
2019

21-
# Use distroless as minimal base image to package the manager binary
22-
# Refer to https://github.com/GoogleContainerTools/distroless for more details
23-
FROM gcr.io/distroless/static:nonroot
24-
WORKDIR /
25-
COPY --from=builder /workspace/manager .
26-
USER nonroot:nonroot
20+
FROM alpine:3.12
2721

28-
ENTRYPOINT ["/manager"]
22+
LABEL org.opencontainers.image.source="https://github.com/fluxcd/image-automation-controller"
23+
24+
RUN apk add --no-cache ca-certificates tini
25+
26+
COPY --from=builder /workspace/image-automation-controller /usr/local/bin/
27+
28+
# Create minimal nsswitch.conf file to prioritize the usage of /etc/hosts over DNS queries.
29+
# https://github.com/gliderlabs/docker-alpine/issues/367#issuecomment-354316460
30+
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
31+
32+
RUN addgroup -S controller && adduser -S -g controller controller
33+
34+
USER controller
35+
36+
ENTRYPOINT [ "/sbin/tini", "--", "image-automation-controller" ]

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
# Image URL to use all building/pushing image targets
33
IMG ?= fluxcd/image-automation-controller
4-
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
5-
CRD_OPTIONS ?= "crd:trivialVersions=true"
4+
# Produce CRDs that work back to Kubernetes 1.16
5+
CRD_OPTIONS ?= crd:crdVersions=v1
66

77
# Version of the Toolkit from which to get CRDs. Change this if you
88
# bump the go module version.

config/crd/bases/image.toolkit.fluxcd.io_imageupdateautomations.yaml

Lines changed: 107 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,129 @@
11

22
---
3-
apiVersion: apiextensions.k8s.io/v1beta1
3+
apiVersion: apiextensions.k8s.io/v1
44
kind: CustomResourceDefinition
55
metadata:
66
annotations:
77
controller-gen.kubebuilder.io/version: v0.3.0
88
creationTimestamp: null
99
name: imageupdateautomations.image.toolkit.fluxcd.io
1010
spec:
11-
additionalPrinterColumns:
12-
- JSONPath: .status.lastAutomationRunTime
13-
name: Last run
14-
type: string
1511
group: image.toolkit.fluxcd.io
1612
names:
1713
kind: ImageUpdateAutomation
1814
listKind: ImageUpdateAutomationList
1915
plural: imageupdateautomations
2016
singular: imageupdateautomation
2117
scope: Namespaced
22-
subresources:
23-
status: {}
24-
validation:
25-
openAPIV3Schema:
26-
description: ImageUpdateAutomation is the Schema for the imageupdateautomations
27-
API
28-
properties:
29-
apiVersion:
30-
description: 'APIVersion defines the versioned schema of this representation
31-
of an object. Servers should convert recognized schemas to the latest
32-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
33-
type: string
34-
kind:
35-
description: 'Kind is a string value representing the REST resource this
36-
object represents. Servers may infer this from the endpoint the client
37-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
38-
type: string
39-
metadata:
40-
type: object
41-
spec:
42-
description: ImageUpdateAutomationSpec defines the desired state of ImageUpdateAutomation
43-
properties:
44-
checkout:
45-
description: Checkout gives the parameters for cloning the git repository,
46-
ready to make changes.
47-
properties:
48-
branch:
49-
description: Branch gives the branch to clone from the git repository.
50-
If missing, it will be left to default; be aware this may give
51-
indeterminate results.
52-
type: string
53-
gitRepositoryRef:
54-
description: GitRepositoryRef refers to the resource giving access
55-
details to a git repository to update files in.
56-
properties:
57-
name:
58-
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
59-
TODO: Add other useful fields. apiVersion, kind, uid?'
60-
type: string
61-
type: object
62-
required:
63-
- gitRepositoryRef
64-
type: object
65-
commit:
66-
description: Commit specifies how to commit to the git repo
67-
properties:
68-
authorEmail:
69-
description: AuthorEmail gives the email to provide when making
70-
a commit
71-
type: string
72-
authorName:
73-
description: AuthorName gives the name to provide when making a
74-
commit
75-
type: string
76-
messageTemplate:
77-
description: MessageTemplate provides a template for the commit
78-
message, into which will be interpolated the details of the change
79-
made.
80-
type: string
81-
required:
82-
- authorEmail
83-
- authorName
84-
type: object
85-
minimumRunInterval:
86-
description: RunInterval gives a lower bound for how often the automation
87-
run should be attempted. Otherwise it will default.
88-
type: string
89-
update:
90-
description: Update gives the specification for how to update the files
91-
in the repository
92-
properties:
93-
setters:
94-
description: Setters if present means update workloads using setters,
95-
via fields marked in the files themselves.
96-
properties:
97-
paths:
98-
description: Paths gives all paths that should be subject to
99-
updates using setters. If missing, the path `.` (the root
100-
of the git repository) is assumed.
101-
items:
102-
type: string
103-
type: array
104-
type: object
105-
type: object
106-
required:
107-
- checkout
108-
- commit
109-
- update
110-
type: object
111-
status:
112-
description: ImageUpdateAutomationStatus defines the observed state of ImageUpdateAutomation
113-
properties:
114-
lastAutomationRunTime:
115-
description: LastAutomationRunTime records the last time the controller
116-
ran this automation through to completion (even if no updates were
117-
made).
118-
format: date-time
119-
type: string
120-
type: object
121-
type: object
122-
version: v1alpha1
12318
versions:
124-
- name: v1alpha1
19+
- additionalPrinterColumns:
20+
- jsonPath: .status.lastAutomationRunTime
21+
name: Last run
22+
type: string
23+
name: v1alpha1
24+
schema:
25+
openAPIV3Schema:
26+
description: ImageUpdateAutomation is the Schema for the imageupdateautomations
27+
API
28+
properties:
29+
apiVersion:
30+
description: 'APIVersion defines the versioned schema of this representation
31+
of an object. Servers should convert recognized schemas to the latest
32+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
33+
type: string
34+
kind:
35+
description: 'Kind is a string value representing the REST resource this
36+
object represents. Servers may infer this from the endpoint the client
37+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
38+
type: string
39+
metadata:
40+
type: object
41+
spec:
42+
description: ImageUpdateAutomationSpec defines the desired state of ImageUpdateAutomation
43+
properties:
44+
checkout:
45+
description: Checkout gives the parameters for cloning the git repository,
46+
ready to make changes.
47+
properties:
48+
branch:
49+
description: Branch gives the branch to clone from the git repository.
50+
If missing, it will be left to default; be aware this may give
51+
indeterminate results.
52+
type: string
53+
gitRepositoryRef:
54+
description: GitRepositoryRef refers to the resource giving access
55+
details to a git repository to update files in.
56+
properties:
57+
name:
58+
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
59+
TODO: Add other useful fields. apiVersion, kind, uid?'
60+
type: string
61+
type: object
62+
required:
63+
- gitRepositoryRef
64+
type: object
65+
commit:
66+
description: Commit specifies how to commit to the git repo
67+
properties:
68+
authorEmail:
69+
description: AuthorEmail gives the email to provide when making
70+
a commit
71+
type: string
72+
authorName:
73+
description: AuthorName gives the name to provide when making
74+
a commit
75+
type: string
76+
messageTemplate:
77+
description: MessageTemplate provides a template for the commit
78+
message, into which will be interpolated the details of the
79+
change made.
80+
type: string
81+
required:
82+
- authorEmail
83+
- authorName
84+
type: object
85+
minimumRunInterval:
86+
description: RunInterval gives a lower bound for how often the automation
87+
run should be attempted. Otherwise it will default.
88+
type: string
89+
update:
90+
description: Update gives the specification for how to update the
91+
files in the repository
92+
properties:
93+
setters:
94+
description: Setters if present means update workloads using setters,
95+
via fields marked in the files themselves.
96+
properties:
97+
paths:
98+
description: Paths gives all paths that should be subject
99+
to updates using setters. If missing, the path `.` (the
100+
root of the git repository) is assumed.
101+
items:
102+
type: string
103+
type: array
104+
type: object
105+
type: object
106+
required:
107+
- checkout
108+
- commit
109+
- update
110+
type: object
111+
status:
112+
description: ImageUpdateAutomationStatus defines the observed state of
113+
ImageUpdateAutomation
114+
properties:
115+
lastAutomationRunTime:
116+
description: LastAutomationRunTime records the last time the controller
117+
ran this automation through to completion (even if no updates were
118+
made).
119+
format: date-time
120+
type: string
121+
type: object
122+
type: object
125123
served: true
126124
storage: true
125+
subresources:
126+
status: {}
127127
status:
128128
acceptedNames:
129129
kind: ""

config/manager/kustomization.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
resources:
2-
- manager.yaml
31
apiVersion: kustomize.config.k8s.io/v1beta1
42
kind: Kustomization
3+
resources:
4+
- manager.yaml
55
images:
66
- name: controller
77
newName: fluxcd/image-automation-controller

config/manager/manager.yaml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: image-automation-controller
55
labels:
6-
control-plane: controller-manager
6+
control-plane: controller
77
spec:
88
selector:
99
matchLabels:
@@ -13,19 +13,38 @@ spec:
1313
metadata:
1414
labels:
1515
app: image-automation-controller
16+
annotations:
17+
prometheus.io/scrape: "true"
18+
prometheus.io/port: "8080"
1619
spec:
20+
terminationGracePeriodSeconds: 10
1721
containers:
18-
- command:
19-
- /manager
22+
- name: manager
23+
image: fluxcd/image-automation-controller
24+
imagePullPolicy: IfNotPresent
25+
securityContext:
26+
allowPrivilegeEscalation: false
27+
readOnlyRootFilesystem: true
28+
ports:
29+
- containerPort: 8080
30+
name: http-prom
31+
env:
32+
- name: RUNTIME_NAMESPACE
33+
valueFrom:
34+
fieldRef:
35+
fieldPath: metadata.namespace
2036
args:
2137
- --enable-leader-election
22-
image: fluxcd/image-automation-controller
23-
name: manager
2438
resources:
2539
limits:
26-
cpu: 100m
27-
memory: 30Mi
40+
cpu: 1000m
41+
memory: 1Gi
2842
requests:
2943
cpu: 100m
30-
memory: 20Mi
31-
terminationGracePeriodSeconds: 10
44+
memory: 64Mi
45+
volumeMounts:
46+
- name: temp
47+
mountPath: /tmp
48+
volumes:
49+
- name: temp
50+
emptyDir: {}

0 commit comments

Comments
 (0)