Skip to content

Commit

Permalink
Merge pull request juju#18273 from jack-w-shaw/JUJU-6718_remove_ports…
Browse files Browse the repository at this point in the history
…_mongo

juju#18273

Stop dual-writing ports data to Mongo now that all read sites have been transitioned over to DQLite.

This means the Mongo ports collection is now unused. Remove the collection, and all the code to manipulate ports in Mongo

Remove some unused mocks from certain facades

## QA steps

Juju compiles

#### IAAS

```
$ juju bootstrap aws aws
$ juju add-model m
$ juju deploy ubuntu
$ juju expose ubuntu
$ juju exec --unit ubuntu/0 open-port 1000/tcp
$ juju exec --unit ubuntu/0 opened-ports
1000/tcp
```
& verify in aws 1000/tcp has been opened for the unit

#### CAAS

(remember to run `make microk8s-operator-upgrade`)

```
$ juju bootstrap microk8s mk8s
$ juju add-model m
$ juju deploy hello-kubecon
$ juju exec --unit hello-kubecon/0 open-port 1000/tcp
$ juju exec --unit hello-kubecon/0 opened-ports
1000/tcp
```
& verify in microk8s port 1000/tcp has been opened for the unit
  • Loading branch information
jujubot authored Oct 18, 2024
2 parents 0bf069e + 8ea55c4 commit daceebc
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 1,970 deletions.
1 change: 0 additions & 1 deletion apiserver/common/firewall/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ func (st stateShim) Unit(name string) (Unit, error) {
type Machine interface {
Id() string
WatchAddresses() state.NotifyWatcher
OpenedPortRanges() (state.MachinePortRanges, error)
IsManual() (bool, error)
}

Expand Down
8 changes: 0 additions & 8 deletions apiserver/facades/agent/uniter/uniter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2602,11 +2602,6 @@ func (u *UniterAPI) commitHookChangesForOneUnit(ctx context.Context, unitTag nam
}

if len(changes.OpenPorts)+len(changes.ClosePorts) > 0 {
pcp, err := unit.OpenedPortRanges()
if err != nil {
return errors.Trace(err)
}

openPorts := network.GroupedPortRanges{}
for _, r := range changes.OpenPorts {
// Ensure the tag in the port open request matches the root unit name
Expand All @@ -2625,7 +2620,6 @@ func (u *UniterAPI) commitHookChangesForOneUnit(ctx context.Context, unitTag nam
Protocol: r.Protocol,
}
openPorts[r.Endpoint] = append(openPorts[r.Endpoint], portRange)
pcp.Open(r.Endpoint, portRange)
}

closePorts := network.GroupedPortRanges{}
Expand All @@ -2641,9 +2635,7 @@ func (u *UniterAPI) commitHookChangesForOneUnit(ctx context.Context, unitTag nam
Protocol: r.Protocol,
}
closePorts[r.Endpoint] = append(closePorts[r.Endpoint], portRange)
pcp.Close(r.Endpoint, portRange)
}
modelOps = append(modelOps, pcp.Changes())

unitUUID, err := u.applicationService.GetUnitUUID(ctx, unitTag.Id())
if err != nil {
Expand Down
Loading

0 comments on commit daceebc

Please sign in to comment.