This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into json-fields
- Loading branch information
Showing
56 changed files
with
2,296 additions
and
243 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
SHELL = /bin/bash | ||
|
||
V = 0 | ||
Q = $(if $(filter 1,$V),,@) | ||
|
||
.PHONY: all | ||
all: | ||
$(Q) cd generator && make all | ||
$(Q) cd generated && make all | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Build the manager binary | ||
FROM golang:1.13.15 as builder | ||
|
||
WORKDIR /workspace | ||
|
||
# Copy the Go Modules manifests | ||
COPY go.mod go.mod | ||
COPY go.sum go.sum | ||
# cache deps before building and copying source so that we don't need to re-download as much | ||
# and so that source changes don't invalidate our downloaded layer | ||
RUN go mod download | ||
|
||
# Copy the go source | ||
# COPY . ./ | ||
COPY main.go main.go | ||
COPY apis/ apis/ | ||
COPY controllers/ controllers/ | ||
COPY pkg/ pkg/ | ||
|
||
# Build | ||
# TODO: Use Makefile here -- right now it's awkward to do so because: | ||
# 1. tools.mk is required for the makefile from the above directory, but Dockerfile can only look in its directory and below. | ||
# 2. Having Dockerfile here but building it from above could work except that there's another Dockerfile and a .dockerignore | ||
# up above that break things. For now we just build by hand | ||
# RUN make build | ||
|
||
# TODO: Do we want CGO_ENALBED=0 and the other options below in the makefile? | ||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o k8sinfra-controller main.go | ||
|
||
# Use distroless as minimal base image to package the manager binary | ||
# Refer to https://github.com/GoogleContainerTools/distroless for more details | ||
FROM gcr.io/distroless/static:nonroot | ||
WORKDIR / | ||
COPY --from=builder /workspace/k8sinfra-controller . | ||
USER nonroot:nonroot | ||
ENTRYPOINT ["/k8sinfra-controller"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resources: | ||
- manager.yaml | ||
|
||
patchesStrategicMerge: | ||
- manager_auth_proxy_patch.yaml | ||
- manager_image_patch.yaml | ||
- manager_pull_policy.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
labels: | ||
control-plane: controller-manager | ||
name: system | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller-manager | ||
namespace: system | ||
labels: | ||
control-plane: controller-manager | ||
spec: | ||
selector: | ||
matchLabels: | ||
control-plane: controller-manager | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
control-plane: controller-manager | ||
spec: | ||
containers: | ||
- # command: | ||
# - /manager | ||
args: | ||
- --enable-leader-election | ||
image: controller:latest | ||
name: manager | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 512Mi | ||
requests: | ||
cpu: 200m | ||
memory: 256Mi | ||
terminationGracePeriodSeconds: 10 |
25 changes: 25 additions & 0 deletions
25
hack/generated/config/manager/manager_auth_proxy_patch.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# This patch inject a sidecar container which is a HTTP proxy for the controller manager, | ||
# it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews. | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller-manager | ||
namespace: system | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: kube-rbac-proxy | ||
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.4.1 | ||
args: | ||
- "--secure-listen-address=0.0.0.0:8443" | ||
- "--upstream=http://127.0.0.1:8080/" | ||
- "--logtostderr=true" | ||
- "--v=10" | ||
ports: | ||
- containerPort: 8443 | ||
name: https | ||
- name: manager | ||
args: | ||
- "--metrics-addr=127.0.0.1:8080" | ||
- "--enable-leader-election" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: controller-manager | ||
namespace: system | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
# Change the value of image field below to your controller image URL | ||
- image: kind-registry:5000/fake/k8s-infra-controller:latest | ||
name: manager | ||
env: | ||
- name: AZURE_CLIENT_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: k8sinfra-controller-settings | ||
key: AZURE_CLIENT_ID | ||
- name: AZURE_CLIENT_SECRET | ||
valueFrom: | ||
secretKeyRef: | ||
name: k8sinfra-controller-settings | ||
key: AZURE_CLIENT_SECRET | ||
- name: AZURE_TENANT_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: k8sinfra-controller-settings | ||
key: AZURE_TENANT_ID | ||
- name: AZURE_SUBSCRIPTION_ID | ||
valueFrom: | ||
secretKeyRef: | ||
name: k8sinfra-controller-settings | ||
key: AZURE_SUBSCRIPTION_ID |
Oops, something went wrong.