Skip to content

Commit

Permalink
feat: Native-image metadata and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
johanandren committed Feb 19, 2024
1 parent cee6fd5 commit 434cb7d
Show file tree
Hide file tree
Showing 13 changed files with 287 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[
{
"name": "akka.management.cluster.bootstrap.LowestAddressJoinDecider",
"methods": [
{
"name": "<init>",
"parameterTypes": ["akka.actor.ActorSystem", "akka.management.cluster.bootstrap.ClusterBootstrapSettings"]
}
]
},
{
"name": "akka.management.cluster.bootstrap.ClusterBootstrap$",
"fields": [
{
"name": "MODULE$"
}
]
},
{
"name": "akka.management.cluster.bootstrap.ClusterBootstrap",
"methods": [
{
"name": "<init>",
"parameterTypes": ["akka.actor.ExtendedActorSystem"]
}
]
},
{
"name": "akka.management.cluster.bootstrap.contactpoint.HttpBootstrapJsonProtocol$SeedNode",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.management.cluster.bootstrap.contactpoint.HttpBootstrapJsonProtocol$ClusterMember",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.management.cluster.bootstrap.contactpoint.HttpBootstrapJsonProtocol$SeedNodes",
"allDeclaredFields": true,
"queryAllPublicMethods": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ trait HttpBootstrapJsonProtocol extends SprayJsonSupport with DefaultJsonProtoco

override def write(obj: Address): JsValue = JsString(obj.toString)
}

// If adding more formats here, remember to also add in META-INF/native-image reflect config
implicit val SeedNodeFormat: RootJsonFormat[SeedNode] = jsonFormat1(SeedNode.apply)
implicit val ClusterMemberFormat: RootJsonFormat[ClusterMember] = jsonFormat4(ClusterMember.apply)
implicit val ClusterMembersFormat: RootJsonFormat[SeedNodes] = jsonFormat2(SeedNodes.apply)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[
{
"name": "akka.management.cluster.ClusterHttpManagementRouteProvider$",
"fields": [ {
"name": "MODULE$"
} ]
},
{
"name": "akka.management.cluster.javadsl.ClusterMembershipCheck",
"methods": [{
"name": "<init>",
"parameterTypes": ["akka.actor.ActorSystem"]
}]
},
{
"name": "akka.management.cluster.scaladsl.ClusterMembershipCheck",
"methods": [{
"name": "<init>",
"parameterTypes": ["akka.actor.ActorSystem"]
}]
},
{
"name": "akka.management.cluster.ClusterUnreachableMember",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.management.cluster.ClusterMember",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.management.cluster.ClusterMembers",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.management.cluster.ClusterHttpManagementMessage",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.management.cluster.ShardEntityTypeKeys",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.management.cluster.ShardRegionInfo",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.management.cluster.ShardDetails",
"allDeclaredFields": true,
"queryAllPublicMethods": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ final case class ShardDetails(regions: immutable.Seq[ShardRegionInfo])
}

trait ClusterHttpManagementJsonProtocol extends SprayJsonSupport with DefaultJsonProtocol {
// If adding more formats here, remember to also add in META-INF/native-image reflect config
implicit val clusterUnreachableMemberFormat: RootJsonFormat[ClusterUnreachableMember] =
jsonFormat2(ClusterUnreachableMember.apply)
implicit val clusterMemberFormat: RootJsonFormat[ClusterMember] = jsonFormat4(ClusterMember.apply)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[
{
"name": "akka.discovery.kubernetes.KubernetesApiServiceDiscovery",
"methods": [
{
"name": "<init>",
"parameterTypes": [
"akka.actor.ActorSystem"
]
}
]
},
{
"name": "akka.discovery.kubernetes.PodList$ContainerPort",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.discovery.kubernetes.PodList.Container",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.discovery.kubernetes.PodList.PodSpec",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.discovery.kubernetes.PodList.ContainerStatus",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.discovery.kubernetes.PodList.PodStatus",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.discovery.kubernetes.PodList.Pod",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.discovery.kubernetes.PodList.Metadata",
"allDeclaredFields": true,
"queryAllPublicMethods": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import spray.json._
* INTERNAL API
*/
@InternalApi private[akka] object JsonFormat extends SprayJsonSupport with DefaultJsonProtocol {
// If adding more formats here, remember to also add in META-INF/native-image reflect config
implicit val containerPortFormat: JsonFormat[ContainerPort] = jsonFormat2(ContainerPort.apply)
implicit val containerFormat: JsonFormat[Container] = jsonFormat2(Container.apply)
implicit val podSpecFormat: JsonFormat[PodSpec] = jsonFormat1(PodSpec.apply)
Expand Down
1 change: 1 addition & 0 deletions docs/src/main/paradox/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ Various parts of Akka management can be used together for deploying Akka Cluster
- [Akka Cluster Management (JMX)](cluster-jmx-management.md)
- [Dynamic Log Levels](loglevels/index.md)
- [Akka Coordination Lease for Kubernetes](kubernetes-lease.md)
- [Native Image](native-image.md)
@@@
14 changes: 14 additions & 0 deletions docs/src/main/paradox/native-image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Building Native Images

Building native images with Akka HTTP is supported out of the box for the following modules:

* akka-management
* akka-management-cluster-bootstrap
* akka-management-cluster-http
* akka-management-discovery-kubernetes-api
* akka-lease-kubernetes
* akka-rolling-upgrade-kubernetes

Other modules can likely be used but will require figuring out and adding additional native-image metadata.

For details about building native images with Akka in general, see the @extref[Akka Documentation](akka:additional/native-image.html).
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"name": "akka.coordination.lease.kubernetes.KubernetesLease",
"methods": [
{
"name": "<init>",
"parameterTypes": ["akka.coordination.lease.LeaseSettings", "akka.actor.ExtendedActorSystem"]
}
]
},
{
"name": "akka.coordination.lease.kubernetes.internal.LeaseCustomResource",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.coordination.lease.kubernetes.internal.Metadata",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.coordination.lease.kubernetes.internal.Spec",
"allDeclaredFields": true,
"queryAllPublicMethods": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ case class Spec(owner: String, time: Long)
*/
@InternalApi
trait KubernetesJsonSupport extends SprayJsonSupport with DefaultJsonProtocol {
// If adding more formats here, remember to also add in META-INF/native-image reflect config
implicit val metadataFormat: JsonFormat[Metadata] = jsonFormat2(Metadata.apply)
implicit val specFormat: JsonFormat[Spec] = jsonFormat2(Spec.apply)
implicit val leaseCustomResourceFormat: RootJsonFormat[LeaseCustomResource] = jsonFormat4(LeaseCustomResource.apply)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[
{
"name": "akka.management.scaladsl.AkkaManagement$",
"fields": [ {
"name": "MODULE$"
} ]
},
{
"name": "akka.management.HealthCheckRoutes",
"methods": [{
"name": "<init>",
"parameterTypes": ["akka.actor.ExtendedActorSystem"]
}]
}
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
[
{
"name": "akka.rollingupdate.kubernetes.AppVersionRevision$",
"fields": [
{
"name": "MODULE$"
}
]
},
{
"name": "akka.rollingupdate.kubernetes.PodDeletionCost$",
"fields": [
{
"name": "MODULE$"
}
]
},
{
"name": "akka.management.cluster.bootstrap.ClusterBootstrap",
"methods": [
{
"name": "<init>",
"parameterTypes": ["akka.actor.ExtendedActorSystem"]
}
]
},
{
"name": "akka.rollingupdate.kubernetes.Metadata",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.rollingupdate.kubernetes.PodCost",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.rollingupdate.kubernetes.Spec",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.rollingupdate.kubernetes.PodCostCustomResource",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.rollingupdate.kubernetes.PodOwnerRef",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.rollingupdate.kubernetes.PodMetadata",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.rollingupdate.kubernetes.Pod",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.rollingupdate.kubernetes.ReplicaAnnotation",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.rollingupdate.kubernetes.ReplicaSetMetadata",
"allDeclaredFields": true,
"queryAllPublicMethods": true
},
{
"name": "akka.rollingupdate.kubernetes.ReplicaSet",
"allDeclaredFields": true,
"queryAllPublicMethods": true
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ case class Spec(pods: immutable.Seq[PodCost])
*/
@InternalApi
trait KubernetesJsonSupport extends SprayJsonSupport with DefaultJsonProtocol {
// If adding more formats here, remember to also add in META-INF/native-image reflect config
implicit val metadataFormat: JsonFormat[Metadata] = jsonFormat2(Metadata.apply)
implicit val podCostFormat: JsonFormat[PodCost] = jsonFormat5(PodCost.apply)
implicit val specFormat: JsonFormat[Spec] = jsonFormat1(Spec.apply)
Expand Down

0 comments on commit 434cb7d

Please sign in to comment.