formatting
This commit is contained in:
@@ -46,7 +46,6 @@ type NetworkconfigurationSpec struct {
|
|||||||
SettingPreference string `json:"setting_preference,omitempty"`
|
SettingPreference string `json:"setting_preference,omitempty"`
|
||||||
Vlan int64 `json:"vlan,omitempty"`
|
Vlan int64 `json:"vlan,omitempty"`
|
||||||
VlanEnabled bool `json:"vlan_enabled,omitempty"`
|
VlanEnabled bool `json:"vlan_enabled,omitempty"`
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NetworkconfigurationStatus defines the observed state of Networkconfiguration.
|
// NetworkconfigurationStatus defines the observed state of Networkconfiguration.
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ package controller
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
@@ -27,8 +27,8 @@ import (
|
|||||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||||
|
|
||||||
unifiv1beta1 "github.com/vegardengen/unifi-network-operator/api/v1beta1"
|
|
||||||
goUnifi "github.com/vegardengen/go-unifi/unifi"
|
goUnifi "github.com/vegardengen/go-unifi/unifi"
|
||||||
|
unifiv1beta1 "github.com/vegardengen/unifi-network-operator/api/v1beta1"
|
||||||
"github.com/vegardengen/unifi-network-operator/internal/unifi"
|
"github.com/vegardengen/unifi-network-operator/internal/unifi"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -53,8 +53,6 @@ type FirewallGroupReconciler struct {
|
|||||||
// For more details, check Reconcile and its Result here:
|
// For more details, check Reconcile and its Result here:
|
||||||
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/reconcile
|
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/reconcile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func (r *FirewallGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
func (r *FirewallGroupReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
||||||
log := log.FromContext(ctx)
|
log := log.FromContext(ctx)
|
||||||
var nwObj unifiv1beta1.FirewallGroup
|
var nwObj unifiv1beta1.FirewallGroup
|
||||||
@@ -103,7 +101,7 @@ func (r *FirewallGroupReconciler) Reconcile(ctx context.Context, req ctrl.Reques
|
|||||||
ipv6_done := false
|
ipv6_done := false
|
||||||
for _, firewall_group := range firewall_groups {
|
for _, firewall_group := range firewall_groups {
|
||||||
if firewall_group.Name == ipv4_name {
|
if firewall_group.Name == ipv4_name {
|
||||||
if(len(ipv4) == 0) {
|
if len(ipv4) == 0 {
|
||||||
log.Info(fmt.Sprintf("Delete %s", ipv4_name))
|
log.Info(fmt.Sprintf("Delete %s", ipv4_name))
|
||||||
err := r.UnifiClient.Client.DeleteFirewallGroup(context.Background(), r.UnifiClient.SiteID, firewall_group.ID)
|
err := r.UnifiClient.Client.DeleteFirewallGroup(context.Background(), r.UnifiClient.SiteID, firewall_group.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -125,7 +123,7 @@ func (r *FirewallGroupReconciler) Reconcile(ctx context.Context, req ctrl.Reques
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if firewall_group.Name == ipv6_name {
|
if firewall_group.Name == ipv6_name {
|
||||||
if(len(ipv6) == 0) {
|
if len(ipv6) == 0 {
|
||||||
log.Info(fmt.Sprintf("Delete %s", ipv6_name))
|
log.Info(fmt.Sprintf("Delete %s", ipv6_name))
|
||||||
err := r.UnifiClient.Client.DeleteFirewallGroup(context.Background(), r.UnifiClient.SiteID, firewall_group.ID)
|
err := r.UnifiClient.Client.DeleteFirewallGroup(context.Background(), r.UnifiClient.SiteID, firewall_group.ID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -62,8 +62,6 @@ func (r *NetworkconfigurationReconciler) Reconcile(ctx context.Context, req ctrl
|
|||||||
k8sNetworks[networkCRDs.Items[i].Spec.NetworkID] = &networkCRDs.Items[i]
|
k8sNetworks[networkCRDs.Items[i].Spec.NetworkID] = &networkCRDs.Items[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
networks, err := r.UnifiClient.Client.ListNetwork(context.Background(), r.UnifiClient.SiteID)
|
networks, err := r.UnifiClient.Client.ListNetwork(context.Background(), r.UnifiClient.SiteID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err, "Failed to list Unifi Networks")
|
log.Error(err, "Failed to list Unifi Networks")
|
||||||
|
|||||||
Reference in New Issue
Block a user