[HERON-3707] ConfigMap Pod Template Support (#3710)

* [Kubernetes] setup basic mount info for Pod ConfigMap.

* [Kubernetes] updated function signature to handle Pod Template ConfigMap name.

* [kubernetes] extracting Pod Template ConfigMap name from <Config>.

* [kubernetes] checking for Pod Template ConfigMap and appropriately adding to Stateful Set.

* [kubernetes] Java Style lint fix.

* [Tests] Kubernetes Controller tests for Pod Template ConfigMap.

* [Tests] Kubernetes Constants and Context tests for Pod Template ConfigMap.

* [Tests] Kubernetes V1Controller test suite stubbed.

* [Tests] Java style lint fixed.

* [Tests] Kubernetes V1Controller Pod Template ConfigMap volume mount.

* [Kubernetes] cleaned up to begin work on <loadPodFromTemplate>.

* [Kubernetes] created <loadPodFromTemplate>.

* [Tests] Begun mock test setup of <loadPodFromTemplate>.

* [Kubernetes] style check/linting fix.

* [Kubernetes] refactoring <V1Controller> and <KubernetesController>.

* [Kubernetes] added description to failed to locate exception.

* [Tests] <loadPodFromTemplate> Pod Template checks.

* [Kubernetes] check for no ConfigMaps set.

* [Tests] working on mocking null list of V1ConfigMapList.

* [Kubernetes] refactoring <loadPodFromTemplate> 

Adding checks for null pointers. Default constructed V1 objects tend to have uninitialised fields set to null by default. Extracting <getConfigMaps> to method to support mocking.

* [Tests] Stubbed <getConfigMaps> and testing <loadPodFromTemplate>.

* [Kubernetes] <loadPodFromTemplate> adjusted to get <V1PodTemplateSpec> from <V1PodTemplate>.

* [Kubernetes] check for empty Pod Template in ConfigMap.

* [Tests] Valid Pod Template test.

* [Tests] Invalid Pod Template.

* [Tests] refactored test data to their respective tests.

* [Kubernetes] refactored <loadPodFromTemplate> for readability.

* [Kubernetes] params for <getConfigMaps> tweaked.

Judging from <release-11.0.0/kubernetes/src/main/java/io/kubernetes/client/openapi/apis/CoreV1Api.java> "optional" means the field can be set to <null>.

* [Kubernetes] <getPodTemplateLocation> extracting ConfigMap and Pod Template names.

* [Tests] <getPodTemplateLocation> for correct and incorrect parsing.

* [Kubernetes] <getPodTemplateLocation> catching empty names.

* [Tests] <getPodTemplateLocation> separated tests for ConfigMap and Pod Template names.

* [Kubernetes] updated <loadPodFromTemplate> to use ConfigMap and Pod Template names.

* [Tests] updated tests for <loadPodFromTemplate> to use ConfigMap and Pod Template names.

* [Kubernetes] added INFO logging to <loadPodFromTemplate> for the deployed Pod Template.

* [Kubernetes] Bug fixes in error messages for <loadPodFromTemplate>.

* [Kubernetes] bug fix and test for missing delimiter in <getPodTemplateLocation>.

* [Kubernetes] <getConfigMaps> namespace access updated.

* [Kubernetes] <configureRBAC> basic logic.

TODO: get API key for K8s.

* [Tests] cleaned up <V1Controller> tests.

* [Kubernetes] <configureRBAC> more detailed error log.

* [Kubernetes] <configureRBAC> role configurations.

* [Kubernetes] refactored <loadFromPodTemplate>.

* [Tests] switched to <ConfigMapBuilder> in <V1ControllerTest>.

* [Kubernetes] switched to <V1RoleBuilder> in <configureRBAC>.

* [Kubernetes] made <loadPodFromTemplate> protected.

Removed illegal reflection access to avoid support issues with newer testing frameworks.

* [Kubernetes] removed <configureRBAC>.

RBAC must be configured using Role/ClusterRole and RoleBinding/ClusterRoleBinding to the Heron <heron-apiserver> ServiceAccount.

* [Kubernetes] <getPodTemplateLocation> error message passed up.

* [Kubernetes] refactored <getPodSpec> to <finalizePodSpec>.

Heron should have the final say on the Pod Spec. This is as much a point of security as an operational one.

* [Kubernetes] Added boot flag to disable Pod Templates.

* [Tests] testing to validate boot flag for disabled Pod Templates.

* [Kubernetes] Wiring in boot flag to disable Pod Templates in  <loadPodFromTemplate>.

* [Tests] disabled Pod Templates output validation.

* [Kubernetes] Added class scoped variable <isPodTemplateDisabled>.

* [Kubernetes] <getContainer> modified to utilise supplied executor container.

* [Kubernetes] <getContainer> <V1EnvVar>s.

Environment variables merged with Heron defaults taking precedence.

* [Kubernetes] <getContainer> Limits.

Resource Limits merged with Heron defaults taking precedence.

* [Kubernetes] disabled Pod Templates will return error when attempting to submit.

* [Kubernetes] <API Server> configs.

Updated RBAC API version and added a commented flag command to disable to Pod Templates.

* [Kubernetes] <configureExecutorContainer>

Refactored <getContainer> to <configureExecutorContainer>. Permitting additional containers for side-car purposes.

* [Kubernetes] <configureExecutorContainer>

Switched to <TreeSet> with custom comparator for <V1EnvVar> name. <V1EnvVar>'s comparator performs a complete element wise comparison.

* [Kubernetes] <configureExecutorContainer>

Merged executor container ports with ports provided in Pod Template. Heron defaults take precedence.

* [Kubernetes] <mountVolumeIfPresent>

Merge volume mounts with those provided in Pod Template. Heron defaults take precedence.

* [Kubernetes] <V1Controller>

general cleanup of new code and comments.

* [Kubernetes] <mountVolumeIfPresent>

Error check for malformed Pod Template.

* [Kubernetes] <configureContainerPorts>

Refactored <getContainerPorts> and moved port merge with error handling to it.

* [Kubernetes] <configureExecutorContainer>

Removed a redundant <limit> put into the HashMap.

* [Kubernetes] <addVolumesIfPresent>

Merging Pod Template volume configs with Heron defaults. Heron values take precedence.

* [Kubernetes] <configureExecutorContainer>

Allow user values for CPU and MEMORY limits to override those provided by Heron.

* [Scheduler-Core] <LaunchRunner> handling <submit> errors better.

Some Schedulers, such as K8s, throw exceptions instead of returning false when <submit> fails. This leaves the Topology Manager with dangling references. An addition RPC call to the Scheduler is required to completely clear the state.

* [Kubernetes] <V1Controller>

General cleanup in tests and class.

* [Kubernetes] code review changes.

Code review from @nwangtw.
<KubernetesContext.getPodTemplateConfigMapDisabled> switched to <equalsIgnoreCase>.

* [Scheduler-Core] code review changes.

Code review from @nwangtw.
<LaunchRunner> error message assembly improved.
<LaunchRunner> added <FINE> level logging for failure to clear failed topology launch from Scheduler.

* [Tests] <configureContainerPorts>.

* [Kubernetes] <API Server> configs.

Code review from @nwangtw, @nicknezis.
Updated command to disable Pod Templates to <false> by default.

* [Kubernetes] <configureContainerEnvVars>

Logic for merging environment variables extracted to a method for testing.

* [Tests] <configureContainerEnvVars>.

* [Kubernetes] <configureExecutorContainer>

Wired in <configureContainerEnvVars> and removed old code.

* Update for Helm chart

* Updated version to match the other k8s ClusterRoleBindings

* [Kubernetes] <configureContainerResources>

Logic to configure container's resources extracted to method to facilitate testing.

* [Kubernetes] <configureExecutorContainer>

Removed old logic and wired <configureContainerResources> into <configureExecutorContainer>.

* [Tests] <testConfigureContainerPorts>.

Added a test for debugging ports.

* [Kubernetes] <addVolumesIfPresent>.

Exposed for testing.

* [Tests] <addVolumesIfPresent>.

Testing on a <hostPath> volume but will generalise across others.

* [Kubernetes] <mountVolumeIfPresent>.

Exposed for testing.

* [Tests] <mountVolumeIfPresent>.

Tested by setting a Volume Mount in the Config and then a custom Volume Mount in the container.

* [Tests] <addVolumesIfPresent>.

Cleaned up tests.

* [Tests] <mountVolumesIfPresent>.

Testing for when no Volume Mounts should be set.

* [Tests] <addVolumesIfPresent>.

Testing for when no Volumes should be set.

* Attempt to fix Travis CI build

* [Tests] <configureContainerEnvVars> <configureContainerPorts>.

Extracted logic to generate executor environment variables, ports, and debugging ports. This is to resolve production-testing code inconsistencies which may arise.

* [Tests] <V1ControllerTests>

General cleanup and simplification of test suite.

* Travis fix take 3

* Travis CI fix

* [Kubernetes] <V1ControllerUtils>

Added nested utility class to improve code maintainability.

<mergeListDedupe> will merge two input lists by keeping all values in one and deduplicating the second list.

* [Tests] <mergeListDedupe>.

Full battery of tests null lists, merged lists, and thrown errors.

* [Kubernetes] <V1Controller>.

Switched to using <mergeListsDedupe> to improve code maintainability.
Effects:
<addVolumesIfPresent>
<configureContainerEnvVars>
<configureContainerPorts>
<mountVolumeIfPresent>

* [Kubernetes] <V1Controller> cleaned up unneeded returns when using setter methods.

* [Kubernetes] <V1Controller>.

Merging Pod Specification Tolerations and deduplicating on the <V1Tolerations::key>.

* [Tests] <configureTolerations>.

Test for a null, empty, and merging of Toleration lists.

* [Kubernetes] <configurePodSpec>.

Wired in <configureTolerations>

* [Tests] cleaning up code.

* [Kubernetes] <configurePodSpec>.

Added check for multiple executor container specs in Pod Template. Will throw error if detected.

* [Tests] <V1Controller> general cleanup.

* [Kubernetes] Constants

Updated tolerations to remove deprecated taints.

* [Kubernetes] <V1Controller>

<getConfigMap> retrieving a single named ConfigMap in a specific namespace.
<loadPodFromTemplate> logic updated to handle a single ConfigMap.

* [Tests] <V1Controller>

Fixed and cleaned up tests after switching to <readNamespacedConfigMap>.

* [Kubernetes] <V1Controller>

Error message cleanup.

* [Tests] <V1Controller>

Test description cleanup.

* [Kubernetes] <KubernetesUtils>

Javadoc cleanup.

* [Tests] <KubernetesUtils>

Test description cleanup.

* [Tests] <V1Controller>

<configureContainerResources> Heron values take precedence for limits.

* [Kubernetes] <V1Controller>

<configureContainerResources> Heron values take precedence for limits.

* Add support for reading configmap

* Removed deprecated k8s tolerations

Co-authored-by: Nicholas Nezis <nicholas.nezis@gmail.com>
16 files changed
tree: 909368bf757b8179e14511c1e9e5217f03eda253
  1. .github/
  2. config/
  3. contrib/
  4. deploy/
  5. docker/
  6. eco/
  7. eco-heron-examples/
  8. eco-storm-examples/
  9. examples/
  10. heron/
  11. heronpy/
  12. integration_test/
  13. licenses/
  14. release/
  15. scripts/
  16. storm-compatibility/
  17. storm-compatibility-examples/
  18. third_party/
  19. tools/
  20. vagrant/
  21. website2/
  22. .asf.yaml
  23. .bazelrc
  24. .bazelversion
  25. .gitattributes
  26. .gitignore
  27. .rat-excludes
  28. .travis.yml
  29. ADOPTERS.md
  30. bazel_configure.py
  31. BUILD
  32. CONTRIBUTING.md
  33. DISCLAIMER
  34. index.html
  35. LICENSE
  36. maven_install.json
  37. NOTICE
  38. README.md
  39. WORKSPACE
README.md

Build Status

logo

Heron is a realtime analytics platform developed by Twitter. It has a wide array of architectural improvements over it's predecessor.

Heron in Apache Incubation

Documentation

https://heron.incubator.apache.org/ Confluence: https://cwiki.apache.org/confluence/display/HERON

Heron Requirements:

  • Java 11
  • Python 3.6
  • Bazel 4.1.0

Contact

Mailing lists

NameScope
user@heron.incubator.apache.orgUser-related discussionsSubscribeUnsubscribeArchives
dev@heron.incubator.apache.orgDevelopment-related discussionsSubscribeUnsubscribeArchives

Slack

Self-Register to our Heron Slack Workspace

Meetup Group

Bay Area Heron Meetup, We meet on Third Monday of Every Month in Palo Alto.

For more information:

License

Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0