Skip to content

Commit

Permalink
put some fakes
Browse files Browse the repository at this point in the history
  • Loading branch information
louiseschmidtgen committed Jun 5, 2024
1 parent 0e2e8be commit e1cd4f2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/k8s/pkg/k8sd/features/fake/load-balancer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package fake

import (
"context"

"github.com/canonical/k8s/pkg/k8sd/types"
"github.com/canonical/k8s/pkg/snap"
)

// ApplyLoadBalancer is a dummy implementation of the ApplyLoadBalancer function. It does nothing and returns nil.
func ApplyLoadBalancer(ctx context.Context, snap snap.Snap, loadbalancer types.LoadBalancer, network types.Network, _ types.Annotations) error {
return nil
}
18 changes: 18 additions & 0 deletions src/k8s/pkg/k8sd/features/fake/network.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package fake

import (
"context"

"github.com/canonical/k8s/pkg/k8sd/types"
"github.com/canonical/k8s/pkg/snap"
)

// ApplyNetwork is a dummy implementation of the ApplyNetwork function. It does nothing and returns nil.
func ApplyNetwork(ctx context.Context, snap snap.Snap, cfg types.Network, _ types.Annotations) error {
return nil
}

// CheckNetwork is a dummy implementation of the CheckNetwork function. It does nothing and returns true.
func CheckNetwork(ctx context.Context, snap snap.Snap) (bool, error) {
return true, nil
}
10 changes: 5 additions & 5 deletions src/k8s/pkg/k8sd/features/implementation_default.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package features

import (
"github.com/canonical/k8s/pkg/k8sd/features/cilium"
"github.com/canonical/k8s/pkg/k8sd/features/contour"
"github.com/canonical/k8s/pkg/k8sd/features/coredns"
"github.com/canonical/k8s/pkg/k8sd/features/fake"
"github.com/canonical/k8s/pkg/k8sd/features/localpv"
metrics_server "github.com/canonical/k8s/pkg/k8sd/features/metrics-server"
)
Expand All @@ -15,16 +15,16 @@ import (
// LocalPV Rawfile CSI is used for local-storage.
var Implementation Interface = &implementation{
applyDNS: coredns.ApplyDNS,
applyNetwork: cilium.ApplyNetwork,
applyLoadBalancer: cilium.ApplyLoadBalancer,
applyIngress: contour.ApplyIngress, //TODO: remove default overwrite for testing
applyNetwork: fake.ApplyNetwork, //TODO: remove default overwrite for testing
applyLoadBalancer: fake.ApplyLoadBalancer,
applyIngress: contour.ApplyIngress,
applyGateway: contour.ApplyGateway,
applyMetricsServer: metrics_server.ApplyMetricsServer,
applyLocalStorage: localpv.ApplyLocalStorage,
}

// StatusChecks implements the Canonical Kubernetes built-in feature status checks.
var StatusChecks StatusInterface = &statusChecks{
checkNetwork: cilium.CheckNetwork,
checkNetwork: fake.CheckNetwork,
checkDNS: coredns.CheckDNS,
}

0 comments on commit e1cd4f2

Please sign in to comment.