Skip to content

Commit cef7613

Browse files
committed
Initial commit - PoC version
0 parents  commit cef7613

File tree

72 files changed

+3919
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+3919
-0
lines changed

Diff for: .github/ISSUE_TEMPLATE/bug.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: Bug
3+
about: For when something is there, but doesn't work how it should
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
### Community Note
11+
12+
<!--- Please keep this note for the community --->
13+
14+
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
15+
to the original issue to help the community and maintainers prioritize this request
16+
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do
17+
not help prioritize the request
18+
* If you are interested in working on this issue or have submitted a pull request, please leave a comment.
19+
20+
### Debug Output
21+
22+
<!---
23+
Please provide a link to a GitHub Gist containing the complete debug output. Please do NOT paste the debug output in the issue; just paste a link to the Gist.
24+
25+
Note: the debug log may contain sensitive data so please check beforehand and remove it.
26+
--->
27+
28+
### Panic Output
29+
30+
<!--- If GKE Policy Automation tool produced a panic, please provide a link to a GitHub Gist containing panic output log --->
31+
32+
### Steps to Reproduce
33+
34+
<!--- Please list the steps required to reproduce the issue. --->
35+
36+
### Expected Behavior
37+
38+
<!--- What should have happened? --->
39+
40+
### Actual Behavior
41+
42+
<!--- What actually happened? --->
43+
44+
### References
45+
46+
<!---
47+
Information about referencing Github Issues: https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests
48+
49+
Are there any other GitHub issues (open or closed) or pull requests that should be linked here? Vendor documentation? For example:
50+
--->
51+
52+
* #0000

Diff for: .github/ISSUE_TEMPLATE/enhancement.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Enhancement
3+
about: For when something (a resource, field, etc.) is missing, and should be added.
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
### Community Note
11+
12+
<!--- Please keep this note for the community --->
13+
14+
* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)
15+
to the original issue to help the community and maintainers prioritize this request
16+
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do
17+
not help prioritize the request
18+
* If you are interested in working on this issue or have submitted a pull request, please leave a comment.
19+
20+
### Description
21+
22+
<!--- Please leave a helpful description of the feature request here. Including use cases and why it would help you is a great way to convince maintainers to spend time on it. --->
23+
24+
### References
25+
26+
<!---
27+
Information about referencing Github Issues: https://help.github.com/articles/basic-writing-and-formatting-syntax/#referencing-issues-and-pull-requests
28+
29+
Are there any other GitHub issues (open or closed) or pull requests that should be linked here? Vendor blog posts or documentation?
30+
--->
31+
32+
* #0000

Diff for: .github/ISSUE_TEMPLATE/question.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
name: Question
3+
about: If you have a question, please check out our community resources!
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
---
11+
12+
Issues on GitHub are intended to be related to bugs or feature requests with provider codebase,
13+
so we recommend using our other community resources instead of asking here 👍.

Diff for: .github/workflows/build.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Build
16+
on:
17+
push:
18+
branches:
19+
- main
20+
pull_request:
21+
branches:
22+
- main
23+
24+
jobs:
25+
build:
26+
name: Build
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
- name: Setup Go
32+
uses: actions/setup-go@v3
33+
with:
34+
go-version: '1.20'
35+
check-latest: true
36+
- name: Get dependencies
37+
run: go mod download
38+
- name: Build
39+
run: make build
40+
- name: Test
41+
run: |
42+
make test
43+
make vet
44+
- name: Lint
45+
uses: dominikh/[email protected]
46+
with:
47+
version: "2023.1.3"
48+
install-go: false

Diff for: .gitignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Output of the go coverage tool, specifically when used with LiteIDE
15+
*.out
16+
17+
# Dependency directories (remove the comment below to include it)
18+
# vendor/
19+
20+
# Go workspace file
21+
go.work
22+
23+
bin/

Diff for: CONTRIBUTING.md

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# How to Contribute
2+
3+
We'd love to accept your patches and contributions to this project. There are
4+
just a few small guidelines you need to follow.
5+
6+
## Contributor License Agreement
7+
8+
Contributions to this project must be accompanied by a Contributor License
9+
Agreement. You (or your employer) retain the copyright to your contribution;
10+
this simply gives us permission to use and redistribute your contributions as
11+
part of the project. Head over to <https://cla.developers.google.com/> to see
12+
your current agreements on file or to sign a new one.
13+
14+
You generally only need to submit a CLA once, so if you've already submitted one
15+
(even if it was for a different project), you probably don't need to do it
16+
again.
17+
18+
## Code Reviews
19+
20+
All submissions, including submissions by project members, require review. We
21+
use GitHub pull requests for this purpose. Consult
22+
[GitHub Help](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests/)
23+
for more information on using pull requests.
24+
25+
## Community Guidelines
26+
27+
This project follows [Google's Open Source Community
28+
Guidelines](https://opensource.google/conduct/).

Diff for: DEVELOPMENT.md

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# kube-startup-cpu-boost development guide
2+
3+
## Running development cluster
4+
5+
You can use [KIND](https://github.com/kubernetes-sigs/kind) to get a local cluster for development.
6+
7+
```sh
8+
cat <<EOF > kind-poc-cluster.yaml
9+
kind: Cluster
10+
apiVersion: kind.x-k8s.io/v1alpha4
11+
name: poc
12+
nodes:
13+
- role: control-plane
14+
- role: worker
15+
- role: worker
16+
featureGates:
17+
InPlacePodVerticalScaling: true
18+
EOF
19+
kind create cluster --config kind-poc-cluster.yaml
20+
```
21+
22+
## Deploying development version
23+
24+
1. Install CRDs on a cluster
25+
26+
```sh
27+
make install
28+
```
29+
30+
2. Build docker image
31+
32+
```sh
33+
make docker-build IMG=kube-startup-cpu-boost:dev
34+
```
35+
36+
3. Load docker image to development cluster
37+
38+
```sh
39+
kind load docker-image --name poc kube-startup-cpu-boost:dev
40+
```
41+
42+
4. Deploy controller on a cluster
43+
44+
```sh
45+
make deploy IMG=docker.io/library/kube-startup-cpu-boost:dev
46+
```

Diff for: Dockerfile

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2023 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Build the manager binary
16+
FROM golang:1.20 as builder
17+
ARG TARGETOS
18+
ARG TARGETARCH
19+
20+
WORKDIR /workspace
21+
# Copy the Go Modules manifests
22+
COPY go.mod go.mod
23+
COPY go.sum go.sum
24+
# cache deps before building and copying source so that we don't need to re-download as much
25+
# and so that source changes don't invalidate our downloaded layer
26+
RUN go mod download
27+
28+
# Copy the go source
29+
COPY cmd/main.go cmd/main.go
30+
COPY api/ api/
31+
COPY internal/boost/ internal/boost/
32+
COPY internal/controller/ internal/controller/
33+
COPY internal/util/ internal/util/
34+
COPY internal/webhook/ internal/webhook/
35+
36+
# Build
37+
# the GOARCH has not a default value to allow the binary be built according to the host where the command
38+
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
39+
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
40+
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
41+
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go
42+
43+
# Use distroless as minimal base image to package the manager binary
44+
# Refer to https://github.com/GoogleContainerTools/distroless for more details
45+
FROM gcr.io/distroless/static:nonroot
46+
WORKDIR /
47+
COPY --from=builder /workspace/manager .
48+
USER 65532:65532
49+
50+
ENTRYPOINT ["/manager"]

0 commit comments

Comments
 (0)