From 767790c3cab47444f2de5c92a30433996648cd6a Mon Sep 17 00:00:00 2001 From: Moonorb Date: Fri, 19 Jul 2024 19:14:37 +0000 Subject: [PATCH] Modify rule patches to include id as prefix for both metadata and external-names to allow multiple Karpenter instances to create unique resources on the same AWS account and same management cluster --- apis/composition.yaml | 137 ++++++++++++++++++------------------------ 1 file changed, 57 insertions(+), 80 deletions(-) diff --git a/apis/composition.yaml b/apis/composition.yaml index 94b1262..e1c7fc4 100644 --- a/apis/composition.yaml +++ b/apis/composition.yaml @@ -505,28 +505,22 @@ spec: patchSetName: deletionPolicy - type: PatchSet patchSetName: region - - type: FromCompositeFieldPath - fromFieldPath: spec.parameters.id + - combine: + strategy: string + string: + fmt: '%s-healthevent' + variables: + - fromFieldPath: spec.parameters.id toFieldPath: metadata.annotations[crossplane.io/external-name] - transforms: - - match: - fallbackValue: null - patterns: - - regexp: .* - result: healthevent - type: regexp - type: match - - type: FromCompositeFieldPath - fromFieldPath: spec.parameters.id + type: CombineFromComposite + - combine: + strategy: string + string: + fmt: '%s-healthevent' + variables: + - fromFieldPath: spec.parameters.id toFieldPath: metadata.name - transforms: - - match: - fallbackValue: null - patterns: - - regexp: .* - result: healthevent - type: regexp - type: match + type: CombineFromComposite - name: ruleSpotInterrupt base: @@ -554,28 +548,23 @@ spec: patchSetName: deletionPolicy - type: PatchSet patchSetName: region - - type: FromCompositeFieldPath - fromFieldPath: spec.parameters.id + - combine: + strategy: string + string: + fmt: '%s-spotinterrupt' + variables: + - fromFieldPath: spec.parameters.id toFieldPath: metadata.annotations[crossplane.io/external-name] - transforms: - - match: - fallbackValue: null - patterns: - - regexp: .* - result: spotinterrupt - type: regexp - type: match - - type: FromCompositeFieldPath - fromFieldPath: spec.parameters.id + type: CombineFromComposite + + - combine: + strategy: string + string: + fmt: '%s-spotinterrupt' + variables: + - fromFieldPath: spec.parameters.id toFieldPath: metadata.name - transforms: - - match: - fallbackValue: null - patterns: - - regexp: .* - result: spotinterrupt - type: regexp - type: match + type: CombineFromComposite - name: ruleInstanceRebalance base: @@ -603,28 +592,22 @@ spec: patchSetName: deletionPolicy - type: PatchSet patchSetName: region - - type: FromCompositeFieldPath - fromFieldPath: spec.parameters.id + - combine: + strategy: string + string: + fmt: '%s-instancerebalance' + variables: + - fromFieldPath: spec.parameters.id toFieldPath: metadata.annotations[crossplane.io/external-name] - transforms: - - match: - fallbackValue: null - patterns: - - regexp: .* - result: instancerebalance - type: regexp - type: match - - type: FromCompositeFieldPath - fromFieldPath: spec.parameters.id + type: CombineFromComposite + - combine: + strategy: string + string: + fmt: '%s-instancerebalance' + variables: + - fromFieldPath: spec.parameters.id toFieldPath: metadata.name - transforms: - - match: - fallbackValue: null - patterns: - - regexp: .* - result: instancerebalance - type: regexp - type: match + type: CombineFromComposite - name: ruleInstanceStateChange base: @@ -652,28 +635,22 @@ spec: patchSetName: deletionPolicy - type: PatchSet patchSetName: region - - type: FromCompositeFieldPath - fromFieldPath: spec.parameters.id + - combine: + strategy: string + string: + fmt: '%s-instancestatechange' + variables: + - fromFieldPath: spec.parameters.id toFieldPath: metadata.annotations[crossplane.io/external-name] - transforms: - - match: - fallbackValue: null - patterns: - - regexp: .* - result: instancestatechange - type: regexp - type: match - - type: FromCompositeFieldPath - fromFieldPath: spec.parameters.id + type: CombineFromComposite + - combine: + strategy: string + string: + fmt: '%s-instancestatechange' + variables: + - fromFieldPath: spec.parameters.id toFieldPath: metadata.name - transforms: - - match: - fallbackValue: null - patterns: - - regexp: .* - result: instancestatechange - type: regexp - type: match + type: CombineFromComposite - name: ruleHealthEventTarget base: