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

resource deployment #5

Open
wants to merge 13 commits into
base: deployingclusterbranch
Choose a base branch
from

Conversation

mayeradelman
Copy link

@mayeradelman mayeradelman commented Aug 8, 2022

Description:

Added CDK construct classes to represent Kubernetes resources as well as code to deploy these constructs based on user-provided configuration for a test-case.

To outline the general control flow: The deploy_resources function in resource-deployment.ts parses the configuration for the test-case (as provided in a YAML file) and instantiates a TestCaseResourceDeploymentConstruct passing the data as props. In turn, this construct instantiates a low-level NamespaceConstruct and high-level constructs GeneralSampleAppDeploymentConstruct and GeneralCollectorDeploymentConstruct, passing them the necessary props. Finally, based on the props these constructs instantiate the appropriate low-level constructs that define manifests for Kubernetes resources.

Documentation:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link

@bryan-aguilar bryan-aguilar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the README.md with additional documentation?

cdk_framework/EKS/lib/resource-deployment.ts Outdated Show resolved Hide resolved
Comment on lines +23 to +28
const grpcServiceName = 'collector-grpc'
const grpcPort = 4317
const udpServiceName = 'collector-udp'
const udpPort = 55690
const tcpServiceName = 'collector-tcp'
const httpPort = 4318

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If these are fixed values do they belong in this scope? Could we instead move them down a level, this would prevent us from having to pass them in as props to the to the sample app construct.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the collector needs these values we can just export them from the construct and reference them that way.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we could pass in the sample app as a prop to the collector and allow the collector construct to handle those values.

Copy link
Author

@mayeradelman mayeradelman Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure. On the one hand that is a lot cleaner, but if we're looking at the sample app from a more zoomed out perspective, would we want to allow users to configure the sample app the way that they want? Maybe we can have default values with optional parameters that the user can use to override them?

Comment on lines +32 to +33
const listenAddressHost = '0.0.0.0'
const listenAddressPort = 8080

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above, should we move these into the sample app construct as fixed values?

})

// used for when sample app is push mode
const deployServices = props.sampleAppMode === 'push'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't a service required for both push and pull sample apps?

Copy link
Author

@mayeradelman mayeradelman Aug 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are services for the collector. I believe those are only required for a push mode sample app where the collector receives the data from the sample app. For the pull mode case, the collector goes and scrapes the data from the sample app (through the sample app service) so it doesn't need its own services. I believe the TF framework also had this condition in the service deployments.

Comment on lines +41 to +64
cluster: props.cluster,
namespaceConstruct: props.namespaceConstruct,
sampleAppLabel: props.sampleAppLabel,
sampleAppImageURI: props.sampleAppImageURI,
grpcServiceName: props.grpcServiceName,
grpcPort: props.grpcPort,
udpServiceName: props.udpServiceName,
udpPort: props.udpPort,
tcpServiceName: props.tcpServiceName,
httpPort: props.httpPort,
listenAddressHost: props.listenAddressHost,
listenAddressPort: props.listenAddressPort,
region: props.region
})
}
else if (props.sampleAppMode === 'pull'){
new PullModeSampleAppDeploymentConstruct(this, 'pull-mode-sample-app-construct', {
cluster: props.cluster,
namespaceConstruct: props.namespaceConstruct,
sampleAppLabel: props.sampleAppLabel,
sampleAppImageURI: props.sampleAppImageURI,
listenAddressHost: props.listenAddressHost,
listenAddressPort: props.listenAddressPort,
region: props.region

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use interfaces to expose these props and then do something like <push/pull>sampleAppProps = props as <push/pull>SampleAppProps?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could export the props interface in the push and pull mode sample apps and instantiate an instance of that interface, but then the same code would be required to instantiate the appropriate interface and give it the required props. Maybe I'm misunderstanding the suggestion.

@mayeradelman mayeradelman changed the base branch from deployingclusterbranch to dev/cdk August 18, 2022 18:13
@mayeradelman mayeradelman changed the base branch from dev/cdk to deployingclusterbranch August 18, 2022 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants