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

⚠️ Generate v1alpha4 types #2121

Merged
merged 6 commits into from
Apr 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ linters:
- gci
- nlreturn
- gocritic
- exhaustivestruct
- wrapcheck
# Run with --fast=false for more extensive checks
fast: true
issues:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.

# Build the manager binary
FROM golang:1.13.15 as builder
FROM golang:1.16.2 as builder
WORKDIR /workspace

# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
Expand Down
40 changes: 22 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ CORE_CONTROLLER_IMG ?= $(REGISTRY)/$(CORE_IMAGE_NAME)
CORE_CONTROLLER_ORIGINAL_IMG := gcr.io/k8s-staging-cluster-api-aws/cluster-api-aws-controller
CORE_CONTROLLER_NAME := capa-controller-manager
CORE_MANIFEST_FILE := infrastructure-components
CORE_CONFIG_DIR := config
CORE_CONFIG_DIR := config/default
CORE_NAMESPACE := capa-system

# bootstrap
Expand All @@ -101,7 +101,7 @@ EKS_BOOTSTRAP_CONTROLLER_IMG ?= $(REGISTRY)/$(EKS_BOOTSTRAP_IMAGE_NAME)
EKS_BOOTSTRAP_CONTROLLER_ORIGINAL_IMG := gcr.io/k8s-staging-cluster-api-aws/eks-bootstrap-controller
EKS_BOOTSTRAP_CONTROLLER_NAME := capa-eks-bootstrap-controller-manager
EKS_BOOTSTRAP_MANIFEST_FILE := eks-bootstrap-components
EKS_BOOTSTRAP_CONFIG_DIR := bootstrap/eks/config
EKS_BOOTSTRAP_CONFIG_DIR := bootstrap/eks/config/default
EKS_BOOTSTRAP_NAMESPACE := capa-eks-bootstrap-system

# bootstrap
Expand All @@ -110,7 +110,7 @@ EKS_CONTROLPLANE_CONTROLLER_IMG ?= $(REGISTRY)/$(EKS_CONTROLPLANE_IMAGE_NAME)
EKS_CONTROLPLANE_CONTROLLER_ORIGINAL_IMG := gcr.io/k8s-staging-cluster-api-aws/eks-controlplane-controller
EKS_CONTROLPLANE_CONTROLLER_NAME := capa-eks-control-plane-controller-manager
EKS_CONTROLPLANE_MANIFEST_FILE := eks-controlplane-components
EKS_CONTROLPLANE_CONFIG_DIR := controlplane/eks/config
EKS_CONTROLPLANE_CONFIG_DIR := controlplane/eks/config/default
EKS_CONTROLPLANE_NAMESPACE := capa-eks-control-plane-system

# Allow overriding manifest generation destination directory
Expand Down Expand Up @@ -238,7 +238,7 @@ generate-go: $(MOCKGEN)

.PHONY: generate-go-core
generate-go-core: ## Runs Go related generate targets
$(MAKE) -B $(CONTROLLER_GEN) $(CONVERSION_GEN) $(DEFAULTER_GEN)
$(MAKE) -B $(CONTROLLER_GEN) $(DEFAULTER_GEN) $(CONVERSION_GEN)
$(CONTROLLER_GEN) \
paths=./api/... \
paths=./$(EXP_DIR)/api/... \
Expand All @@ -254,21 +254,36 @@ generate-go-core: ## Runs Go related generate targets
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt

$(CONVERSION_GEN) \
--input-dirs=./api/v1alpha2 \
--input-dirs=./api/v1alpha3 \
--extra-peer-dirs=sigs.k8s.io/cluster-api/api/v1alpha3 \
--build-tag=ignore_autogenerated_core_v1alpha3 \
--output-file-base=zz_generated.conversion $(GEN_OUTPUT_BASE) \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt

$(CONVERSION_GEN) \
--input-dirs=./$(EXP_DIR)/api/v1alpha3 \
--output-file-base=zz_generated.conversion \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt $(GEN_OUTPUT_BASE)

.PHONY: generate-go-eks-bootstrap
generate-go-eks-bootstrap: $(CONTROLLER_GEN)
$(CONTROLLER_GEN) \
paths=./bootstrap/eks/api/... \
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt
$(CONVERSION_GEN) \
--input-dirs=./bootstrap/eks/api/v1alpha3 \
--output-file-base=zz_generated.conversion $(GEN_OUTPUT_BASE) \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt

.PHONY: generate-go-eks-controlplane
generate-go-eks-controlplane: $(CONTROLLER_GEN) $(CONVERSION_GEN)
$(CONTROLLER_GEN) \
paths=./controlplane/eks/api/... \
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt
$(CONVERSION_GEN) \
--input-dirs=./controlplane/eks/api/v1alpha3 \
--output-file-base=zz_generated.conversion $(GEN_OUTPUT_BASE) \
--go-header-file=./hack/boilerplate/boilerplate.generatego.txt

.PHONY: generate-manifests
generate-manifests:
Expand Down Expand Up @@ -530,7 +545,6 @@ $(RELEASE_DIR)/$(CORE_MANIFEST_FILE).yaml:
CONTROLLER_NAME=$(CORE_CONTROLLER_NAME) \
PROVIDER_CONFIG_DIR=$(CORE_CONFIG_DIR) \
NAMESPACE=$(CORE_NAMESPACE) \
WEBHOOK_ENABLED=true

.PHONY: $(RELEASE_DIR)/$(EKS_BOOTSTRAP_MANIFEST_FILE).yaml
$(RELEASE_DIR)/$(EKS_BOOTSTRAP_MANIFEST_FILE).yaml:
Expand All @@ -551,7 +565,6 @@ $(RELEASE_DIR)/$(EKS_CONTROLPLANE_MANIFEST_FILE).yaml:
CONTROLLER_NAME=$(EKS_CONTROLPLANE_CONTROLLER_NAME) \
PROVIDER_CONFIG_DIR=$(EKS_CONTROLPLANE_CONFIG_DIR) \
NAMESPACE=$(EKS_CONTROLPLANE_NAMESPACE) \
WEBHOOK_ENABLED=true

.PHONY: compiled-manifest
compiled-manifest: $(RELEASE_DIR) $(KUSTOMIZE)
Expand All @@ -568,21 +581,12 @@ image-patch-source-manifest: $(IMAGE_PATCH_DIR) $(KUSTOMIZE)
.PHONY: image-patch-kustomization
image-patch-kustomization: $(IMAGE_PATCH_DIR)
mkdir -p $(IMAGE_PATCH_DIR)/$(PROVIDER)
@if [ "${WEBHOOK_ENABLED}" = "true" ]; then \
$(MAKE) image-patch-kustomization-with-webhook; else \
$(MAKE) image-patch-kustomization-without-webhook; \
fi

.PHONY: image-patch-kustomization-with-webhook
image-patch-kustomization-with-webhook: $(IMAGE_PATCH_DIR) $(GOJQ)
mkdir -p $(IMAGE_PATCH_DIR)/$(PROVIDER)
$(GOJQ) --yaml-input --yaml-output '.images[0]={"name":"$(OLD_IMG)","newName":"$(MANIFEST_IMG)","newTag":"$(TAG)"}|.patchesJson6902[0].target.name="$(CONTROLLER_NAME)"|.patchesJson6902[0].target.namespace="$(NAMESPACE)"|.patchesJson6902[1].target.name="$(CONTROLLER_NAME)"' \
"hack/image-patch/kustomization.yaml" > $(IMAGE_PATCH_DIR)/$(PROVIDER)/kustomization.yaml
$(MAKE) image-patch-kustomization-without-webhook

.PHONY: image-patch-kustomization-without-webhook
image-patch-kustomization-without-webhook: $(IMAGE_PATCH_DIR) $(GOJQ)
mkdir -p $(IMAGE_PATCH_DIR)/$(PROVIDER)
$(GOJQ) --yaml-input --yaml-output '.images[0]={"name":"$(OLD_IMG)","newName":"$(MANIFEST_IMG)","newTag":"$(TAG)"}|del(.patchesJson6902[1])|.patchesJson6902[0].target.name="$(CONTROLLER_NAME)"|.patchesJson6902[0].target.namespace="$(NAMESPACE)"' \
$(GOJQ) --yaml-input --yaml-output '.images[0]={"name":"$(OLD_IMG)","newName":"$(MANIFEST_IMG)","newTag":"$(TAG)"}|.patchesJson6902[0].target.name="$(CONTROLLER_NAME)"|.patchesJson6902[0].target.namespace="$(NAMESPACE)"' \
"hack/image-patch/kustomization.yaml" > $(IMAGE_PATCH_DIR)/$(PROVIDER)/kustomization.yaml

.PHONY: image-patch-pull-policy
Expand Down
28 changes: 23 additions & 5 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,38 @@ domain: cluster.x-k8s.io
repo: sigs.k8s.io/cluster-api-provider-aws
resources:
- group: infrastructure
version: v1alpha2
version: v1alpha3
kind: AWSMachine
- group: infrastructure
version: v1alpha2
version: v1alpha3
kind: AWSCluster
- group: infrastructure
version: v1alpha2
version: v1alpha3
kind: AWSMachineTemplate
- group: infrastructure
version: v1alpha3
kind: AWSMachine
kind: AWSClusterStaticIdentity
- group: infrastructure
version: v1alpha3
kind: AWSCluster
kind: AWSClusterRoleIdentity
- group: infrastructure
version: v1alpha3
kind: AWSClusterControllerIdentity
- group: infrastructure
version: v1alpha4
kind: AWSMachine
- group: infrastructure
version: v1alpha4
kind: AWSCluster
- group: infrastructure
version: v1alpha4
kind: AWSMachineTemplate
- group: infrastructure
version: v1alpha4
kind: AWSClusterStaticIdentity
- group: infrastructure
version: v1alpha4
kind: AWSClusterRoleIdentity
- group: infrastructure
version: v1alpha4
kind: AWSClusterControllerIdentity
Loading