canonical / observability-libs

A collection of charm libraries curated by the Observability team.
https://charmhub.io/observability-libs
Apache License 2.0
3 stars 8 forks source link

Service deleted in a scale down operation #101

Closed marceloneppel closed 2 weeks ago

marceloneppel commented 2 months ago

Bug Description

Using the latest kubernetes_service_patch LIBPATCH, the main charm service is deleted in a scale down operation.

To Reproduce

  1. git clone https://github.com/marceloneppel/service-removal-test-operator
  2. cd service-removal-test-operator
  3. charmcraft pack
  4. juju deploy ./*.charm --resource some-container-image=ubuntu/nginx -n 2 --trust
  5. kubectl get svc -n dev
    NAME                                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)     AGE
    modeloperator                             ClusterIP   10.152.183.182   <none>        17071/TCP   88s
    service-removal-test-operator             ClusterIP   10.152.183.170   <none>        65535/TCP   10s
    service-removal-test-operator-endpoints   ClusterIP   None             <none>        <none>      9s
  6. juju scale-application service-removal-test-operator 1
  7. kubectl get svc -n dev
    NAME                                      TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)     AGE
    modeloperator                             ClusterIP   10.152.183.182   <none>        17071/TCP   2m6s
    service-removal-test-operator-endpoints   ClusterIP   None             <none>        <none>      47s

Environment

Juju is being executed in an AWS EC2 VM (Ununtu 24.04) A local charm is being used. Juju version (both CLI and agent): 3.5.1 Microk8s: v1.30.0 (strict)

Relevant log output

unit-service-removal-test-operator-1: 12:41:51 INFO unit.service-removal-test-operator/1.juju-log HTTP Request: DELETE https://10.152.183.1/api/v1/namespaces/dev/services/service-removal-test-operator "HTTP/1.1 200 OK"

Additional context

No response

lucabello commented 1 month ago

I believe that KubernetesServicePatch is meant to be (or should be) deprecated.

You should probably use self.unit.set_ports() instead.