|
7 | 7 | # Author: James Bramich ([email protected])
|
8 | 8 | #
|
9 | 9 | # TODO
|
10 |
| -# - add cluster autoscaler |
| 10 | +# - fix cluster autoscaler (bouncing nodes every 10-15 min) |
11 | 11 | #
|
12 | 12 | # History:
|
13 | 13 | # 25 March 2024 James Bramich Created, Northdown, Tasmania
|
@@ -793,6 +793,29 @@ spec:
|
793 | 793 | fmt: '%s-efs-csi-rolepolicyattachment'
|
794 | 794 | type: Format
|
795 | 795 |
|
| 796 | + - name: efsCsiPdb |
| 797 | + base: |
| 798 | + apiVersion: kubernetes.crossplane.io/v1alpha2 |
| 799 | + kind: Object |
| 800 | + spec: |
| 801 | + forProvider: |
| 802 | + manifest: |
| 803 | + apiVersion: policy/v1 |
| 804 | + kind: PodDisruptionBudget |
| 805 | + metadata: |
| 806 | + name: efs-csi-controller-temp-pdb |
| 807 | + namespace: kube-system |
| 808 | + spec: |
| 809 | + maxUnavailable: 1 |
| 810 | + selector: |
| 811 | + matchLabels: |
| 812 | + app: efs-csi-controller |
| 813 | + app.kubernetes.io/instance: aws-efs-csi-driver |
| 814 | + app.kubernetes.io/name: aws-efs-csi-driver |
| 815 | + patches: |
| 816 | + - patchSetName: kubernetesProviderConfigRef |
| 817 | + type: PatchSet |
| 818 | + |
796 | 819 | - name: efsCsiAddon
|
797 | 820 | base:
|
798 | 821 | apiVersion: eks.aws.upbound.io/v1beta1
|
@@ -1031,217 +1054,6 @@ spec:
|
1031 | 1054 | toFieldPath: spec.forProvider.values.clusterName
|
1032 | 1055 | # end load balancer setup
|
1033 | 1056 |
|
1034 |
| -# set up cluster autoscaler |
1035 |
| - - name: autoscalerIamRole |
1036 |
| - base: |
1037 |
| - apiVersion: iam.aws.upbound.io/v1beta1 |
1038 |
| - kind: Role |
1039 |
| - metadata: |
1040 |
| - labels: |
1041 |
| - role: clusterAutoscaler |
1042 |
| - spec: |
1043 |
| - forProvider: |
1044 |
| - assumeRolePolicy: "" |
1045 |
| - patches: |
1046 |
| - - patchSetName: providerConfigRef |
1047 |
| - type: PatchSet |
1048 |
| - - patchSetName: deletionPolicy |
1049 |
| - type: PatchSet |
1050 |
| - - patchSetName: tags |
1051 |
| - type: PatchSet |
1052 |
| - - type: CombineFromComposite |
1053 |
| - toFieldPath: spec.forProvider.assumeRolePolicy |
1054 |
| - combine: |
1055 |
| - variables: |
1056 |
| - - fromFieldPath: status.eks.accountId |
1057 |
| - - fromFieldPath: status.eks.oidcUri |
1058 |
| - - fromFieldPath: status.eks.oidcUri |
1059 |
| - - fromFieldPath: status.eks.oidcUri |
1060 |
| - strategy: string |
1061 |
| - string: |
1062 |
| - fmt: | |
1063 |
| - { |
1064 |
| - "Version": "2012-10-17", |
1065 |
| - "Statement": [ |
1066 |
| - { |
1067 |
| - "Effect": "Allow", |
1068 |
| - "Principal": { |
1069 |
| - "Federated": "arn:aws:iam::%s:oidc-provider/%s" |
1070 |
| - }, |
1071 |
| - "Action": "sts:AssumeRoleWithWebIdentity", |
1072 |
| - "Condition": { |
1073 |
| - "StringEquals": { |
1074 |
| - "%s:aud": "sts.amazonaws.com", |
1075 |
| - "%s:sub": "system:serviceaccount:kube-system:cluster-autoscaler-sa" |
1076 |
| - } |
1077 |
| - } |
1078 |
| - } |
1079 |
| - ] |
1080 |
| - } |
1081 |
| - - type: FromCompositeFieldPath |
1082 |
| - fromFieldPath: spec.parameters.id |
1083 |
| - toFieldPath: spec.forProvider.tags["Name"] |
1084 |
| - transforms: |
1085 |
| - - type: string |
1086 |
| - string: |
1087 |
| - fmt: '%s-cluster-autoscaler-role' |
1088 |
| - type: Format |
1089 |
| - - type: ToCompositeFieldPath |
1090 |
| - fromFieldPath: status.atProvider.arn |
1091 |
| - policy: |
1092 |
| - fromFieldPath: Optional |
1093 |
| - toFieldPath: status.eks.clusterAutoscalerRoleArn |
1094 |
| - - type: FromCompositeFieldPath |
1095 |
| - fromFieldPath: spec.parameters.id |
1096 |
| - toFieldPath: "metadata.annotations[crossplane.io/external-name]" |
1097 |
| - transforms: |
1098 |
| - - type: string |
1099 |
| - string: |
1100 |
| - fmt: '%s-cluster-autoscaler-role' |
1101 |
| - type: Format |
1102 |
| - |
1103 |
| - - name: autoscalerIamPolicy |
1104 |
| - base: |
1105 |
| - apiVersion: iam.aws.upbound.io/v1beta1 |
1106 |
| - kind: Policy |
1107 |
| - metadata: |
1108 |
| - spec: |
1109 |
| - forProvider: |
1110 |
| - policy: "" |
1111 |
| - patches: |
1112 |
| - - patchSetName: providerConfigRef |
1113 |
| - type: PatchSet |
1114 |
| - - patchSetName: deletionPolicy |
1115 |
| - type: PatchSet |
1116 |
| - - patchSetName: tags |
1117 |
| - type: PatchSet |
1118 |
| - - type: CombineFromComposite |
1119 |
| - toFieldPath: spec.forProvider.policy |
1120 |
| - combine: |
1121 |
| - variables: |
1122 |
| - - fromFieldPath: spec.parameters.region |
1123 |
| - - fromFieldPath: status.eks.accountId |
1124 |
| - - fromFieldPath: status.eks.nodeAutoscalingGroupName |
1125 |
| - strategy: string |
1126 |
| - string: |
1127 |
| - fmt: | |
1128 |
| - { |
1129 |
| - "Version": "2012-10-17", |
1130 |
| - "Statement": [ |
1131 |
| - { |
1132 |
| - "Effect": "Allow", |
1133 |
| - "Action": [ |
1134 |
| - "autoscaling:DescribeAutoScalingGroups", |
1135 |
| - "autoscaling:DescribeAutoScalingInstances", |
1136 |
| - "autoscaling:DescribeLaunchConfigurations", |
1137 |
| - "autoscaling:DescribeScalingActivities", |
1138 |
| - "autoscaling:DescribeTags", |
1139 |
| - "ec2:DescribeInstanceTypes", |
1140 |
| - "ec2:DescribeLaunchTemplateVersions" |
1141 |
| - ], |
1142 |
| - "Resource": [ |
1143 |
| - "*" |
1144 |
| - ] |
1145 |
| - }, |
1146 |
| - { |
1147 |
| - "Effect": "Allow", |
1148 |
| - "Action": [ |
1149 |
| - "autoscaling:SetDesiredCapacity", |
1150 |
| - "autoscaling:TerminateInstanceInAutoScalingGroup", |
1151 |
| - "ec2:DescribeImages", |
1152 |
| - "ec2:GetInstanceTypesFromInstanceRequirements", |
1153 |
| - "eks:DescribeNodegroup" |
1154 |
| - ], |
1155 |
| - "Resource": [ |
1156 |
| - "arn:aws:autoscaling:%s:%s:autoScalingGroup:*:autoScalingGroupName/%s" |
1157 |
| - ] |
1158 |
| - } |
1159 |
| - ] |
1160 |
| - } |
1161 |
| - - type: FromCompositeFieldPath |
1162 |
| - fromFieldPath: spec.parameters.id |
1163 |
| - toFieldPath: spec.forProvider.tags["Name"] |
1164 |
| - transforms: |
1165 |
| - - type: string |
1166 |
| - string: |
1167 |
| - fmt: '%s-cluster-autoscaler-policy' |
1168 |
| - type: Format |
1169 |
| - - type: ToCompositeFieldPath |
1170 |
| - fromFieldPath: status.atProvider.arn |
1171 |
| - policy: |
1172 |
| - fromFieldPath: Optional |
1173 |
| - toFieldPath: status.eks.clusterAutoscalerPolicyArn |
1174 |
| - - type: FromCompositeFieldPath |
1175 |
| - fromFieldPath: spec.parameters.id |
1176 |
| - toFieldPath: "metadata.annotations[crossplane.io/external-name]" |
1177 |
| - transforms: |
1178 |
| - - type: string |
1179 |
| - string: |
1180 |
| - fmt: '%s-cluster-autoscaler-policy' |
1181 |
| - type: Format |
1182 |
| - |
1183 |
| - - name: autoscalerRolePolicyAttachment |
1184 |
| - base: |
1185 |
| - apiVersion: iam.aws.upbound.io/v1beta1 |
1186 |
| - kind: RolePolicyAttachment |
1187 |
| - spec: |
1188 |
| - forProvider: |
1189 |
| - policyArn: "" |
1190 |
| - roleSelector: |
1191 |
| - matchControllerRef: true |
1192 |
| - matchLabels: |
1193 |
| - role: clusterAutoscaler |
1194 |
| - patches: |
1195 |
| - - patchSetName: providerConfigRef |
1196 |
| - type: PatchSet |
1197 |
| - - patchSetName: deletionPolicy |
1198 |
| - type: PatchSet |
1199 |
| - - type: FromCompositeFieldPath |
1200 |
| - fromFieldPath: status.eks.clusterAutoscalerPolicyArn |
1201 |
| - toFieldPath: spec.forProvider.policyArn |
1202 |
| - - type: FromCompositeFieldPath |
1203 |
| - fromFieldPath: spec.parameters.id |
1204 |
| - toFieldPath: "metadata.annotations[crossplane.io/external-name]" |
1205 |
| - transforms: |
1206 |
| - - type: string |
1207 |
| - string: |
1208 |
| - fmt: '%s-autoscaler-rolepolicyattachment' |
1209 |
| - type: Format |
1210 |
| - |
1211 |
| - - name: autoscalerHelmChart |
1212 |
| - base: |
1213 |
| - apiVersion: helm.crossplane.io/v1beta1 |
1214 |
| - kind: Release |
1215 |
| - metadata: |
1216 |
| - name: autoscaler |
1217 |
| - spec: |
1218 |
| - forProvider: |
1219 |
| - chart: |
1220 |
| - name: cluster-autoscaler |
1221 |
| - repository: https://kubernetes.github.io/autoscaler |
1222 |
| - version: 9.36.0 |
1223 |
| - namespace: kube-system |
1224 |
| - values: |
1225 |
| - rbac: |
1226 |
| - create: true |
1227 |
| - serviceAccount: |
1228 |
| - create: true |
1229 |
| - name: cluster-autoscaler-sa |
1230 |
| - patches: |
1231 |
| - - patchSetName: helmProviderConfigRef |
1232 |
| - type: PatchSet |
1233 |
| - - type: FromCompositeFieldPath |
1234 |
| - fromFieldPath: spec.parameters.id |
1235 |
| - toFieldPath: spec.forProvider.values.autoDiscovery.clusterName |
1236 |
| - - type: FromCompositeFieldPath |
1237 |
| - fromFieldPath: spec.parameters.region |
1238 |
| - toFieldPath: spec.forProvider.values.awsRegion |
1239 |
| - - type: FromCompositeFieldPath |
1240 |
| - fromFieldPath: status.eks.clusterAutoscalerRoleArn |
1241 |
| - toFieldPath: spec.forProvider.values.rbac.serviceAccount.annotations["eks.amazonaws.com/role-arn"] |
1242 |
| - |
1243 |
| -# end cluster autoscaler setup |
1244 |
| - |
1245 | 1057 | - name: providerConfigKubernetes
|
1246 | 1058 | base:
|
1247 | 1059 | apiVersion: kubernetes.crossplane.io/v1alpha1
|
|
0 commit comments