This is an automated email from the ASF dual-hosted git repository.

nvollmar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-management.git


The following commit(s) were added to refs/heads/main by this push:
     new 5a94737  Reworks kubernetes crds to remove akka references (#78)
5a94737 is described below

commit 5a947376ccbb48980839e398b77e08032b621b67
Author: Nicolas Vollmar <[email protected]>
AuthorDate: Wed May 24 10:02:12 2023 +0200

    Reworks kubernetes crds to remove akka references (#78)
    
    * Reworks kubernetes crds to remove akka references
    
    * Extends migration guide for Kubernetes
---
 docs/src/main/paradox/kubernetes-lease.md          |  4 +-
 docs/src/main/paradox/migration.md                 | 23 +++++++++++
 lease-kubernetes/lease-example.yml                 |  4 +-
 lease-kubernetes/lease.yml                         |  4 +-
 .../kubernetes/internal/KubernetesApiImpl.scala    | 10 ++---
 .../internal/KubernetesJsonSupport.scala           |  2 +-
 .../lease/kubernetes/KubernetesApiSpec.scala       | 44 +++++++++++-----------
 7 files changed, 57 insertions(+), 34 deletions(-)

diff --git a/docs/src/main/paradox/kubernetes-lease.md 
b/docs/src/main/paradox/kubernetes-lease.md
index c28d6e4..121532a 100644
--- a/docs/src/main/paradox/kubernetes-lease.md
+++ b/docs/src/main/paradox/kubernetes-lease.md
@@ -69,7 +69,7 @@ apiVersion: rbac.authorization.k8s.io/v1
 metadata:
   name: lease-access
 rules:
-  - apiGroups: ["akka.io"]
+  - apiGroups: ["pekko.apache.org"]
     resources: ["leases"]
     verbs: ["get", "create", "update", "list"]
 ---
@@ -103,7 +103,7 @@ kubelctl create -f sbr-lease.yml -n <YOUR_NAMESPACE>
 Where `sbr-lease.yml` contains:
 
 ```yml
-apiVersion: "akka.io/v1"
+apiVersion: "pekko.apache.org/v1"
 kind: Lease
 metadata:
   name: <YOUR_ACTORSYSTEM_NAME>-pekko-sbr
diff --git a/docs/src/main/paradox/migration.md 
b/docs/src/main/paradox/migration.md
index f8fce07..ff337a1 100644
--- a/docs/src/main/paradox/migration.md
+++ b/docs/src/main/paradox/migration.md
@@ -13,3 +13,26 @@ Please refer to the [Akka Management migration 
guide](https://doc.akka.io/docs/a
 
 The default port has changed from Akka's 8558 to Pekko's 7626.
 
+
+### Kubernetes resources
+
+The CRD has been adapted for Pekko.
+
+For all your namespaces remove the leases
+```
+kubectl delete leases.akka.io --all -n <YOUR NAMSPACE>
+```
+
+And RBAC
+```bash
+kubectl delete role akka-lease-access
+kubectl delete sa akka-cluster
+kubectl delete rb akka-cluster-lease-access
+```
+
+And finally the CRD:
+```
+kubectl delete crd leases.akka.io
+```
+
+To prepare for Pekko Management, setup the CRD and RBAC again following 
@ref[kubernetes-lease](kubernetes-lease.md).
\ No newline at end of file
diff --git a/lease-kubernetes/lease-example.yml 
b/lease-kubernetes/lease-example.yml
index 79ea58a..65d761a 100644
--- a/lease-kubernetes/lease-example.yml
+++ b/lease-kubernetes/lease-example.yml
@@ -1,7 +1,7 @@
-apiVersion: "akka.io/v1" 
+apiVersion: "pekko.apache.org/v1"
 kind: Lease
 metadata:
-  name: akka-sbr
+  name: pekko-sbr
 spec:
   owner: ""
   time: 0
diff --git a/lease-kubernetes/lease.yml b/lease-kubernetes/lease.yml
index 93e2607..8772a60 100644
--- a/lease-kubernetes/lease.yml
+++ b/lease-kubernetes/lease.yml
@@ -2,9 +2,9 @@ apiVersion: apiextensions.k8s.io/v1
 kind: CustomResourceDefinition
 metadata:
   # name must match the spec fields below, and be in the form: <plural>.<group>
-  name: leases.akka.io
+  name: leases.pekko.apache.org
 spec:
-  group: akka.io
+  group: pekko.apache.org
   versions:
    - name: v1
      storage: true
diff --git 
a/lease-kubernetes/src/main/scala/org/apache/pekko/coordination/lease/kubernetes/internal/KubernetesApiImpl.scala
 
b/lease-kubernetes/src/main/scala/org/apache/pekko/coordination/lease/kubernetes/internal/KubernetesApiImpl.scala
index 5ccff72..f174f06 100644
--- 
a/lease-kubernetes/src/main/scala/org/apache/pekko/coordination/lease/kubernetes/internal/KubernetesApiImpl.scala
+++ 
b/lease-kubernetes/src/main/scala/org/apache/pekko/coordination/lease/kubernetes/internal/KubernetesApiImpl.scala
@@ -88,9 +88,9 @@ import javax.net.ssl.TrustManager
   log.debug("kubernetes access namespace: {}. Secure: {}", namespace, 
settings.secure)
 
   /*
-  PATH: to get all: /apis/akka.io/v1/namespaces/<namespace>/leases
-  PATH: to get a specific one: 
/apis/akka.io/v1/namespaces/<namespace>/leases/<lease-name>
-  curl -v -X POST localhost:8080/apis/akka.io/v1/namespaces/lease/leases/ -H 
"Content-Type: application/yaml" --data-binary "@lease-example.yml"
+  PATH: to get all: /apis/pekko.apache.org/v1/namespaces/<namespace>/leases
+  PATH: to get a specific one: 
/apis/pekko.apache.org/v1/namespaces/<namespace>/leases/<lease-name>
+  curl -v -X POST 
localhost:8080/apis/pekko.apache.org/v1/namespaces/lease/leases/ -H 
"Content-Type: application/yaml" --data-binary "@lease-example.yml"
 
   responds with either:
   409 Conflict Already Exists
@@ -127,7 +127,7 @@ import javax.net.ssl.TrustManager
   }
 
   /*
-curl -v -X PUT 
localhost:8080/apis/akka.io/v1/namespaces/lease/leases/sbr-lease --data-binary 
"@sbr-lease.yml" -H "Content-Type: application/yaml"
+curl -v -X PUT 
localhost:8080/apis/pekko.apache.org/v1/namespaces/lease/leases/sbr-lease 
--data-binary "@sbr-lease.yml" -H "Content-Type: application/yaml"
 PUTs must contain resourceVersions. Response:
 409: Resource version is out of date
 200 if it is updated
@@ -258,7 +258,7 @@ PUTs must contain resourceVersions. Response:
   }
 
   private def pathForLease(name: String): Uri.Path =
-    Uri.Path.Empty / "apis" / "akka.io" / "v1" / "namespaces" / namespace / 
"leases" / name
+    Uri.Path.Empty / "apis" / "pekko.apache.org" / "v1" / "namespaces" / 
namespace / "leases" / name
       .replaceAll("[^\\d\\w\\-\\.]", "")
       .toLowerCase
 
diff --git 
a/lease-kubernetes/src/main/scala/org/apache/pekko/coordination/lease/kubernetes/internal/KubernetesJsonSupport.scala
 
b/lease-kubernetes/src/main/scala/org/apache/pekko/coordination/lease/kubernetes/internal/KubernetesJsonSupport.scala
index 8fe5b12..67d828c 100644
--- 
a/lease-kubernetes/src/main/scala/org/apache/pekko/coordination/lease/kubernetes/internal/KubernetesJsonSupport.scala
+++ 
b/lease-kubernetes/src/main/scala/org/apache/pekko/coordination/lease/kubernetes/internal/KubernetesJsonSupport.scala
@@ -26,7 +26,7 @@ case class LeaseCustomResource(
     metadata: Metadata,
     spec: Spec,
     kind: String = "Lease",
-    apiVersion: String = "akka.io/v1")
+    apiVersion: String = "pekko.apache.org/v1")
 
 /**
  * INTERNAL API
diff --git 
a/lease-kubernetes/src/test/scala/org/apache/pekko/coordination/lease/kubernetes/KubernetesApiSpec.scala
 
b/lease-kubernetes/src/test/scala/org/apache/pekko/coordination/lease/kubernetes/KubernetesApiSpec.scala
index cc23f2a..8a5b4ab 100644
--- 
a/lease-kubernetes/src/test/scala/org/apache/pekko/coordination/lease/kubernetes/KubernetesApiSpec.scala
+++ 
b/lease-kubernetes/src/test/scala/org/apache/pekko/coordination/lease/kubernetes/KubernetesApiSpec.scala
@@ -82,16 +82,16 @@ class KubernetesApiSpec
     "be able to be created" in {
       val version = "1234"
       stubFor(
-        post(urlEqualTo("/apis/akka.io/v1/namespaces/lease/leases/lease-1"))
+        
post(urlEqualTo("/apis/pekko.apache.org/v1/namespaces/lease/leases/lease-1"))
           .willReturn(aResponse().withStatus(201).withHeader("Content-Type", 
"application/json").withBody(s"""
                |{
-               |    "apiVersion": "akka.io/v1",
+               |    "apiVersion": "pekko.apache.org/v1",
                |    "kind": "Lease",
                |    "metadata": {
                |        "name": "lease-1",
-               |        "namespace": "akka-lease-tests",
+               |        "namespace": "pekko-lease-tests",
                |        "resourceVersion": "$version",
-               |        "selfLink": 
"/apis/akka.io/v1/namespaces/akka-lease-tests/leases/lease-1",
+               |        "selfLink": 
"/apis/pekko.apache.org/v1/namespaces/pekko-lease-tests/leases/lease-1",
                |        "uid": "c369949e-296c-11e9-9c62-16f8dd5735ba"
                |    },
                |    "spec": {
@@ -115,16 +115,16 @@ class KubernetesApiSpec
       val updatedVersion = "3"
       val timestamp = System.currentTimeMillis()
       stubFor(
-        put(urlEqualTo(s"/apis/akka.io/v1/namespaces/lease/leases/$lease"))
+        
put(urlEqualTo(s"/apis/pekko.apache.org/v1/namespaces/lease/leases/$lease"))
           .willReturn(aResponse().withStatus(200).withHeader("Content-Type", 
"application/json").withBody(s"""
                |{
-               |    "apiVersion": "akka.io/v1",
+               |    "apiVersion": "pekko.apache.org/v1",
                |    "kind": "Lease",
                |    "metadata": {
                |        "name": "lease-1",
-               |        "namespace": "akka-lease-tests",
+               |        "namespace": "pekko-lease-tests",
                |        "resourceVersion": "$updatedVersion",
-               |        "selfLink": 
"/apis/akka.io/v1/namespaces/akka-lease-tests/leases/$lease",
+               |        "selfLink": 
"/apis/pekko.apache.org/v1/namespaces/pekko-lease-tests/leases/$lease",
                |        "uid": "c369949e-296c-11e9-9c62-16f8dd5735ba"
                |    },
                |    "spec": {
@@ -147,21 +147,21 @@ class KubernetesApiSpec
       val timestamp = System.currentTimeMillis()
       // Conflict
       stubFor(
-        put(urlEqualTo(s"/apis/akka.io/v1/namespaces/lease/leases/$lease"))
+        
put(urlEqualTo(s"/apis/pekko.apache.org/v1/namespaces/lease/leases/$lease"))
           .willReturn(aResponse().withStatus(StatusCodes.Conflict.intValue)))
 
       // Read to get version
       stubFor(
-        
get(urlEqualTo(s"/apis/akka.io/v1/namespaces/lease/leases/$lease")).willReturn(
+        
get(urlEqualTo(s"/apis/pekko.apache.org/v1/namespaces/lease/leases/$lease")).willReturn(
           
aResponse().withStatus(StatusCodes.OK.intValue).withHeader("Content-Type", 
"application/json").withBody(s"""
                |{
-               |    "apiVersion": "akka.io/v1",
+               |    "apiVersion": "pekko.apache.org/v1",
                |    "kind": "Lease",
                |    "metadata": {
                |        "name": "lease-1",
-               |        "namespace": "akka-lease-tests",
+               |        "namespace": "pekko-lease-tests",
                |        "resourceVersion": "$updatedVersion",
-               |        "selfLink": 
"/apis/akka.io/v1/namespaces/akka-lease-tests/leases/$lease",
+               |        "selfLink": 
"/apis/pekko.apache.org/v1/namespaces/pekko-lease-tests/leases/$lease",
                |        "uid": "c369949e-296c-11e9-9c62-16f8dd5735ba"
                |    },
                |    "spec": {
@@ -178,7 +178,7 @@ class KubernetesApiSpec
     "remove lease via DELETE" in {
       val lease = "lease-1"
       stubFor(
-        delete(urlEqualTo(s"/apis/akka.io/v1/namespaces/lease/leases/$lease"))
+        
delete(urlEqualTo(s"/apis/pekko.apache.org/v1/namespaces/lease/leases/$lease"))
           .willReturn(aResponse().withStatus(StatusCodes.OK.intValue)))
 
       val response = underTest.removeLease(lease).futureValue
@@ -192,20 +192,20 @@ class KubernetesApiSpec
       val timestamp = System.currentTimeMillis()
 
       stubFor(
-        
get(urlEqualTo(s"/apis/akka.io/v1/namespaces/lease/leases/$lease")).willReturn(
+        
get(urlEqualTo(s"/apis/pekko.apache.org/v1/namespaces/lease/leases/$lease")).willReturn(
           aResponse()
             .withFixedDelay((settings.apiServerRequestTimeout * 
2).toMillis.toInt) // Oh noes
             .withStatus(StatusCodes.OK.intValue)
             .withHeader("Content-Type", "application/json")
             .withBody(s"""
                |{
-               |    "apiVersion": "akka.io/v1",
+               |    "apiVersion": "pekko.apache.org/v1",
                |    "kind": "Lease",
                |    "metadata": {
                |        "name": "lease-1",
-               |        "namespace": "akka-lease-tests",
+               |        "namespace": "pekko-lease-tests",
                |        "resourceVersion": "$version",
-               |        "selfLink": 
"/apis/akka.io/v1/namespaces/akka-lease-tests/leases/$lease",
+               |        "selfLink": 
"/apis/pekko.apache.org/v1/namespaces/pekko-lease-tests/leases/$lease",
                |        "uid": "c369949e-296c-11e9-9c62-16f8dd5735ba"
                |    },
                |    "spec": {
@@ -226,11 +226,11 @@ class KubernetesApiSpec
       val lease = "lease-1"
 
       stubFor(
-        get(urlEqualTo(s"/apis/akka.io/v1/namespaces/lease/leases/$lease"))
+        
get(urlEqualTo(s"/apis/pekko.apache.org/v1/namespaces/lease/leases/$lease"))
           .willReturn(aResponse().withStatus(StatusCodes.NotFound.intValue)))
 
       stubFor(
-        
post(urlEqualTo(s"/apis/akka.io/v1/namespaces/lease/leases/$lease")).willReturn(
+        
post(urlEqualTo(s"/apis/pekko.apache.org/v1/namespaces/lease/leases/$lease")).willReturn(
           aResponse()
             .withFixedDelay((settings.apiServerRequestTimeout * 
2).toMillis.toInt) // Oh noes
             .withStatus(StatusCodes.OK.intValue)
@@ -247,7 +247,7 @@ class KubernetesApiSpec
       val lease = "lease-1"
       val owner = "client"
       stubFor(
-        
put(urlEqualTo(s"/apis/akka.io/v1/namespaces/lease/leases/$lease")).willReturn(
+        
put(urlEqualTo(s"/apis/pekko.apache.org/v1/namespaces/lease/leases/$lease")).willReturn(
           aResponse()
             .withFixedDelay((settings.apiServerRequestTimeout * 
2).toMillis.toInt) // Oh noes
             .withStatus(StatusCodes.OK.intValue)
@@ -260,7 +260,7 @@ class KubernetesApiSpec
     "timeout on remove lease " in {
       val lease = "lease-1"
       stubFor(
-        
delete(urlEqualTo(s"/apis/akka.io/v1/namespaces/lease/leases/$lease")).willReturn(
+        
delete(urlEqualTo(s"/apis/pekko.apache.org/v1/namespaces/lease/leases/$lease")).willReturn(
           aResponse()
             .withFixedDelay((settings.apiServerRequestTimeout * 
2).toMillis.toInt) // Oh noes
             .withStatus(StatusCodes.OK.intValue)))


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to