Skip to content

Commit

Permalink
Migrate to using kubebuilder. (open-policy-agent#41)
Browse files Browse the repository at this point in the history
* Migrate to using kubebuilder.

Note that the authorization server use case is a bit tricky as
kubebuilder assumes that the Kubernetes API Server is available.
To circumvent this, I kept a portion of the old webhook server
code to function as a standalone server.

Most of the new files are generated by kubebuilder, as is the
directory structure. This includes the Dockerfile and Makefile.

Also, secrets should be automatically generated by the server
and the webhooks automatically registered (in the non-standalone
case).

Apologies for the massive change but there wasn't a gradual way
to do this.

Signed-off-by: Max Smythe <[email protected]>

* Tweak Docker repo. Fix Flags.

Signed-off-by: Max Smythe <[email protected]>

* Fix location of video link in README.

Signed-off-by: Max Smythe <[email protected]>

* Fix newline spacing in README.

Signed-off-by: Max Smythe <[email protected]>
  • Loading branch information
maxsmythe authored and rite2nikhil committed Feb 1, 2019
1 parent d5df0ef commit a9d974f
Show file tree
Hide file tree
Showing 39 changed files with 2,151 additions and 969 deletions.
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@

# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
bin

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Kubernetes Generated files - skip generated files, except for vendored files

!vendor/**/zz_generated.*

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~

## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
Expand Down
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build the manager binary
FROM golang:1.10.3 as builder

# Copy in the go src
WORKDIR /go/src/github.com/open-policy-agent/kubernetes-policy-controller
COPY pkg/ pkg/
COPY cmd/ cmd/
COPY vendor/ vendor/

# Build
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager github.com/open-policy-agent/kubernetes-policy-controller/cmd/manager

# Copy the controller-manager into a thin image
FROM ubuntu:latest
WORKDIR /root/
COPY --from=builder /go/src/github.com/open-policy-agent/kubernetes-policy-controller/manager .
ENTRYPOINT ["./manager"]
Loading

0 comments on commit a9d974f

Please sign in to comment.