Skip to content

Commit

Permalink
feat(bump): update all dependencies, use karpenter v1, remove irsa, i…
Browse files Browse the repository at this point in the history
…mplement pod-identity (#34)

* feat(bump): update all dependencies, use karpenter v1

Signed-off-by: Christopher Haar <[email protected]>

* docs(readme): update readme

Signed-off-by: Christopher Haar <[email protected]>

---------

Signed-off-by: Christopher Haar <[email protected]>
  • Loading branch information
haarchri authored Aug 23, 2024
1 parent 2180ffa commit e649a2d
Show file tree
Hide file tree
Showing 16 changed files with 342 additions and 192 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "build"]
path = build
url = https://github.com/upbound/build
url = https://github.com/crossplane/build
50 changes: 40 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ PLATFORMS ?= linux_amd64
# ====================================================================================
# Setup Kubernetes tools

UP_VERSION = v0.24.1
UP_VERSION = v0.32.1
UP_CHANNEL = stable
UPTEST_VERSION = v0.11.0
UPTEST_VERSION = v0.13.1
CROSSPLANE_CLI_VERSION=v1.16.0

-include build/makelib/k8s_tools.mk
# ====================================================================================
Expand All @@ -27,8 +28,12 @@ XPKG_REG_ORGS_NO_PROMOTE ?= xpkg.upbound.io/upbound
XPKGS = $(PROJECT_NAME)
-include build/makelib/xpkg.mk

CROSSPLANE_VERSION = 1.16.0-up.1
CROSSPLANE_CHART_REPO = https://charts.upbound.io/stable
CROSSPLANE_CHART_NAME = universal-crossplane
CROSSPLANE_NAMESPACE = upbound-system
CROSSPLANE_ARGS = "--enable-usages"
KIND_CLUSTER_NAME = uptest-$(PROJECT_NAME)
-include build/makelib/local.xpkg.mk
-include build/makelib/controlplane.mk

Expand Down Expand Up @@ -66,20 +71,45 @@ build.init: $(UP)
SKIP_DELETE ?=
uptest: $(UPTEST) $(KUBECTL) $(KUTTL)
@$(INFO) running automated tests
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) $(UPTEST) e2e test/karpenter-xr.yaml,examples/network-xr.yaml,examples/eks-xr.yaml --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=test/setup.sh --default-timeout=2400 $(SKIP_DELETE) || $(FAIL)
@KUBECTL=$(KUBECTL) KUTTL=$(KUTTL) CROSSPLANE_NAMESPACE=$(CROSSPLANE_NAMESPACE) CROSSPLANE_CLI=$(CROSSPLANE_CLI) $(UPTEST) e2e "${UPTEST_EXAMPLE_LIST}" --data-source="${UPTEST_DATASOURCE_PATH}" --setup-script=test/setup.sh --default-timeout=2400 $(SKIP_DELETE) || $(FAIL)
@$(OK) running automated tests

# This target requires the following environment variables to be set:
# - UPTEST_CLOUD_CREDENTIALS, cloud credentials for the provider being tested, e.g. export UPTEST_CLOUD_CREDENTIALS=$(cat ~/.aws/credentials)
# Use `make e2e SKIP_DELETE=--skip-delete` to skip deletion of resources created during the test.
e2e: build controlplane.up local.xpkg.deploy.configuration.$(PROJECT_NAME) uptest

render:
crossplane beta render examples/karpenter-xr.yaml apis/composition.yaml examples/functions.yaml -r

yamllint:
e2e: build controlplane.up local.xpkg.deploy.configuration.$(PROJECT_NAME) uptest ## Run uptest together with all dependencies. Use `make e2e SKIP_DELETE=--skip-delete` to skip deletion of resources.

render: $(CROSSPLANE_CLI) ${YQ}
@indir="./examples"; \
for file in $$(find $$indir -type f -name '*.yaml' ); do \
doc_count=$$(grep -c '^---' "$$file"); \
if [[ $$doc_count -gt 0 ]]; then \
continue; \
fi; \
COMPOSITION=$$(${YQ} eval '.metadata.annotations."render.crossplane.io/composition-path"' $$file); \
FUNCTION=$$(${YQ} eval '.metadata.annotations."render.crossplane.io/function-path"' $$file); \
ENVIRONMENT=$$(${YQ} eval '.metadata.annotations."render.crossplane.io/environment-path"' $$file); \
OBSERVE=$$(${YQ} eval '.metadata.annotations."render.crossplane.io/observe-path"' $$file); \
if [[ "$$ENVIRONMENT" == "null" ]]; then \
ENVIRONMENT=""; \
fi; \
if [[ "$$OBSERVE" == "null" ]]; then \
OBSERVE=""; \
fi; \
if [[ "$$COMPOSITION" == "null" || "$$FUNCTION" == "null" ]]; then \
continue; \
fi; \
ENVIRONMENT=$${ENVIRONMENT=="null" ? "" : $$ENVIRONMENT}; \
OBSERVE=$${OBSERVE=="null" ? "" : $$OBSERVE}; \
$(CROSSPLANE_CLI) beta render $$file $$COMPOSITION $$FUNCTION $${ENVIRONMENT:+-e $$ENVIRONMENT} $${OBSERVE:+-o $$OBSERVE} -x; \
done

yamllint: ## Static yamllint check
@$(INFO) running yamllint
@yamllint ./apis || $(FAIL)
@$(OK) running yamllint

.PHONY: uptest e2e render yamllint
help.local:
@grep -E '^[a-zA-Z_-]+.*:.*?## .*$$' Makefile | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

.PHONY: uptest e2e render yamllint help.local
37 changes: 36 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ kind: Configuration
metadata:
name: configuration-aws-eks-karpenter
spec:
package: xpkg.upbound.io/upbound/configuration-aws-eks-karpenter:v0.3.0
package: xpkg.upbound.io/upbound/configuration-aws-eks-karpenter:v0.6.0
```

## Next steps
Expand All @@ -37,3 +37,38 @@ This repository serves as a foundational step. To enhance your control plane, co


Upbound will automatically detect the commits you make in your repo and build the configuration package for you. To learn more about how to build APIs for your managed control planes in Upbound, read the guide on Upbound's docs.

# Using the make file
## render target
### Overview
`make render` target automates the rendering of Crossplane manifests using specified annotations within your YAML files.
The annotations guide the rendering process, specifying paths to composition, function, environment, and observe files.

### Annotations
The `make render` target relies on specific annotations in your YAML files to determine how to process each file.
The following annotations are supported:

**render.crossplane.io/composition-path**: Specifies the path to the composition file to be used in rendering.

**render.crossplane.io/function-path**: Specifies the path to the function file to be used in rendering.

**render.crossplane.io/environment-path** (optional): Specifies the path to the environment file. If not provided, the rendering will proceed without an environment.

**render.crossplane.io/observe-path** (optional): Specifies the path to the observe file. If not provided, the rendering will proceed without observation settings.

```yaml
apiVersion: aws.platform.upbound.io/v1alpha1
kind: XKarpenter
metadata:
name: configuration-aws-eks-karpenter
annotations:
render.crossplane.io/composition-path: apis/pat/composition.yaml
render.crossplane.io/function-path: examples/functions.yaml
spec:
parameters:
clusterNameSelector:
matchLabels:
crossplane.io/composite: configuration-aws-eks-karpenter
id: configuration-aws-eks-karpenter
region: us-west-2
```
80 changes: 78 additions & 2 deletions apis/definition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ kind: CompositeResourceDefinition
metadata:
name: xkarpenters.aws.platform.upbound.io
spec:
defaultCompositionRef:
name: pat.xkarpenters.aws.platform.upbound.io
group: aws.platform.upbound.io
names:
kind: XKarpenter
Expand All @@ -26,8 +28,83 @@ spec:
type: string
description: ID of this Cluster that other objects will use to refer to it.
clusterName:
description: The name of the cluster to create the association
in.
type: string
description: Full Name of Cluster.
clusterNameRef:
description: Reference to a Cluster in eks to populate clusterName.
properties:
name:
description: Name of the referenced object.
type: string
policy:
description: Policies for referencing.
properties:
resolution:
default: Required
description: |-
Resolution specifies whether resolution of this reference is required.
The default is 'Required', which means the reconcile will fail if the
reference cannot be resolved. 'Optional' means this reference will be
a no-op if it cannot be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: |-
Resolve specifies when this reference should be resolved. The default
is 'IfNotPresent', which will attempt to resolve the reference only when
the corresponding field is not present. Use 'Always' to resolve the
reference on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
required:
- name
type: object
clusterNameSelector:
description: Selector for a Cluster in eks to populate clusterName.
properties:
matchControllerRef:
description: |-
MatchControllerRef ensures an object with the same controller reference
as the selecting object is selected.
type: boolean
matchLabels:
additionalProperties:
type: string
description: MatchLabels ensures an object with matching labels
is selected.
type: object
policy:
description: Policies for selection.
properties:
resolution:
default: Required
description: |-
Resolution specifies whether resolution of this reference is required.
The default is 'Required', which means the reconcile will fail if the
reference cannot be resolved. 'Optional' means this reference will be
a no-op if it cannot be resolved.
enum:
- Required
- Optional
type: string
resolve:
description: |-
Resolve specifies when this reference should be resolved. The default
is 'IfNotPresent', which will attempt to resolve the reference only when
the corresponding field is not present. Use 'Always' to resolve the
reference on every reconcile.
enum:
- Always
- IfNotPresent
type: string
type: object
type: object
region:
type: string
description: Region is the region you'd like your resource to be created in.
Expand All @@ -44,7 +121,6 @@ spec:
default: default
required:
- id
- clusterName
- region
- deletionPolicy
- providerConfigName
Expand Down
Loading

0 comments on commit e649a2d

Please sign in to comment.