-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: PINCHON Benjamin <[email protected]>
- Loading branch information
0 parents
commit cf92b99
Showing
68 changed files
with
5,050 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file | ||
# Ignore build and test binaries. | ||
bin/ |
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,27 @@ | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
bin/* | ||
Dockerfile.cross | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Go workspace file | ||
go.work | ||
|
||
# Kubernetes Generated files - skip generated files, except for vendored files | ||
!vendor/**/zz_generated.* | ||
|
||
# editor and IDE paraphernalia | ||
.idea | ||
.vscode | ||
*.swp | ||
*.swo | ||
*~ |
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,40 @@ | ||
run: | ||
timeout: 5m | ||
allow-parallel-runners: true | ||
|
||
issues: | ||
# don't skip warning about doc comments | ||
# don't exclude the default set of lint | ||
exclude-use-default: false | ||
# restore some of the defaults | ||
# (fill in the rest as needed) | ||
exclude-rules: | ||
- path: "api/*" | ||
linters: | ||
- lll | ||
- path: "internal/*" | ||
linters: | ||
- dupl | ||
- lll | ||
linters: | ||
disable-all: true | ||
enable: | ||
- dupl | ||
- errcheck | ||
- exportloopref | ||
- goconst | ||
- gocyclo | ||
- gofmt | ||
- goimports | ||
- gosimple | ||
- govet | ||
- ineffassign | ||
- lll | ||
- misspell | ||
- nakedret | ||
- prealloc | ||
- staticcheck | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused |
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,83 @@ | ||
# Contributors guide | ||
|
||
**Want to contribute?** | ||
We try to make it easy, and all contributions, even the smaller ones, are more than welcome. | ||
This includes bug reports, fixes, documentation, examples... | ||
But first, read this page (including the small print at the end). | ||
|
||
Contributions are available on https://github.com/Orange-OpenSource/PowerDNS-Operator | ||
|
||
## Legal | ||
|
||
All original contributions to _PowerDNS-Operator_ are licensed under the | ||
[Apache License 2.0](https://spdx.org/licenses/Apache-2.0.html), | ||
|
||
All contributions are subject to the [Developer Certificate of Origin](https://developercertificate.org/) (DCO). | ||
The DCO is a lightweight way for contributors to certify that they wrote or otherwise have the right to submit the code they are contributing to the project. | ||
The DCO text is also included verbatim in the [DCO.txt](DCO.txt) file in the root directory of the repository. | ||
|
||
Contributors **must** _sign-off_ that they adhere to these requirements by adding a `Signed-off-by` line to commit messages, as shown below: | ||
|
||
```text | ||
This is the commit message | ||
Signed-off-by: Joe Dev <[email protected]> | ||
``` | ||
|
||
Git has a handy [`-s` command line option](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt---signoff) to append this automatically to your commit message: | ||
|
||
```bash | ||
$ git commit -s -m 'This is the commit message' | ||
``` | ||
|
||
## Reporting an issue | ||
|
||
This project uses Github issues to manage the issues. | ||
|
||
Before creating an issue: | ||
|
||
1. upgrade the operator to the latest supported release version, and check whether your bug is still present, | ||
2. ensure the operator version is supported by the PowerDNS version you are using, | ||
3. have a look in the opened issues if your problem is already known/tracked, and possibly contribute to the thread with your own information. | ||
|
||
If none of the above was met, open an issue directly in Github, select the appropriate issue template and fill-in each section when applicable. | ||
|
||
## Development environment setup | ||
cf. [Development environment setup](./DEV_SETUP.md) | ||
|
||
## Submitting a code change | ||
|
||
### Git Setup | ||
|
||
Before contributing, make sure you have set up your Git authorship correctly: | ||
|
||
```bash | ||
git config --global user.name "Your Full Name" | ||
git config --global user.email [email protected] | ||
``` | ||
|
||
### Workflow | ||
|
||
All submissions, including submissions by project members, need to be reviewed before being merged. | ||
|
||
To contribute: | ||
|
||
1. Create an issue describing the bug or enhancement you want to propose (select the right issue template). | ||
2. Make sure the issue has been reviewed and agreed. | ||
3. Create a pull Request, from your **own** fork (see [forking workflow](https://docs.github.com/en/get-started/quickstart/fork-a-repo) documentation). | ||
Don't hesitate to mark yourPMR as `Draft` as long as you think it's not ready to be reviewed. | ||
|
||
### Git Commit Conventions | ||
|
||
In addition to being signed-off according the [Developer Certificate of Origin](https://developercertificate.org/) (see above), | ||
Git commits in _PowerDNS-Operator_ shall be: | ||
|
||
1. **atomic** (1 commit `=` 1 and only 1 _thing_), | ||
2. **semantic** (using [semantic-release commit message syntax](https://semantic-release.gitbook.io/semantic-release/#commit-message-format)). | ||
3. **pattern** | ||
- **SCOPE**: one of (build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test, release) | ||
- **PACKAGE** _(optional)_: one of (zone, rrset, docs) | ||
- **Pattern**: SCOPE(PACKAGE): commit message, #issue_identifier | ||
- ```bash | ||
feat(zone): optimize zone reconcile, #51 | ||
``` |
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,108 @@ | ||
# Development Setup | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- go version v1.22.0+ | ||
- docker version v27.0.0+ | ||
- kubectl version v1.29+ | ||
- Access to a Kubernetes v1.29+ cluster. | ||
|
||
### Make Help | ||
|
||
Run `make help` for more information on all potential `make` targets | ||
|
||
### To develop localy | ||
|
||
**Install the CRDs into the cluster:** | ||
|
||
```sh | ||
make install | ||
``` | ||
|
||
**Run the controller locally and bind it to the PowerDNS API:** | ||
|
||
```sh | ||
export PDNS_API_URL=https://powerdns.example.local:8081 | ||
export PDNS_API_KEY=secret | ||
export PDNS_API_VHOST=localhost | ||
make run | ||
``` | ||
|
||
### To Deploy on the cluster | ||
**Build and push your image to the location specified by `IMG`:** | ||
|
||
```sh | ||
make docker-build docker-push IMG=<some-registry>/powerdns-operator:tag | ||
``` | ||
|
||
**NOTE:** This image ought to be published in the personal registry you specified. | ||
And it is required to have access to pull the image from the working environment. | ||
Make sure you have the proper permission to the registry if the above commands don’t work. | ||
|
||
**Install the CRDs into the cluster:** | ||
|
||
```sh | ||
make install | ||
``` | ||
|
||
**Deploy the Manager to the cluster with the image specified by `IMG`:** | ||
|
||
```sh | ||
make deploy IMG=<some-registry>/powerdns-operator:tag | ||
``` | ||
|
||
> **NOTE**: If you encounter RBAC errors, you may need to grant yourself cluster-admin | ||
privileges or be logged in as admin. | ||
|
||
**Create instances of your solution** | ||
You can apply the samples (examples) from the config/sample: | ||
|
||
```sh | ||
kubectl apply -k config/samples/ | ||
``` | ||
|
||
>**NOTE**: Ensure that the samples has default values to test it out. | ||
### To Uninstall | ||
**Delete the instances (CRs) from the cluster:** | ||
|
||
```sh | ||
kubectl delete -k config/samples/ | ||
``` | ||
|
||
**Delete the APIs(CRDs) from the cluster:** | ||
|
||
```sh | ||
make uninstall | ||
``` | ||
|
||
**UnDeploy the controller from the cluster:** | ||
|
||
```sh | ||
make undeploy | ||
``` | ||
|
||
## Project Distribution | ||
|
||
Following are the steps to build the installer and distribute this project to users. | ||
|
||
1. Build the installer for the image built and published in the registry: | ||
|
||
```sh | ||
make build-installer IMG=<some-registry>/powerdns-operator:tag | ||
``` | ||
|
||
NOTE: The makefile target mentioned above generates an 'install.yaml' | ||
file in the dist directory. This file contains all the resources built | ||
with Kustomize, which are necessary to install this project without | ||
its dependencies. | ||
|
||
2. Using the installer | ||
|
||
Users can just run kubectl apply -f <URL for YAML BUNDLE> to install the project, i.e.: | ||
|
||
```sh | ||
kubectl apply -f https://raw.githubusercontent.com/orange-opensource/powerdns-operator/<tag or branch>/dist/install.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,33 @@ | ||
# Build the manager binary | ||
FROM golang:1.22 AS builder | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
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 cmd/main.go cmd/main.go | ||
COPY api/ api/ | ||
COPY internal/controller/ internal/controller/ | ||
|
||
# Build | ||
# the GOARCH has not a default value to allow the binary be built according to the host where the command | ||
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO | ||
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore, | ||
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform. | ||
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/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/manager . | ||
USER 65532:65532 | ||
|
||
ENTRYPOINT ["/manager"] |
Oops, something went wrong.