Skip to content

Commit bbad908

Browse files
yash97haoucjaydeokartzifudzi
authored
Release 1.6 (#483)
* add finalizer handler in v1.4 * fix an err variable * adding logs for mismatched CNINode * add metrics for mismatches * update EC2 instance types * Update aws-sdk-go and change way to get regional sts endpoint (#466) * Missing dependency update * Remove hard failure for not getting global STS endpoint (#467) * updating k8s manifest * chaning go to major.minor format (#477) * updating go version and controller-gen version (#464) * Add new target for building docker images with no tests (#415) * updating rbac * Add Windows secondary IP mode configurable options for managing IP address allocation (#443) * Add Windows secondary IP mode configurable options (#443) #443 * Various code fixes for PR feedback #443 * adding ctx in test * updating ec2 supported instance types (#475) --------- Co-authored-by: Hao Zhou <zhuhz@amazon.com> Co-authored-by: Jay Deokar <23660509+jaydeokar@users.noreply.github.com> Co-authored-by: Jay Deokar <jsdeokar@amazon.com> Co-authored-by: Tatenda Zifudzi <tzifudzi@yahoo.com>
1 parent c899086 commit bbad908

Some content is hidden

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

42 files changed

+2508
-381
lines changed

.go-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.21.9
1+
1.22

Makefile

+6-4
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ VERSION ?= $(GIT_VERSION)
1313
IMAGE ?= $(REPO):$(VERSION)
1414
BASE_IMAGE ?= public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:latest.2
1515
GOLANG_VERSION ?= $(shell cat .go-version)
16-
BUILD_IMAGE ?= public.ecr.aws/bitnami/golang:$(GOLANG_VERSION)
16+
BUILD_IMAGE ?= public.ecr.aws/docker/library/golang:$(GOLANG_VERSION)
1717
GOARCH ?= amd64
1818
PLATFORM ?= linux/amd64
1919

20-
export GOSUMDB = sum.golang.org
21-
export GOTOOLCHAIN = go$(GOLANG_VERSION)
22-
2320
help: ## Display help
2421
@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)
2522

@@ -79,6 +76,11 @@ docker-buildx: check-env test
7976
docker-build: check-env test
8077
docker build --build-arg BASE_IMAGE=$(BASE_IMAGE) --build-arg ARCH=$(GOARCH) --build-arg BUILD_IMAGE=$(BUILD_IMAGE) . -t ${IMAGE}
8178

79+
80+
# Build the docker image with buildx and no tests
81+
docker-buildx-no-test:
82+
docker buildx build --platform=$(PLATFORM) -t $(IMAGE)_$(GOARCH) --build-arg BASE_IMAGE=$(BASE_IMAGE) --build-arg BUILD_IMAGE=$(BUILD_IMAGE) --build-arg $(GOARCH) --load .
83+
8284
# Push the docker image
8385
docker-push: check-env
8486
docker push ${IMAGE}

apis/vpcresources/v1alpha1/zz_generated.deepcopy.go

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/vpcresources/v1beta1/zz_generated.deepcopy.go

-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/vpcresources.k8s.aws_cninodes.yaml

+15-10
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.14.0
87
name: cninodes.vpcresources.k8s.aws
98
spec:
109
group: vpcresources.k8s.aws
@@ -27,20 +26,26 @@ spec:
2726
openAPIV3Schema:
2827
properties:
2928
apiVersion:
30-
description: 'APIVersion defines the versioned schema of this representation
31-
of an object. Servers should convert recognized schemas to the latest
32-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
29+
description: |-
30+
APIVersion defines the versioned schema of this representation of an object.
31+
Servers should convert recognized schemas to the latest internal value, and
32+
may reject unrecognized values.
33+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
3334
type: string
3435
kind:
35-
description: 'Kind is a string value representing the REST resource this
36-
object represents. Servers may infer this from the endpoint the client
37-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
36+
description: |-
37+
Kind is a string value representing the REST resource this object represents.
38+
Servers may infer this from the endpoint the client submits requests to.
39+
Cannot be updated.
40+
In CamelCase.
41+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3842
type: string
3943
metadata:
4044
type: object
4145
spec:
42-
description: 'Important: Run "make" to regenerate code after modifying
43-
this file CNINodeSpec defines the desired state of CNINode'
46+
description: |-
47+
Important: Run "make" to regenerate code after modifying this file
48+
CNINodeSpec defines the desired state of CNINode
4449
properties:
4550
features:
4651
items:

config/crd/bases/vpcresources.k8s.aws_securitygrouppolicies.yaml

+50-46
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.0
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.14.0
87
name: securitygrouppolicies.vpcresources.k8s.aws
98
spec:
109
group: vpcresources.k8s.aws
@@ -29,48 +28,53 @@ spec:
2928
description: Custom Resource Definition for applying security groups to pods
3029
properties:
3130
apiVersion:
32-
description: 'APIVersion defines the versioned schema of this representation
33-
of an object. Servers should convert recognized schemas to the latest
34-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
31+
description: |-
32+
APIVersion defines the versioned schema of this representation of an object.
33+
Servers should convert recognized schemas to the latest internal value, and
34+
may reject unrecognized values.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
3536
type: string
3637
kind:
37-
description: 'Kind is a string value representing the REST resource this
38-
object represents. Servers may infer this from the endpoint the client
39-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
38+
description: |-
39+
Kind is a string value representing the REST resource this object represents.
40+
Servers may infer this from the endpoint the client submits requests to.
41+
Cannot be updated.
42+
In CamelCase.
43+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
4044
type: string
4145
metadata:
4246
type: object
4347
spec:
4448
description: SecurityGroupPolicySpec defines the desired state of SecurityGroupPolicy
4549
properties:
4650
podSelector:
47-
description: A label selector is a label query over a set of resources.
48-
The result of matchLabels and matchExpressions are ANDed. An empty
49-
label selector matches all objects. A null label selector matches
50-
no objects.
51+
description: |-
52+
A label selector is a label query over a set of resources. The result of matchLabels and
53+
matchExpressions are ANDed. An empty label selector matches all objects. A null
54+
label selector matches no objects.
5155
properties:
5256
matchExpressions:
5357
description: matchExpressions is a list of label selector requirements.
5458
The requirements are ANDed.
5559
items:
56-
description: A label selector requirement is a selector that
57-
contains values, a key, and an operator that relates the key
58-
and values.
60+
description: |-
61+
A label selector requirement is a selector that contains values, a key, and an operator that
62+
relates the key and values.
5963
properties:
6064
key:
6165
description: key is the label key that the selector applies
6266
to.
6367
type: string
6468
operator:
65-
description: operator represents a key's relationship to
66-
a set of values. Valid operators are In, NotIn, Exists
67-
and DoesNotExist.
69+
description: |-
70+
operator represents a key's relationship to a set of values.
71+
Valid operators are In, NotIn, Exists and DoesNotExist.
6872
type: string
6973
values:
70-
description: values is an array of string values. If the
71-
operator is In or NotIn, the values array must be non-empty.
72-
If the operator is Exists or DoesNotExist, the values
73-
array must be empty. This array is replaced during a strategic
74+
description: |-
75+
values is an array of string values. If the operator is In or NotIn,
76+
the values array must be non-empty. If the operator is Exists or DoesNotExist,
77+
the values array must be empty. This array is replaced during a strategic
7478
merge patch.
7579
items:
7680
type: string
@@ -83,13 +87,13 @@ spec:
8387
matchLabels:
8488
additionalProperties:
8589
type: string
86-
description: matchLabels is a map of {key,value} pairs. A single
87-
{key,value} in the matchLabels map is equivalent to an element
88-
of matchExpressions, whose key field is "key", the operator
89-
is "In", and the values array contains only "value". The requirements
90-
are ANDed.
90+
description: |-
91+
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
92+
map is equivalent to an element of matchExpressions, whose key field is "key", the
93+
operator is "In", and the values array contains only "value". The requirements are ANDed.
9194
type: object
9295
type: object
96+
x-kubernetes-map-type: atomic
9397
securityGroups:
9498
description: GroupIds contains the list of security groups that will
9599
be applied to the network interface of the pod matching the criteria.
@@ -104,33 +108,33 @@ spec:
104108
type: array
105109
type: object
106110
serviceAccountSelector:
107-
description: A label selector is a label query over a set of resources.
108-
The result of matchLabels and matchExpressions are ANDed. An empty
109-
label selector matches all objects. A null label selector matches
110-
no objects.
111+
description: |-
112+
A label selector is a label query over a set of resources. The result of matchLabels and
113+
matchExpressions are ANDed. An empty label selector matches all objects. A null
114+
label selector matches no objects.
111115
properties:
112116
matchExpressions:
113117
description: matchExpressions is a list of label selector requirements.
114118
The requirements are ANDed.
115119
items:
116-
description: A label selector requirement is a selector that
117-
contains values, a key, and an operator that relates the key
118-
and values.
120+
description: |-
121+
A label selector requirement is a selector that contains values, a key, and an operator that
122+
relates the key and values.
119123
properties:
120124
key:
121125
description: key is the label key that the selector applies
122126
to.
123127
type: string
124128
operator:
125-
description: operator represents a key's relationship to
126-
a set of values. Valid operators are In, NotIn, Exists
127-
and DoesNotExist.
129+
description: |-
130+
operator represents a key's relationship to a set of values.
131+
Valid operators are In, NotIn, Exists and DoesNotExist.
128132
type: string
129133
values:
130-
description: values is an array of string values. If the
131-
operator is In or NotIn, the values array must be non-empty.
132-
If the operator is Exists or DoesNotExist, the values
133-
array must be empty. This array is replaced during a strategic
134+
description: |-
135+
values is an array of string values. If the operator is In or NotIn,
136+
the values array must be non-empty. If the operator is Exists or DoesNotExist,
137+
the values array must be empty. This array is replaced during a strategic
134138
merge patch.
135139
items:
136140
type: string
@@ -143,13 +147,13 @@ spec:
143147
matchLabels:
144148
additionalProperties:
145149
type: string
146-
description: matchLabels is a map of {key,value} pairs. A single
147-
{key,value} in the matchLabels map is equivalent to an element
148-
of matchExpressions, whose key field is "key", the operator
149-
is "In", and the values array contains only "value". The requirements
150-
are ANDed.
150+
description: |-
151+
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
152+
map is equivalent to an element of matchExpressions, whose key field is "key", the
153+
operator is "In", and the values array contains only "value". The requirements are ANDed.
151154
type: object
152155
type: object
156+
x-kubernetes-map-type: atomic
153157
type: object
154158
type: object
155159
served: true

config/rbac/role.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
apiVersion: rbac.authorization.k8s.io/v1
33
kind: ClusterRole
44
metadata:
5-
creationTimestamp: null
65
name: controller-role
76
rules:
87
- apiGroups:
@@ -74,7 +73,6 @@ rules:
7473
apiVersion: rbac.authorization.k8s.io/v1
7574
kind: Role
7675
metadata:
77-
creationTimestamp: null
7876
name: controller-role
7977
namespace: kube-system
8078
rules:

config/webhook/manifests.yaml

+7-9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
apiVersion: admissionregistration.k8s.io/v1
33
kind: MutatingWebhookConfiguration
44
metadata:
5-
creationTimestamp: null
65
name: mutating-webhook-configuration
76
webhooks:
87
- admissionReviewVersions:
@@ -29,7 +28,6 @@ webhooks:
2928
apiVersion: admissionregistration.k8s.io/v1
3029
kind: ValidatingWebhookConfiguration
3130
metadata:
32-
creationTimestamp: null
3331
name: validating-webhook-configuration
3432
webhooks:
3533
- admissionReviewVersions:
@@ -38,38 +36,38 @@ webhooks:
3836
service:
3937
name: webhook-service
4038
namespace: system
41-
path: /validate-v1-pod
39+
path: /validate-v1-node
4240
failurePolicy: Ignore
4341
matchPolicy: Equivalent
44-
name: vpod.vpc.k8s.aws
42+
name: vnode.vpc.k8s.aws
4543
rules:
4644
- apiGroups:
4745
- ""
4846
apiVersions:
4947
- v1
5048
operations:
51-
- CREATE
5249
- UPDATE
5350
resources:
54-
- pods
51+
- nodes
5552
sideEffects: None
5653
- admissionReviewVersions:
5754
- v1
5855
clientConfig:
5956
service:
6057
name: webhook-service
6158
namespace: system
62-
path: /validate-v1-node
59+
path: /validate-v1-pod
6360
failurePolicy: Ignore
6461
matchPolicy: Equivalent
65-
name: vnode.vpc.k8s.aws
62+
name: vpod.vpc.k8s.aws
6663
rules:
6764
- apiGroups:
6865
- ""
6966
apiVersions:
7067
- v1
7168
operations:
69+
- CREATE
7270
- UPDATE
7371
resources:
74-
- nodes
72+
- pods
7573
sideEffects: None

controllers/core/configmap_controller.go

+26-14
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ type ConfigMapReconciler struct {
4646
Condition condition.Conditions
4747
curWinIPAMEnabledCond bool
4848
curWinPrefixDelegationEnabledCond bool
49-
curWinPDWarmIPTarget int
50-
curWinPDMinIPTarget int
49+
curWinWarmIPTarget int
50+
curWinMinIPTarget int
5151
curWinPDWarmPrefixTarget int
5252
Context context.Context
5353
}
@@ -116,21 +116,33 @@ func (r *ConfigMapReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
116116
isPrefixFlagUpdated = true
117117
}
118118

119-
// Check if configurations for Windows prefix delegation have changed
120-
var isPDConfigUpdated bool
121-
warmIPTarget, minIPTarget, warmPrefixTarget := config.ParseWinPDTargets(r.Log, configmap)
122-
if r.curWinPDWarmIPTarget != warmIPTarget || r.curWinPDMinIPTarget != minIPTarget || r.curWinPDWarmPrefixTarget != warmPrefixTarget {
123-
r.curWinPDWarmIPTarget = warmIPTarget
124-
r.curWinPDMinIPTarget = minIPTarget
119+
// Check if Windows IP target configurations in ConfigMap have changed
120+
var isWinIPConfigsUpdated bool
121+
122+
warmIPTarget, minIPTarget, warmPrefixTarget, isPDEnabled := config.ParseWinIPTargetConfigs(r.Log, configmap)
123+
var winMinIPTargetUpdated = r.curWinMinIPTarget != minIPTarget
124+
var winWarmIPTargetUpdated = r.curWinWarmIPTarget != warmIPTarget
125+
var winPDWarmPrefixTargetUpdated = r.curWinPDWarmPrefixTarget != warmPrefixTarget
126+
if winWarmIPTargetUpdated || winMinIPTargetUpdated {
127+
r.curWinWarmIPTarget = warmIPTarget
128+
r.curWinMinIPTarget = minIPTarget
129+
isWinIPConfigsUpdated = true
130+
}
131+
if isPDEnabled && winPDWarmPrefixTargetUpdated {
125132
r.curWinPDWarmPrefixTarget = warmPrefixTarget
126-
logger.Info("updated PD configs from configmap", config.WarmIPTarget, r.curWinPDWarmIPTarget,
127-
config.MinimumIPTarget, r.curWinPDMinIPTarget, config.WarmPrefixTarget, r.curWinPDWarmPrefixTarget)
128-
129-
isPDConfigUpdated = true
133+
isWinIPConfigsUpdated = true
134+
}
135+
if isWinIPConfigsUpdated {
136+
logger.Info(
137+
"Detected update in Windows IP configuration parameter values in ConfigMap",
138+
config.WinWarmIPTarget, r.curWinWarmIPTarget,
139+
config.WinMinimumIPTarget, r.curWinMinIPTarget,
140+
config.WinWarmPrefixTarget, r.curWinPDWarmPrefixTarget,
141+
config.EnableWindowsPrefixDelegationKey, isPDEnabled,
142+
)
130143
}
131144

132-
// Flag is updated, update all nodes
133-
if isIPAMFlagUpdated || isPrefixFlagUpdated || isPDConfigUpdated {
145+
if isIPAMFlagUpdated || isPrefixFlagUpdated || isWinIPConfigsUpdated {
134146
err := UpdateNodesOnConfigMapChanges(r.K8sAPI, r.NodeManager)
135147
if err != nil {
136148
// Error in updating nodes

0 commit comments

Comments
 (0)