-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add default kms encrypted gp3 StorageClass and PersistentVolume… #15
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
base: integration
Are you sure you want to change the base?
Changes from all commits
5c57a1b
8c57f9d
ede505b
9237895
fc7b72f
ded1a51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { Easy_EKS_Config_Data } from './Easy_EKS_Config_Data'; | ||
import * as cdk from 'aws-cdk-lib'; | ||
import * as eks from 'aws-cdk-lib/aws-eks'; | ||
import * as kms from 'aws-cdk-lib/aws-kms'; | ||
import console = require('console'); | ||
import { sign } from 'crypto'; | ||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
export class Storage_YAML_Generator{ | ||
|
||
config: Easy_EKS_Config_Data; | ||
cluster: eks.Cluster; | ||
constructor(input_parmeters: Partial<Storage_YAML_Generator>){ Object.assign(this, input_parmeters); } | ||
|
||
generate_storage_class_manifests(){ | ||
let array_of_yaml_manifests_to_return: { [key:string]: any }[] = []; | ||
let config = this.config; | ||
const kms_key = config.kmsKey; | ||
const storage_class_gp3 = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. request: (reasoning behind the request)
when it comes to the persistent volume claim, I think it makes more sense to put it in ./config/eks/dev_eks_config.ts's deploy_workload_dependencies(), because it's functioning like a demo manifest, and since it's a demo it wouldn't belong in my_orgs_baseline (as that's intended to get applied to all environments dev, test, stage, prod) and demo apps wouldn't be appropriate to deploy to prod, but storage class would. (which is why storage_class.yaml makes sense here in ./config/eks/my_orgs_baseline_eks_config.ts, but pvc.yaml should be moved to ./config/eks/dev_eks_config.ts) further point of clarification: |
||
"apiVersion": "storage.k8s.io/v1", | ||
"kind": "StorageClass", | ||
"metadata": { | ||
"name": "kms-encrypted-gp3", | ||
"annotations": { | ||
"storageclass.kubernetes.io/is-default-class": "true" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. storageclass should be indented 4 spaces |
||
} | ||
}, | ||
"provisioner": "ebs.csi.aws.com", | ||
"volumeBindingMode": "WaitForFirstConsumer", | ||
"allowVolumeExpansion": true, | ||
"reclaimPolicy": "Delete", | ||
"parameters": { | ||
"type": "gp3", | ||
"encrypted": "true", | ||
"kmsKeyId": `${kms_key.keyArn}` | ||
} | ||
} | ||
array_of_yaml_manifests_to_return.push(storage_class_gp3) | ||
return array_of_yaml_manifests_to_return; | ||
} //end generate_manifests | ||
|
||
generate_volume_claim_manifests(name: string, size: string){ | ||
let array_of_yaml_manifests_to_return: { [key:string]: any }[] = []; | ||
let cluster = this.cluster; | ||
|
||
const volume_claim_gp3 = { | ||
"apiVersion": "v1", | ||
"kind": "PersistentVolumeClaim", | ||
"metadata": { | ||
"name": `${name}`, | ||
"namespace": "default" | ||
}, | ||
"spec": { | ||
"accessModes": [ | ||
"ReadWriteOnce" | ||
], | ||
"storageClassName": "kms-encrypted-gp3", | ||
"resources": { | ||
"requests": { | ||
"storage": `${size}` | ||
} | ||
} | ||
} | ||
} | ||
array_of_yaml_manifests_to_return.push(volume_claim_gp3) | ||
return array_of_yaml_manifests_to_return; | ||
} //end generate_manifests | ||
|
||
|
||
} //end class Karepnter_Manifests | ||
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
export function Apply_Storage_Class_YAMLs(stack: cdk.Stack, cluster: eks.Cluster, config: Easy_EKS_Config_Data, | ||
manifestName: string,storage_class_YAMLs: {[key: string]: any;}[]){ | ||
const apply_storage_class_YAML = new eks.KubernetesManifest(stack, manifestName, | ||
{ | ||
cluster: cluster, | ||
manifest: storage_class_YAMLs, | ||
overwrite: true, | ||
prune: true, | ||
} | ||
); | ||
|
||
// Test volume claim | ||
|
||
|
||
} //end function Storage_YAML_Generator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged integration into your feature branch and then tested locally.
It doesn't deploy for me.
When I do a fresh install I get
I suspect this issue is the result of order of operations.
I think the logic is trying to introduce your change too soon, and it needs to deploy your change at a later time.
A solution I think might work is to implement something like this
But more like this:
^-- this should make it, so your logic doesn't start executing until after the cluster.awsAuth/csi addon is fully established/deployed