Skip to content

Commit c622f18

Browse files
adammwjoshfrench
authored andcommitted
feat: support setting EKS AuthenticationMode
1 parent e906ef4 commit c622f18

14 files changed

+498
-114
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ COPY ./ ./
4141
ARG package=.
4242
ARG ARCH
4343
ARG LDFLAGS
44+
ARG GCFLAGS
4445
RUN --mount=type=cache,target=/root/.cache/go-build \
4546
--mount=type=cache,target=/go/pkg/mod \
4647
--mount=type=cache,target=/root/.local/share/golang \
47-
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o manager ${package}
48+
CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -gcflags "${GCFLAGS}" -ldflags "${LDFLAGS} -extldflags '-static'" -o manager ${package}
4849
ENTRYPOINT [ "/start.sh", "/workspace/manager" ]
4950

5051
# Copy the controller-manager into a thin image

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ RBAC_ROOT ?= $(MANIFEST_ROOT)/rbac
137137
# Allow overriding the imagePullPolicy
138138
PULL_POLICY ?= Always
139139

140+
# Allow overriding the GCFLAGS
141+
GCFLAGS ?=
142+
140143
# Set build time variables including version details
141144
LDFLAGS := $(shell source ./hack/version.sh; version::ldflags)
142145

@@ -387,12 +390,12 @@ binaries: managers clusterawsadm ## Builds and installs all binaries
387390

388391
.PHONY: clusterawsadm
389392
clusterawsadm: ## Build clusterawsadm binary
390-
go build -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/clusterawsadm ./cmd/clusterawsadm
393+
go build -gcflags "$(GCFLAGS)" -ldflags "$(LDFLAGS)" -o $(BIN_DIR)/clusterawsadm ./cmd/clusterawsadm
391394

392395

393396
.PHONY: docker-build
394397
docker-build: docker-pull-prerequisites ## Build the docker image for controller-manager
395-
docker build --build-arg ARCH=$(ARCH) --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg LDFLAGS="$(LDFLAGS)" . -t $(CORE_CONTROLLER_IMG)-$(ARCH):$(TAG)
398+
docker build --build-arg ARCH=$(ARCH) --build-arg builder_image=$(GO_CONTAINER_IMAGE) --build-arg GCFLAGS="$(GCFLAGS)" --build-arg LDFLAGS="$(LDFLAGS)" . -t $(CORE_CONTROLLER_IMG)-$(ARCH):$(TAG)
396399

397400
.PHONY: docker-build-all ## Build all the architecture docker images
398401
docker-build-all: $(addprefix docker-build-,$(ALL_ARCH))
@@ -411,7 +414,7 @@ managers: ## Alias for manager-aws-infrastructure
411414

412415
.PHONY: manager-aws-infrastructure
413416
manager-aws-infrastructure: ## Build manager binary
414-
CGO_ENABLED=0 GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR)/manager .
417+
CGO_ENABLED=0 GOARCH=${ARCH} go build -gcflags "${GCFLAGS}" -ldflags "${LDFLAGS} -extldflags '-static'" -o $(BIN_DIR)/manager .
415418

416419
##@ test:
417420

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,21 @@ spec:
6767
description: AWSManagedControlPlaneSpec defines the desired state of an
6868
Amazon EKS Cluster.
6969
properties:
70+
accessConfig:
71+
description: AccessConfig specifies the access configuration information
72+
for the cluster
73+
properties:
74+
authenticationMode:
75+
default: CONFIG_MAP
76+
description: |-
77+
AuthenticationMode specifies the desired authentication mode for the cluster
78+
Defaults to CONFIG_MAP
79+
enum:
80+
- CONFIG_MAP
81+
- API
82+
- API_AND_CONFIG_MAP
83+
type: string
84+
type: object
7085
additionalTags:
7186
additionalProperties:
7287
type: string
@@ -2245,6 +2260,21 @@ spec:
22452260
description: AWSManagedControlPlaneSpec defines the desired state of an
22462261
Amazon EKS Cluster.
22472262
properties:
2263+
accessConfig:
2264+
description: AccessConfig specifies the access configuration information
2265+
for the cluster
2266+
properties:
2267+
authenticationMode:
2268+
default: CONFIG_MAP
2269+
description: |-
2270+
AuthenticationMode specifies the desired authentication mode for the cluster
2271+
Defaults to CONFIG_MAP
2272+
enum:
2273+
- CONFIG_MAP
2274+
- API
2275+
- API_AND_CONFIG_MAP
2276+
type: string
2277+
type: object
22482278
additionalTags:
22492279
additionalProperties:
22502280
type: string
@@ -3053,7 +3083,7 @@ spec:
30533083
type: object
30543084
oidcIdentityProviderConfig:
30553085
description: |-
3056-
IdentityProviderconfig is used to specify the oidc provider config
3086+
OIDCIdentityProviderConfig is used to specify the oidc provider config
30573087
to be attached with this eks cluster
30583088
properties:
30593089
clientId:

controlplane/eks/api/v1beta1/awsmanagedcontrolplane_types.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ type AWSManagedControlPlaneSpec struct { //nolint: maligned
165165
// +optional
166166
OIDCIdentityProviderConfig *OIDCIdentityProviderConfig `json:"oidcIdentityProviderConfig,omitempty"`
167167

168+
// AccessConfig specifies the access configuration information for the cluster
169+
// +optional
170+
AccessConfig *AccessConfig `json:"accessConfig,omitempty"`
171+
168172
// DisableVPCCNI indicates that the Amazon VPC CNI should be disabled. With EKS clusters the
169173
// Amazon VPC CNI is automatically installed into the cluster. For clusters where you want
170174
// to use an alternate CNI this option provides a way to specify that the Amazon VPC CNI
@@ -212,6 +216,15 @@ type EndpointAccess struct {
212216
Private *bool `json:"private,omitempty"`
213217
}
214218

219+
// AccessConfig represents the access configuration information for the cluster
220+
type AccessConfig struct {
221+
// AuthenticationMode specifies the desired authentication mode for the cluster
222+
// Defaults to CONFIG_MAP
223+
// +kubebuilder:default=CONFIG_MAP
224+
// +kubebuilder:validation:Enum=CONFIG_MAP;API;API_AND_CONFIG_MAP
225+
AuthenticationMode EKSAuthenticationMode `json:"authenticationMode,omitempty"`
226+
}
227+
215228
// EncryptionConfig specifies the encryption configuration for the EKS clsuter.
216229
type EncryptionConfig struct {
217230
// Provider specifies the ARN or alias of the CMK (in AWS KMS)

controlplane/eks/api/v1beta1/types.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ var (
7979
EKSTokenMethodAWSCli = EKSTokenMethod("aws-cli")
8080
)
8181

82+
// EKSAuthenticationMode defines the authentication mode for the cluster
83+
type EKSAuthenticationMode string
84+
85+
var (
86+
// EKSAuthenticationModeConfigMap indicates that only `aws-auth` ConfigMap will be used for authentication
87+
EKSAuthenticationModeConfigMap = EKSAuthenticationMode("CONFIG_MAP")
88+
89+
// EKSAuthenticationModeAPI indicates that only AWS Access Entries will be used for authentication
90+
EKSAuthenticationModeAPI = EKSAuthenticationMode("API")
91+
92+
// EKSAuthenticationModeAPIAndConfigMap indicates that both `aws-auth` ConfigMap and AWS Access Entries will
93+
// be used for authentication
94+
EKSAuthenticationModeAPIAndConfigMap = EKSAuthenticationMode("API_AND_CONFIG_MAP")
95+
)
96+
8297
var (
8398
// DefaultEKSControlPlaneRole is the name of the default IAM role to use for the EKS control plane
8499
// if no other role is supplied in the spec and if iam role creation is not enabled. The default

0 commit comments

Comments
 (0)