Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syncing release 1.4 with internal repo #459

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
ff33d53
fix typo in document (#331)
ysam12345 Nov 15, 2023
4346533
Bump github.com/onsi/ginkgo/v2 from 2.12.1 to 2.13.0 (#322)
dependabot[bot] Nov 15, 2023
b94b068
Update VPC CNI version and force vulns check using latest go version …
haouc Nov 16, 2023
3a7c1e2
Bump github.com/onsi/gomega from 1.28.0 to 1.30.0 (#338)
dependabot[bot] Dec 1, 2023
3b2ee3d
Bump golang.org/x/time from 0.3.0 to 0.5.0 (#339)
dependabot[bot] Dec 1, 2023
f4a72cd
Bump github.com/prometheus/common from 0.44.0 to 0.45.0 (#337)
dependabot[bot] Dec 1, 2023
da4a300
update supported EC2 instances (#340)
haouc Dec 1, 2023
468eb44
Bump k8s.io/api from 0.28.3 to 0.28.4 (#336)
dependabot[bot] Dec 1, 2023
cd028ec
Add support to configure branch ENI cooldown period via configmap (#342)
sushrk Dec 7, 2023
91057be
manually update client-go in aligned with other dependencies (#341)
haouc Dec 7, 2023
5588773
fix the build issue
haouc Dec 8, 2023
af90f63
Update cooldown period in test (#344)
sushrk Dec 8, 2023
23dd415
update debugging doc (#349)
haouc Dec 22, 2023
31bfaa9
Bump github.com/google/uuid from 1.4.0 to 1.5.0 (#352)
dependabot[bot] Jan 2, 2024
7ee59cc
Bump github.com/aws/aws-sdk-go from 1.45.19 to 1.49.13 (#353)
dependabot[bot] Jan 2, 2024
9e88847
Bump github.com/prometheus/client_model (#354)
dependabot[bot] Jan 2, 2024
e95a9db
Bump github.com/samber/lo from 1.38.1 to 1.39.0 (#355)
dependabot[bot] Jan 2, 2024
25057d2
Bump github.com/aws/amazon-vpc-cni-k8s from 1.15.3 to 1.16.0 (#356)
dependabot[bot] Jan 2, 2024
e4ac94b
add data race detection in test (#357)
haouc Jan 3, 2024
88c4669
Update docs to add amazon-vpc-cni configmap options for SGPP and rela…
sushrk Jan 11, 2024
20c8069
add an node event example indicating cooldowm time windows has been u…
haouc Jan 12, 2024
acb1db7
update README to provide instructions to check its version (#361)
haouc Jan 18, 2024
ac00002
increase pod worker to 30 and update supported instance types list (#…
haouc Jan 30, 2024
296e1fd
Bump github.com/google/uuid from 1.5.0 to 1.6.0 (#364)
dependabot[bot] Feb 1, 2024
1fcce12
Bump k8s.io/client-go from 0.28.4 to 0.29.1 (#366)
dependabot[bot] Feb 1, 2024
59306ad
Bump github.com/prometheus/common from 0.45.0 to 0.46.0 (#367)
dependabot[bot] Feb 1, 2024
ee0d1ed
Bump github.com/onsi/gomega from 1.30.0 to 1.31.1 (#365)
dependabot[bot] Feb 1, 2024
4105de5
Bump sigs.k8s.io/controller-runtime from 0.16.3 to 0.17.0 (#363)
dependabot[bot] Feb 1, 2024
60d03c8
Increase windows test timeout (#368)
jchen6585 Feb 2, 2024
eab29a4
chore: migrate to kubebuilder v3 (#369)
sushrk Feb 6, 2024
f2c3e9b
rename windows flags (#371)
haouc Feb 20, 2024
604bc0b
fix: paginate DescribeNetworkInterfaces with deep filters (#375)
sushrk Feb 29, 2024
e4b7426
Bump github.com/aws/aws-sdk-go from 1.49.13 to 1.50.29 (#380)
dependabot[bot] Mar 1, 2024
0df4b12
Bump k8s.io/client-go from 0.29.1 to 0.29.2 (#377)
dependabot[bot] Mar 1, 2024
9a65750
Bump github.com/prometheus/common from 0.46.0 to 0.49.0 (#378)
dependabot[bot] Mar 1, 2024
b68a68d
Repo controlled build go version (#381)
xdu31 Mar 5, 2024
a86f654
update golang version (#383)
sushrk Mar 13, 2024
7affbf5
update protobuf to 1.33.0 (#387)
haouc Mar 19, 2024
b2c8c68
pin envtest version due to an upstream bug (#390)
haouc Mar 27, 2024
3b461d8
Bump k8s.io/client-go from 0.29.2 to 0.29.3 (#392)
dependabot[bot] Apr 1, 2024
e50d431
Bump github.com/aws/amazon-vpc-cni-k8s from 1.16.0 to 1.17.1 (#393)
dependabot[bot] Apr 1, 2024
861ab3e
Bump github.com/prometheus/common from 0.49.0 to 0.51.1 (#395)
dependabot[bot] Apr 2, 2024
384e4ad
Bump github.com/aws/aws-sdk-go from 1.50.29 to 1.51.12 (#397)
dependabot[bot] Apr 2, 2024
51ff604
add github action to run gosec static analysis (#398)
sushrk Apr 3, 2024
668273d
update golang and dependency to fix CVE (#401)
sushrk Apr 4, 2024
8bdd3b1
revert pagination and call DescribeNetworkInterfaces with vpcID or su…
sushrk Apr 4, 2024
db8ccee
update EC2 supported instance types (#402)
haouc Apr 4, 2024
11f8292
add finalizer handler in v1.4
haouc Jul 13, 2024
8e0b7c7
fix an err variable
haouc Aug 2, 2024
47bb479
adding logs for mismatched CNINode
haouc Aug 2, 2024
8eb3b40
add metrics for mismatches
haouc Aug 2, 2024
a40fef5
update EC2 instance types
haouc Aug 3, 2024
1c5b720
updating go version to 1.22 and controller gen version to 1.14.0
yash97 Aug 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/presubmit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,29 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go Version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: "**/go.sum"
- name: Install `govulncheck`
run: go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run `govulncheck`
run: ~/go/bin/govulncheck ./...
static-security-analysis:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go Version
run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: "**/go.sum"
- name: Install `gosec`
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Run Gosec Security Scanner
run: ~/go/bin/gosec -exclude-dir test -exclude-generated -severity medium -exclude=G108,G114 ./...

1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.22.5
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG BASE_IMAGE
ARG BUILD_IMAGE
ARG ARCH=amd64
ARG ARCH
# Build the controller binary
FROM $BUILD_IMAGE as builder

Expand All @@ -24,17 +24,18 @@ COPY webhooks/ webhooks/

# Version package for passing the ldflags
ENV VERSION_PKG=github.com/aws/amazon-vpc-resource-controller-k8s/pkg/version
ENV GOARCH $ARCH
# Build
RUN GIT_VERSION=$(git describe --tags --always) && \
GIT_COMMIT=$(git rev-parse HEAD) && \
BUILD_DATE=$(date +%Y-%m-%dT%H:%M:%S%z) && \
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=on go build \
CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build \
-ldflags="-X ${VERSION_PKG}.GitVersion=${GIT_VERSION} -X ${VERSION_PKG}.GitCommit=${GIT_COMMIT} -X ${VERSION_PKG}.BuildDate=${BUILD_DATE}" -a -o controller main.go

FROM $BASE_IMAGE

WORKDIR /
COPY --from=public.ecr.aws/eks-distro/kubernetes/go-runner:v0.9.0-eks-1-21-4 /usr/local/bin/go-runner /usr/local/bin/go-runner
COPY --from=public.ecr.aws/eks-distro/kubernetes/go-runner:v0.15.0-eks-1-27-3 /go-runner /usr/local/bin/go-runner
COPY --from=builder /workspace/controller .

ENTRYPOINT ["/controller"]
16 changes: 10 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ MAKEFILE_PATH = $(dir $(realpath -s $(firstword $(MAKEFILE_LIST))))
VERSION ?= $(GIT_VERSION)
IMAGE ?= $(REPO):$(VERSION)
BASE_IMAGE ?= public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:latest.2
BUILD_IMAGE ?= public.ecr.aws/bitnami/golang:1.21.3
GOLANG_VERSION ?= $(shell cat .go-version)
BUILD_IMAGE ?= public.ecr.aws/bitnami/golang:$(GOLANG_VERSION)
GOARCH ?= amd64
PLATFORM ?= linux/amd64

export GOSUMDB = sum.golang.org
export GOTOOLCHAIN = go$(GOLANG_VERSION)

help: ## Display help
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

Expand All @@ -28,7 +32,7 @@ verify:
go generate ./...
go vet ./...
go fmt ./...
controller-gen crd:trivialVersions=true rbac:roleName=controller-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
controller-gen crd rbac:roleName=controller-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases
controller-gen object:headerFile="scripts/templates/boilerplate.go.txt" paths="./..."
@git diff --quiet ||\
{ echo "New file modification detected in the Git working tree. Please check in before commit."; git --no-pager diff --name-only | uniq | awk '{print " - " $$0}'; \
Expand All @@ -38,7 +42,7 @@ verify:

## Run unit tests
test: verify
go test ./pkg/... ./controllers/... ./webhooks/... -coverprofile cover.out
go test -race ./pkg/... ./controllers/... ./webhooks/... -coverprofile cover.out

test-e2e:
KUBE_CONFIG_PATH=${KUBE_CONFIG_PATH} REGION=${AWS_REGION} CLUSTER_NAME=${CLUSTER_NAME} ./scripts/test/run-integration-tests.sh
Expand All @@ -50,7 +54,7 @@ toolchain: ## Install developer toolchain
./hack/toolchain.sh

apply: image check-deployment-env check-env ## Deploy controller to ~/.kube/config
eksctl create iamserviceaccount vpc-resource-controller --namespace kube-system --cluster ${CLUSTER_NAME} \
eksctl create iamserviceaccount vpc-resource-controller --namespace kube-system --cluster ${CLUSTER_NAME} --region ${AWS_REGION} \
--role-name VPCResourceControllerRole \
--attach-policy-arn=arn:aws:iam::aws:policy/AdministratorAccess \
--override-existing-serviceaccounts \
Expand All @@ -63,7 +67,7 @@ apply: image check-deployment-env check-env ## Deploy controller to ~/.kube/conf

delete: ## Delete controller from ~/.kube/config
kustomize build config/default | kubectl delete --ignore-not-found -f -
eksctl delete iamserviceaccount vpc-resource-controller --namespace kube-system --cluster ${CLUSTER_NAME}
eksctl delete iamserviceaccount vpc-resource-controller --namespace kube-system --cluster ${CLUSTER_NAME} --region ${AWS_REGION}
kubectl patch rolebinding eks-vpc-resource-controller-rolebinding -n kube-system --patch '{"subjects":[{"kind":"ServiceAccount","name":"eks-vpc-resource-controller","namespace":"kube-system"},{"apiGroup":"rbac.authorization.k8s.io","kind":"User","name":"eks:vpc-resource-controller"}]}'
kubectl create clusterrolebinding vpc-resource-controller-rolebinding --clusterrole vpc-resource-controller-role --serviceaccount kube-system:eks-vpc-resource-controller --user eks:vpc-resource-controller

Expand All @@ -73,7 +77,7 @@ docker-buildx: check-env test

# Build the docker image
docker-build: check-env test
docker build --build-arg BASE_IMAGE=$(BASE_IMAGE) --build-arg BUILD_IMAGE=$(BUILD_IMAGE) . -t ${IMAGE}
docker build --build-arg BASE_IMAGE=$(BASE_IMAGE) --build-arg ARCH=$(GOARCH) --build-arg BUILD_IMAGE=$(BUILD_IMAGE) . -t ${IMAGE}

# Push the docker image
docker-push: check-env
Expand Down
23 changes: 21 additions & 2 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
# Code generated by tool. DO NOT EDIT.
# This file is used to track the info used to scaffold your project
# and allow the plugins properly work.
# More info: https://book.kubebuilder.io/reference/project-config.html
domain: k8s.aws
layout:
- go.kubebuilder.io/v3
multigroup: true
projectName: amazon-vpc-resource-controller-k8s
repo: github.com/aws/amazon-vpc-resource-controller-k8s
resources:
- group: vpcresources
- api:
crdVersion: v1
namespaced: true
domain: k8s.aws
group: vpcresources
kind: SecurityGroupPolicy
path: github.com/aws/amazon-vpc-resource-controller-k8s/apis/v1beta1
version: v1beta1
version: "2"
- api:
crdVersion: v1
domain: k8s.aws
group: vpcresources
kind: CNINode
path: github.com/aws/amazon-vpc-resource-controller-k8s/apis/v1alpha1
version: v1alpha1
version: "3"
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

Controller running on EKS Control Plane for managing Branch & Trunk Network Interface for [Kubernetes Pod](https://kubernetes.io/docs/concepts/workloads/pods/) using the [Security Group for Pod](https://docs.aws.amazon.com/eks/latest/userguide/security-groups-for-pods.html) feature and IPv4 Address Management(IPAM) of [Windows Nodes](https://docs.aws.amazon.com/eks/latest/userguide/windows-support.html).

The controller broadcasts its version to nodes. Describing any node will provide the version information in node `Events`. The mapping between the controller's version and the cluster's platform version is also available in release notes.

## Security Group for Pods

The controller only manages the Trunk/Branch Network Interface for EKS Cluster using the Security Group for Pods feature. The Networking on the host is setup by [amazon-vpc-cni-k8s](https://github.com/aws/amazon-vpc-cni-k8s) plugin.
Expand Down Expand Up @@ -40,6 +42,10 @@ The controller supports the following modes for IPv4 address management on Windo

Please follow this [guide](https://docs.aws.amazon.com/eks/latest/userguide/windows-support.html) for enabling Windows Support on your EKS cluster.

## Configuring the controller via amazon-vpc-cni configmap

The controller supports various configuration options for managing security groups for pods and Windows nodes which can be set via the EKS-managed configmap `amazon-vpc-cni`. For more details, refer to the security group for pods configuration options [here](docs/sgp/sgp_config_options.md) and Windows IPAM/PD related configuration options [here](docs/windows/prefix_delegation_config_options.md)

## Troubleshooting
For troubleshooting issues related to Security group for pods or Windows IPv4 address management, please visit our troubleshooting guide [here](docs/troubleshooting.md).

Expand Down
3 changes: 1 addition & 2 deletions apis/vpcresources/v1alpha1/cninode_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ type CNINodeSpec struct {

// CNINodeStatus defines the managed VPC resources.
type CNINodeStatus struct {
//TODO: add VPS resources which will be managed by this CRD and its finalizer

//TODO: add VPC resources which will be managed by this CRD and its finalizer
}

// +kubebuilder:object:root=true
Expand Down
1 change: 0 additions & 1 deletion apis/vpcresources/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion apis/vpcresources/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions config/controller/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ spec:
- args:
- --cluster-name=CLUSTER_NAME
- --role-arn=USER_ROLE_ARN
- --enable-leader-election
- --metrics-addr=:8443
- --leader-elect
- --metrics-bind-address=:8443
image: controller:latest
name: controller
resources:
Expand Down
32 changes: 15 additions & 17 deletions config/crd/bases/vpcresources.k8s.aws_cninodes.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
controller-gen.kubebuilder.io/version: v0.14.0
name: cninodes.vpcresources.k8s.aws
spec:
group: vpcresources.k8s.aws
Expand All @@ -28,20 +26,26 @@ spec:
openAPIV3Schema:
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: 'Important: Run "make" to regenerate code after modifying
this file CNINodeSpec defines the desired state of CNINode'
description: |-
Important: Run "make" to regenerate code after modifying this file
CNINodeSpec defines the desired state of CNINode
properties:
features:
items:
Expand All @@ -65,9 +69,3 @@ spec:
served: true
storage: true
subresources: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
Loading
Loading