Compare commits
9 Commits
14-create-
...
19-create-
| Author | SHA1 | Date | |
|---|---|---|---|
| 46d5e2ce2a | |||
| 7b2acb168a | |||
| 46a0832aea | |||
| c61a555d8a | |||
| b4b3888bc9 | |||
| 6636314010 | |||
| 8168f00038 | |||
| c681a0c987 | |||
| f31d386bd0 |
18
PROJECT
18
PROJECT
@@ -17,4 +17,22 @@ resources:
|
||||
kind: Networkconfiguration
|
||||
path: github.com/vegardengen/unifi-network-operator/api/v1beta1
|
||||
version: v1beta1
|
||||
- api:
|
||||
crdVersion: v1
|
||||
namespaced: true
|
||||
controller: true
|
||||
domain: engen.priv.no
|
||||
group: unifi
|
||||
kind: FirewallZone
|
||||
path: github.com/vegardengen/unifi-network-operator/api/v1beta1
|
||||
version: v1beta1
|
||||
- api:
|
||||
crdVersion: v1
|
||||
namespaced: true
|
||||
controller: true
|
||||
domain: engen.priv.no
|
||||
group: unifi
|
||||
kind: FirewallRule
|
||||
path: github.com/vegardengen/unifi-network-operator/api/v1beta1
|
||||
version: v1beta1
|
||||
version: "3"
|
||||
|
||||
64
api/v1beta1/firewallrule_types.go
Normal file
64
api/v1beta1/firewallrule_types.go
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright 2025 Vegard Engen.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// FirewallRuleSpec defines the desired state of FirewallRule.
|
||||
type FirewallRuleSpec struct {
|
||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
|
||||
// Foo is an example field of FirewallRule. Edit firewallrule_types.go to remove/update
|
||||
Foo string `json:"foo,omitempty"`
|
||||
}
|
||||
|
||||
// FirewallRuleStatus defines the observed state of FirewallRule.
|
||||
type FirewallRuleStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
|
||||
// FirewallRule is the Schema for the firewallrules API.
|
||||
type FirewallRule struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec FirewallRuleSpec `json:"spec,omitempty"`
|
||||
Status FirewallRuleStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// FirewallRuleList contains a list of FirewallRule.
|
||||
type FirewallRuleList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []FirewallRule `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&FirewallRule{}, &FirewallRuleList{})
|
||||
}
|
||||
67
api/v1beta1/firewallzone_types.go
Normal file
67
api/v1beta1/firewallzone_types.go
Normal file
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
Copyright 2025 Vegard Engen.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package v1beta1
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
)
|
||||
|
||||
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
|
||||
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
|
||||
|
||||
// FirewallZoneSpec defines the desired state of FirewallZone.
|
||||
type FirewallZoneSpec struct {
|
||||
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
|
||||
Name string `json:"name,omitempty"`
|
||||
ID string `json:"_id,omitempty"`
|
||||
DefaultZone bool `json:"default_zone,omitempty"`
|
||||
ZoneKey string `json:"zone_key,omitempty"`
|
||||
NetworkIDs []string `json:"network_ids,omitempty"`
|
||||
}
|
||||
|
||||
// FirewallZoneStatus defines the observed state of FirewallZone.
|
||||
type FirewallZoneStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
// +kubebuilder:subresource:status
|
||||
|
||||
// FirewallZone is the Schema for the firewallzones API.
|
||||
type FirewallZone struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ObjectMeta `json:"metadata,omitempty"`
|
||||
|
||||
Spec FirewallZoneSpec `json:"spec,omitempty"`
|
||||
Status FirewallZoneStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
// FirewallZoneList contains a list of FirewallZone.
|
||||
type FirewallZoneList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
metav1.ListMeta `json:"metadata,omitempty"`
|
||||
Items []FirewallZone `json:"items"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
SchemeBuilder.Register(&FirewallZone{}, &FirewallZoneList{})
|
||||
}
|
||||
@@ -30,7 +30,7 @@ type NetworkconfigurationSpec struct {
|
||||
|
||||
// Foo is an example field of Networkconfiguration. Edit networkconfiguration_types.go to remove/update
|
||||
Enabled bool `json:"enabled,omitempty"`
|
||||
FirewallZoneID string `json:"firewall_zone_id,omitempty"`
|
||||
FirewallZone string `json:"firewall_zone,omitempty"`
|
||||
GatewayType string `json:"gateway_type,omitempty"`
|
||||
IPSubnet string `json:"ip_subnet,omitempty"`
|
||||
Ipv6InterfaceType string `json:"ipv6_interface_type,omitempty"`
|
||||
@@ -39,7 +39,6 @@ type NetworkconfigurationSpec struct {
|
||||
Ipv6SettingPreference string `json:"ipv6_setting_preference,omitempty"`
|
||||
Ipv6Subnet string `json:"ipv6_subnet,omitempty"`
|
||||
Name string `json:"name"`
|
||||
Networkname string `json:"network_name"`
|
||||
NetworkID string `json:"network_id,omitempty"`
|
||||
Networkgroup string `json:"networkgroup,omitempty"`
|
||||
Purpose string `json:"purpose,omitempty"`
|
||||
@@ -52,7 +51,16 @@ type NetworkconfigurationSpec struct {
|
||||
type NetworkconfigurationStatus struct {
|
||||
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
// Important: Run "make" to regenerate code after modifying this file
|
||||
Ipv6SubnetStatus string `json:"ipv6_subnet_status,omitempty"`
|
||||
FirewallZoneID string `json:"firewall_zone_id,omitempty"`
|
||||
Ipv6SubnetStatus string `json:"ipv6_subnet_status,omitempty"`
|
||||
|
||||
// SyncedWithUnifi indicates whether the addresses are successfully pushed
|
||||
// +optional
|
||||
SyncedWithUnifi bool `json:"syncedWithUnifi,omitempty"`
|
||||
|
||||
// LastSyncTime is the last time the object was synced
|
||||
// +optional
|
||||
LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty"`
|
||||
}
|
||||
|
||||
// +kubebuilder:object:root=true
|
||||
|
||||
@@ -134,7 +134,7 @@ func (in *FirewallGroupStatus) DeepCopy() *FirewallGroupStatus {
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Networkconfiguration) DeepCopyInto(out *Networkconfiguration) {
|
||||
func (in *FirewallRule) DeepCopyInto(out *FirewallRule) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
@@ -142,6 +142,189 @@ func (in *Networkconfiguration) DeepCopyInto(out *Networkconfiguration) {
|
||||
out.Status = in.Status
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRule.
|
||||
func (in *FirewallRule) DeepCopy() *FirewallRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FirewallRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FirewallRule) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FirewallRuleList) DeepCopyInto(out *FirewallRuleList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]FirewallRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRuleList.
|
||||
func (in *FirewallRuleList) DeepCopy() *FirewallRuleList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FirewallRuleList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FirewallRuleList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FirewallRuleSpec) DeepCopyInto(out *FirewallRuleSpec) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRuleSpec.
|
||||
func (in *FirewallRuleSpec) DeepCopy() *FirewallRuleSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FirewallRuleSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FirewallRuleStatus) DeepCopyInto(out *FirewallRuleStatus) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallRuleStatus.
|
||||
func (in *FirewallRuleStatus) DeepCopy() *FirewallRuleStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FirewallRuleStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FirewallZone) DeepCopyInto(out *FirewallZone) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
in.Spec.DeepCopyInto(&out.Spec)
|
||||
out.Status = in.Status
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallZone.
|
||||
func (in *FirewallZone) DeepCopy() *FirewallZone {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FirewallZone)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FirewallZone) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FirewallZoneList) DeepCopyInto(out *FirewallZoneList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]FirewallZone, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallZoneList.
|
||||
func (in *FirewallZoneList) DeepCopy() *FirewallZoneList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FirewallZoneList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *FirewallZoneList) DeepCopyObject() runtime.Object {
|
||||
if c := in.DeepCopy(); c != nil {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FirewallZoneSpec) DeepCopyInto(out *FirewallZoneSpec) {
|
||||
*out = *in
|
||||
if in.NetworkIDs != nil {
|
||||
in, out := &in.NetworkIDs, &out.NetworkIDs
|
||||
*out = make([]string, len(*in))
|
||||
copy(*out, *in)
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallZoneSpec.
|
||||
func (in *FirewallZoneSpec) DeepCopy() *FirewallZoneSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FirewallZoneSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *FirewallZoneStatus) DeepCopyInto(out *FirewallZoneStatus) {
|
||||
*out = *in
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FirewallZoneStatus.
|
||||
func (in *FirewallZoneStatus) DeepCopy() *FirewallZoneStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(FirewallZoneStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *Networkconfiguration) DeepCopyInto(out *Networkconfiguration) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
|
||||
out.Spec = in.Spec
|
||||
in.Status.DeepCopyInto(&out.Status)
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Networkconfiguration.
|
||||
func (in *Networkconfiguration) DeepCopy() *Networkconfiguration {
|
||||
if in == nil {
|
||||
@@ -210,6 +393,10 @@ func (in *NetworkconfigurationSpec) DeepCopy() *NetworkconfigurationSpec {
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *NetworkconfigurationStatus) DeepCopyInto(out *NetworkconfigurationStatus) {
|
||||
*out = *in
|
||||
if in.LastSyncTime != nil {
|
||||
in, out := &in.LastSyncTime, &out.LastSyncTime
|
||||
*out = (*in).DeepCopy()
|
||||
}
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkconfigurationStatus.
|
||||
|
||||
23
cmd/main.go
23
cmd/main.go
@@ -40,6 +40,7 @@ import (
|
||||
unifiv1beta1 "github.com/vegardengen/unifi-network-operator/api/v1beta1"
|
||||
"github.com/vegardengen/unifi-network-operator/internal/controller"
|
||||
"github.com/vegardengen/unifi-network-operator/internal/unifi"
|
||||
"github.com/vegardengen/unifi-network-operator/internal/config"
|
||||
// +kubebuilder:scaffold:imports
|
||||
)
|
||||
|
||||
@@ -203,6 +204,8 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
configLoader := config.NewConfigLoader(mgr.GetClient())
|
||||
|
||||
// Unifi client
|
||||
setupLog.Info("Setting up UniFi client")
|
||||
unifiClient, err := unifi.CreateUnifiClient()
|
||||
@@ -216,16 +219,36 @@ func main() {
|
||||
Client: mgr.GetClient(),
|
||||
Scheme: mgr.GetScheme(),
|
||||
UnifiClient: unifiClient,
|
||||
ConfigLoader: configLoader,
|
||||
}).SetupWithManager(mgr); err != nil {
|
||||
setupLog.Error(err, "unable to create controller", "controller", "Networkconfiguration")
|
||||
os.Exit(1)
|
||||
}
|
||||
if err = (&controller.FirewallZoneReconciler{
|
||||
Client: mgr.GetClient(),
|
||||
Scheme: mgr.GetScheme(),
|
||||
UnifiClient: unifiClient,
|
||||
ConfigLoader: configLoader,
|
||||
}).SetupWithManager(mgr); err != nil {
|
||||
setupLog.Error(err, "unable to create controller", "controller", "FirewallZone")
|
||||
os.Exit(1)
|
||||
}
|
||||
if err = (&controller.FirewallRuleReconciler{
|
||||
Client: mgr.GetClient(),
|
||||
Scheme: mgr.GetScheme(),
|
||||
UnifiClient: unifiClient,
|
||||
ConfigLoader: configLoader,
|
||||
}).SetupWithManager(mgr); err != nil {
|
||||
setupLog.Error(err, "unable to create controller", "controller", "FirewallRule")
|
||||
os.Exit(1)
|
||||
}
|
||||
// +kubebuilder:scaffold:builder
|
||||
|
||||
if err = (&controller.FirewallGroupReconciler{
|
||||
Client: mgr.GetClient(),
|
||||
Scheme: mgr.GetScheme(),
|
||||
UnifiClient: unifiClient,
|
||||
ConfigLoader: configLoader,
|
||||
}).SetupWithManager(mgr); err != nil {
|
||||
setupLog.Error(err, "unable to create controller", "controller", "FirewallGroup")
|
||||
os.Exit(1)
|
||||
|
||||
54
config/crd/bases/unifi.engen.priv.no_firewallrules.yaml
Normal file
54
config/crd/bases/unifi.engen.priv.no_firewallrules.yaml
Normal file
@@ -0,0 +1,54 @@
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.17.2
|
||||
name: firewallrules.unifi.engen.priv.no
|
||||
spec:
|
||||
group: unifi.engen.priv.no
|
||||
names:
|
||||
kind: FirewallRule
|
||||
listKind: FirewallRuleList
|
||||
plural: firewallrules
|
||||
singular: firewallrule
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1beta1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: FirewallRule is the Schema for the firewallrules API.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: |-
|
||||
APIVersion defines the versioned schema of this representation of an object.
|
||||
Servers should convert recognized schemas to the latest internal value, and
|
||||
may reject unrecognized values.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
|
||||
type: string
|
||||
kind:
|
||||
description: |-
|
||||
Kind is a string value representing the REST resource this object represents.
|
||||
Servers may infer this from the endpoint the client submits requests to.
|
||||
Cannot be updated.
|
||||
In CamelCase.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
description: FirewallRuleSpec defines the desired state of FirewallRule.
|
||||
properties:
|
||||
foo:
|
||||
description: Foo is an example field of FirewallRule. Edit firewallrule_types.go
|
||||
to remove/update
|
||||
type: string
|
||||
type: object
|
||||
status:
|
||||
description: FirewallRuleStatus defines the observed state of FirewallRule.
|
||||
type: object
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
62
config/crd/bases/unifi.engen.priv.no_firewallzones.yaml
Normal file
62
config/crd/bases/unifi.engen.priv.no_firewallzones.yaml
Normal file
@@ -0,0 +1,62 @@
|
||||
---
|
||||
apiVersion: apiextensions.k8s.io/v1
|
||||
kind: CustomResourceDefinition
|
||||
metadata:
|
||||
annotations:
|
||||
controller-gen.kubebuilder.io/version: v0.17.2
|
||||
name: firewallzones.unifi.engen.priv.no
|
||||
spec:
|
||||
group: unifi.engen.priv.no
|
||||
names:
|
||||
kind: FirewallZone
|
||||
listKind: FirewallZoneList
|
||||
plural: firewallzones
|
||||
singular: firewallzone
|
||||
scope: Namespaced
|
||||
versions:
|
||||
- name: v1beta1
|
||||
schema:
|
||||
openAPIV3Schema:
|
||||
description: FirewallZone is the Schema for the firewallzones API.
|
||||
properties:
|
||||
apiVersion:
|
||||
description: |-
|
||||
APIVersion defines the versioned schema of this representation of an object.
|
||||
Servers should convert recognized schemas to the latest internal value, and
|
||||
may reject unrecognized values.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
|
||||
type: string
|
||||
kind:
|
||||
description: |-
|
||||
Kind is a string value representing the REST resource this object represents.
|
||||
Servers may infer this from the endpoint the client submits requests to.
|
||||
Cannot be updated.
|
||||
In CamelCase.
|
||||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
|
||||
type: string
|
||||
metadata:
|
||||
type: object
|
||||
spec:
|
||||
description: FirewallZoneSpec defines the desired state of FirewallZone.
|
||||
properties:
|
||||
_id:
|
||||
type: string
|
||||
default_zone:
|
||||
type: boolean
|
||||
name:
|
||||
type: string
|
||||
network_ids:
|
||||
items:
|
||||
type: string
|
||||
type: array
|
||||
zone_key:
|
||||
type: string
|
||||
type: object
|
||||
status:
|
||||
description: FirewallZoneStatus defines the observed state of FirewallZone.
|
||||
type: object
|
||||
type: object
|
||||
served: true
|
||||
storage: true
|
||||
subresources:
|
||||
status: {}
|
||||
@@ -44,7 +44,7 @@ spec:
|
||||
description: Foo is an example field of Networkconfiguration. Edit
|
||||
networkconfiguration_types.go to remove/update
|
||||
type: boolean
|
||||
firewall_zone_id:
|
||||
firewall_zone:
|
||||
type: string
|
||||
gateway_type:
|
||||
type: string
|
||||
@@ -64,8 +64,6 @@ spec:
|
||||
type: string
|
||||
network_id:
|
||||
type: string
|
||||
network_name:
|
||||
type: string
|
||||
networkgroup:
|
||||
type: string
|
||||
purpose:
|
||||
@@ -79,17 +77,26 @@ spec:
|
||||
type: boolean
|
||||
required:
|
||||
- name
|
||||
- network_name
|
||||
type: object
|
||||
status:
|
||||
description: NetworkconfigurationStatus defines the observed state of
|
||||
Networkconfiguration.
|
||||
properties:
|
||||
ipv6_subnet_status:
|
||||
firewall_zone_id:
|
||||
description: |-
|
||||
INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
|
||||
Important: Run "make" to regenerate code after modifying this file
|
||||
type: string
|
||||
ipv6_subnet_status:
|
||||
type: string
|
||||
lastSyncTime:
|
||||
description: LastSyncTime is the last time the object was synced
|
||||
format: date-time
|
||||
type: string
|
||||
syncedWithUnifi:
|
||||
description: SyncedWithUnifi indicates whether the addresses are successfully
|
||||
pushed
|
||||
type: boolean
|
||||
type: object
|
||||
type: object
|
||||
served: true
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
# It should be run by config/default
|
||||
resources:
|
||||
- bases/unifi.engen.priv.no_networkconfigurations.yaml
|
||||
- bases/unifi.engen.priv.no_firewallzones.yaml
|
||||
- bases/unifi.engen.priv.no_firewallrules.yaml
|
||||
# +kubebuilder:scaffold:crdkustomizeresource
|
||||
|
||||
patches:
|
||||
|
||||
27
config/rbac/firewallrule_admin_role.yaml
Normal file
27
config/rbac/firewallrule_admin_role.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
# This rule is not used by the project unifi-network-operator itself.
|
||||
# It is provided to allow the cluster admin to help manage permissions for users.
|
||||
#
|
||||
# Grants full permissions ('*') over unifi.engen.priv.no.
|
||||
# This role is intended for users authorized to modify roles and bindings within the cluster,
|
||||
# enabling them to delegate specific permissions to other users or groups as needed.
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: unifi-network-operator
|
||||
app.kubernetes.io/managed-by: kustomize
|
||||
name: firewallrule-admin-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallrules
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallrules/status
|
||||
verbs:
|
||||
- get
|
||||
33
config/rbac/firewallrule_editor_role.yaml
Normal file
33
config/rbac/firewallrule_editor_role.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
# This rule is not used by the project unifi-network-operator itself.
|
||||
# It is provided to allow the cluster admin to help manage permissions for users.
|
||||
#
|
||||
# Grants permissions to create, update, and delete resources within the unifi.engen.priv.no.
|
||||
# This role is intended for users who need to manage these resources
|
||||
# but should not control RBAC or manage permissions for others.
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: unifi-network-operator
|
||||
app.kubernetes.io/managed-by: kustomize
|
||||
name: firewallrule-editor-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallrules
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallrules/status
|
||||
verbs:
|
||||
- get
|
||||
29
config/rbac/firewallrule_viewer_role.yaml
Normal file
29
config/rbac/firewallrule_viewer_role.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
# This rule is not used by the project unifi-network-operator itself.
|
||||
# It is provided to allow the cluster admin to help manage permissions for users.
|
||||
#
|
||||
# Grants read-only access to unifi.engen.priv.no resources.
|
||||
# This role is intended for users who need visibility into these resources
|
||||
# without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing.
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: unifi-network-operator
|
||||
app.kubernetes.io/managed-by: kustomize
|
||||
name: firewallrule-viewer-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallrules
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallrules/status
|
||||
verbs:
|
||||
- get
|
||||
27
config/rbac/firewallzone_admin_role.yaml
Normal file
27
config/rbac/firewallzone_admin_role.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
# This rule is not used by the project unifi-network-operator itself.
|
||||
# It is provided to allow the cluster admin to help manage permissions for users.
|
||||
#
|
||||
# Grants full permissions ('*') over unifi.engen.priv.no.
|
||||
# This role is intended for users authorized to modify roles and bindings within the cluster,
|
||||
# enabling them to delegate specific permissions to other users or groups as needed.
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: unifi-network-operator
|
||||
app.kubernetes.io/managed-by: kustomize
|
||||
name: firewallzone-admin-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallzones
|
||||
verbs:
|
||||
- '*'
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallzones/status
|
||||
verbs:
|
||||
- get
|
||||
33
config/rbac/firewallzone_editor_role.yaml
Normal file
33
config/rbac/firewallzone_editor_role.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
# This rule is not used by the project unifi-network-operator itself.
|
||||
# It is provided to allow the cluster admin to help manage permissions for users.
|
||||
#
|
||||
# Grants permissions to create, update, and delete resources within the unifi.engen.priv.no.
|
||||
# This role is intended for users who need to manage these resources
|
||||
# but should not control RBAC or manage permissions for others.
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: unifi-network-operator
|
||||
app.kubernetes.io/managed-by: kustomize
|
||||
name: firewallzone-editor-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallzones
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallzones/status
|
||||
verbs:
|
||||
- get
|
||||
29
config/rbac/firewallzone_viewer_role.yaml
Normal file
29
config/rbac/firewallzone_viewer_role.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
# This rule is not used by the project unifi-network-operator itself.
|
||||
# It is provided to allow the cluster admin to help manage permissions for users.
|
||||
#
|
||||
# Grants read-only access to unifi.engen.priv.no resources.
|
||||
# This role is intended for users who need visibility into these resources
|
||||
# without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing.
|
||||
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: unifi-network-operator
|
||||
app.kubernetes.io/managed-by: kustomize
|
||||
name: firewallzone-viewer-role
|
||||
rules:
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallzones
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallzones/status
|
||||
verbs:
|
||||
- get
|
||||
@@ -22,6 +22,12 @@ resources:
|
||||
# default, aiding admins in cluster management. Those roles are
|
||||
# not used by the {{ .ProjectName }} itself. You can comment the following lines
|
||||
# if you do not want those helpers be installed with your Project.
|
||||
- firewallrule_admin_role.yaml
|
||||
- firewallrule_editor_role.yaml
|
||||
- firewallrule_viewer_role.yaml
|
||||
- firewallzone_admin_role.yaml
|
||||
- firewallzone_editor_role.yaml
|
||||
- firewallzone_viewer_role.yaml
|
||||
- networkconfiguration_admin_role.yaml
|
||||
- networkconfiguration_editor_role.yaml
|
||||
- networkconfiguration_viewer_role.yaml
|
||||
|
||||
@@ -7,6 +7,7 @@ rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
@@ -16,6 +17,8 @@ rules:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallgroups
|
||||
- firewallrules
|
||||
- firewallzones
|
||||
- networkconfigurations
|
||||
verbs:
|
||||
- create
|
||||
@@ -29,6 +32,8 @@ rules:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallgroups/finalizers
|
||||
- firewallrules/finalizers
|
||||
- firewallzones/finalizers
|
||||
- networkconfigurations/finalizers
|
||||
verbs:
|
||||
- update
|
||||
@@ -36,6 +41,8 @@ rules:
|
||||
- unifi.engen.priv.no
|
||||
resources:
|
||||
- firewallgroups/status
|
||||
- firewallrules/status
|
||||
- firewallzones/status
|
||||
- networkconfigurations/status
|
||||
verbs:
|
||||
- get
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
## Append samples of your project ##
|
||||
resources:
|
||||
- unifi_v1beta1_networkconfiguration.yaml
|
||||
- unifi_v1beta1_firewallzone.yaml
|
||||
- unifi_v1beta1_firewallrule.yaml
|
||||
# +kubebuilder:scaffold:manifestskustomizesamples
|
||||
|
||||
9
config/samples/unifi_v1beta1_firewallrule.yaml
Normal file
9
config/samples/unifi_v1beta1_firewallrule.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: unifi.engen.priv.no/v1beta1
|
||||
kind: FirewallRule
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: unifi-network-operator
|
||||
app.kubernetes.io/managed-by: kustomize
|
||||
name: firewallrule-sample
|
||||
spec:
|
||||
# TODO(user): Add fields here
|
||||
9
config/samples/unifi_v1beta1_firewallzone.yaml
Normal file
9
config/samples/unifi_v1beta1_firewallzone.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: unifi.engen.priv.no/v1beta1
|
||||
kind: FirewallZone
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: unifi-network-operator
|
||||
app.kubernetes.io/managed-by: kustomize
|
||||
name: firewallzone-sample
|
||||
spec:
|
||||
# TODO(user): Add fields here
|
||||
450
go.mod
450
go.mod
@@ -1,101 +1,449 @@
|
||||
module github.com/vegardengen/unifi-network-operator
|
||||
|
||||
go 1.23.0
|
||||
go 1.24.0
|
||||
|
||||
toolchain go1.24.1
|
||||
|
||||
godebug default=go1.23
|
||||
|
||||
require (
|
||||
github.com/onsi/ginkgo/v2 v2.22.0
|
||||
github.com/onsi/gomega v1.36.1
|
||||
github.com/vegardengen/go-unifi v0.0.0-20250408133614-8e97d8aceca3
|
||||
github.com/onsi/ginkgo/v2 v2.23.4
|
||||
github.com/onsi/gomega v1.37.0
|
||||
github.com/vegardengen/go-unifi v0.0.1-alpha9
|
||||
k8s.io/api v0.32.1
|
||||
k8s.io/apimachinery v0.32.1
|
||||
k8s.io/client-go v0.32.1
|
||||
sigs.k8s.io/controller-runtime v0.20.2
|
||||
sigs.k8s.io/controller-runtime v0.20.4
|
||||
)
|
||||
|
||||
require (
|
||||
cel.dev/expr v0.18.0 // indirect
|
||||
github.com/antlr4-go/antlr/v4 v4.13.0 // indirect
|
||||
4d63.com/gocheckcompilerdirectives v1.2.1 // indirect
|
||||
4d63.com/gochecknoglobals v0.2.1 // indirect
|
||||
cel.dev/expr v0.23.1 // indirect
|
||||
cloud.google.com/go v0.112.0 // indirect
|
||||
cloud.google.com/go/compute/metadata v0.6.0 // indirect
|
||||
cloud.google.com/go/iam v1.1.5 // indirect
|
||||
cloud.google.com/go/kms v1.15.5 // indirect
|
||||
cloud.google.com/go/storage v1.36.0 // indirect
|
||||
code.gitea.io/sdk/gitea v0.16.0 // indirect
|
||||
dario.cat/mergo v1.0.0 // indirect
|
||||
github.com/4meepo/tagalign v1.3.3 // indirect
|
||||
github.com/Abirdcfly/dupword v0.0.13 // indirect
|
||||
github.com/AlekSi/pointer v1.2.0 // indirect
|
||||
github.com/Antonboom/errname v0.1.12 // indirect
|
||||
github.com/Antonboom/nilnil v0.1.7 // indirect
|
||||
github.com/Antonboom/testifylint v0.2.3 // indirect
|
||||
github.com/Azure/azure-sdk-for-go v68.0.0+incompatible // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.8.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/internal v1.4.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.10.0 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.1 // indirect
|
||||
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.1.0 // indirect
|
||||
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
|
||||
github.com/Azure/go-autorest/autorest v0.11.29 // indirect
|
||||
github.com/Azure/go-autorest/autorest/adal v0.9.23 // indirect
|
||||
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 // indirect
|
||||
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
|
||||
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
|
||||
github.com/Azure/go-autorest/autorest/to v0.4.0 // indirect
|
||||
github.com/Azure/go-autorest/logger v0.2.1 // indirect
|
||||
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
|
||||
github.com/AzureAD/microsoft-authentication-library-for-go v1.2.0 // indirect
|
||||
github.com/BurntSushi/toml v1.3.2 // indirect
|
||||
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect
|
||||
github.com/GaijinEntertainment/go-exhaustruct/v3 v3.1.0 // indirect
|
||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||
github.com/Masterminds/semver v1.5.0 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.2.1 // indirect
|
||||
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
|
||||
github.com/Microsoft/go-winio v0.6.1 // indirect
|
||||
github.com/OpenPeeDeeP/depguard/v2 v2.1.0 // indirect
|
||||
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c // indirect
|
||||
github.com/acomagu/bufpipe v1.0.4 // indirect
|
||||
github.com/alecthomas/go-check-sumtype v0.1.3 // indirect
|
||||
github.com/alessio/shellescape v1.4.1 // indirect
|
||||
github.com/alexkohler/nakedret/v2 v2.0.2 // indirect
|
||||
github.com/alexkohler/prealloc v1.0.0 // indirect
|
||||
github.com/alingse/asasalint v0.0.11 // indirect
|
||||
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
|
||||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
|
||||
github.com/ashanbrown/forbidigo v1.6.0 // indirect
|
||||
github.com/ashanbrown/makezero v1.1.1 // indirect
|
||||
github.com/atc0005/go-teams-notify/v2 v2.8.0 // indirect
|
||||
github.com/aws/aws-sdk-go v1.47.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2 v1.21.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.13 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/config v1.19.1 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/credentials v1.13.43 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.11.76 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecr v1.20.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.18.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.14 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.36 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.4 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/kms v1.24.7 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/s3 v1.40.0 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 // indirect
|
||||
github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 // indirect
|
||||
github.com/aws/smithy-go v1.15.0 // indirect
|
||||
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20231024185945-8841054dbdb8 // indirect
|
||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bkielbasa/cyclop v1.2.1 // indirect
|
||||
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb // indirect
|
||||
github.com/blang/semver/v4 v4.0.0 // indirect
|
||||
github.com/blizzy78/varnamelen v0.8.0 // indirect
|
||||
github.com/bombsimon/wsl/v3 v3.4.0 // indirect
|
||||
github.com/breml/bidichk v0.2.7 // indirect
|
||||
github.com/breml/errchkjson v0.3.6 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/butuzov/ireturn v0.2.2 // indirect
|
||||
github.com/butuzov/mirror v1.1.0 // indirect
|
||||
github.com/caarlos0/ctrlc v1.2.0 // indirect
|
||||
github.com/caarlos0/env/v9 v9.0.0 // indirect
|
||||
github.com/caarlos0/go-reddit/v3 v3.0.1 // indirect
|
||||
github.com/caarlos0/go-shellwords v1.0.12 // indirect
|
||||
github.com/caarlos0/go-version v0.1.1 // indirect
|
||||
github.com/caarlos0/log v0.4.2 // indirect
|
||||
github.com/catenacyber/perfsprint v0.2.0 // indirect
|
||||
github.com/cavaliergopher/cpio v1.0.1 // indirect
|
||||
github.com/ccojocar/zxcvbn-go v1.0.1 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/charithe/durationcheck v0.0.10 // indirect
|
||||
github.com/charmbracelet/lipgloss v0.8.0 // indirect
|
||||
github.com/chavacava/garif v0.1.0 // indirect
|
||||
github.com/chrismellard/docker-credential-acr-env v0.0.0-20230304212654-82a0ddb27589 // indirect
|
||||
github.com/cloudflare/circl v1.3.5 // indirect
|
||||
github.com/containerd/stargz-snapshotter/estargz v0.14.3 // indirect
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
|
||||
github.com/curioswitch/go-reassign v0.2.0 // indirect
|
||||
github.com/daixiang0/gci v0.11.2 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
|
||||
github.com/davidmz/go-pageant v1.0.2 // indirect
|
||||
github.com/denis-tingaikin/go-header v0.4.3 // indirect
|
||||
github.com/dghubble/go-twitter v0.0.0-20211115160449-93a8679adecb // indirect
|
||||
github.com/dghubble/oauth1 v0.7.2 // indirect
|
||||
github.com/dghubble/sling v1.4.0 // indirect
|
||||
github.com/dimchansky/utfbom v1.1.1 // indirect
|
||||
github.com/disgoorg/disgo v0.16.9 // indirect
|
||||
github.com/disgoorg/json v1.1.0 // indirect
|
||||
github.com/disgoorg/log v1.2.1 // indirect
|
||||
github.com/disgoorg/snowflake/v2 v2.0.1 // indirect
|
||||
github.com/distribution/reference v0.5.0 // indirect
|
||||
github.com/docker/cli v24.0.7+incompatible // indirect
|
||||
github.com/docker/distribution v2.8.3+incompatible // indirect
|
||||
github.com/docker/docker v24.0.7+incompatible // indirect
|
||||
github.com/docker/docker-credential-helpers v0.8.0 // indirect
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/docker/go-units v0.5.0 // indirect
|
||||
github.com/elliotchance/orderedmap/v2 v2.2.0 // indirect
|
||||
github.com/emicklei/go-restful/v3 v3.12.2 // indirect
|
||||
github.com/emirpasic/gods v1.18.1 // indirect
|
||||
github.com/esimonov/ifshort v1.0.4 // indirect
|
||||
github.com/ettle/strcase v0.1.1 // indirect
|
||||
github.com/evanphx/json-patch/v5 v5.9.11 // indirect
|
||||
github.com/fatih/color v1.15.0 // indirect
|
||||
github.com/fatih/structtag v1.2.0 // indirect
|
||||
github.com/felixge/httpsnoop v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
|
||||
github.com/firefart/nonamedreturns v1.0.4 // indirect
|
||||
github.com/fsnotify/fsnotify v1.9.0 // indirect
|
||||
github.com/fxamacker/cbor/v2 v2.8.0 // indirect
|
||||
github.com/fzipp/gocyclo v0.6.0 // indirect
|
||||
github.com/ghostiam/protogetter v0.2.3 // indirect
|
||||
github.com/go-critic/go-critic v0.9.0 // indirect
|
||||
github.com/go-fed/httpsig v1.1.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.4.1 // indirect
|
||||
github.com/go-git/go-git/v5 v5.7.0 // indirect
|
||||
github.com/go-logr/logr v1.4.2 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-logr/zapr v1.3.0 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.0 // indirect
|
||||
github.com/go-openapi/jsonreference v0.20.2 // indirect
|
||||
github.com/go-openapi/swag v0.23.0 // indirect
|
||||
github.com/go-openapi/analysis v0.21.4 // indirect
|
||||
github.com/go-openapi/errors v0.20.4 // indirect
|
||||
github.com/go-openapi/jsonpointer v0.21.1 // indirect
|
||||
github.com/go-openapi/jsonreference v0.21.0 // indirect
|
||||
github.com/go-openapi/loads v0.21.2 // indirect
|
||||
github.com/go-openapi/runtime v0.26.0 // indirect
|
||||
github.com/go-openapi/spec v0.20.9 // indirect
|
||||
github.com/go-openapi/strfmt v0.21.7 // indirect
|
||||
github.com/go-openapi/swag v0.23.1 // indirect
|
||||
github.com/go-openapi/validate v0.22.1 // indirect
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
|
||||
github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible // indirect
|
||||
github.com/go-toolsmith/astcast v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astcopy v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astequal v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astfmt v1.1.0 // indirect
|
||||
github.com/go-toolsmith/astp v1.1.0 // indirect
|
||||
github.com/go-toolsmith/strparse v1.1.0 // indirect
|
||||
github.com/go-toolsmith/typep v1.1.0 // indirect
|
||||
github.com/go-xmlfmt/xmlfmt v1.1.2 // indirect
|
||||
github.com/gobwas/glob v0.2.3 // indirect
|
||||
github.com/gofrs/flock v0.8.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||
github.com/golang-jwt/jwt/v5 v5.0.0 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/protobuf v1.5.4 // indirect
|
||||
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect
|
||||
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
|
||||
github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe // indirect
|
||||
github.com/golangci/gofmt v0.0.0-20231018234816-f50ced29576e // indirect
|
||||
github.com/golangci/golangci-lint v1.55.2 // indirect
|
||||
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
|
||||
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
|
||||
github.com/golangci/misspell v0.4.1 // indirect
|
||||
github.com/golangci/revgrep v0.5.2 // indirect
|
||||
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
|
||||
github.com/google/btree v1.1.3 // indirect
|
||||
github.com/google/cel-go v0.22.0 // indirect
|
||||
github.com/google/gnostic-models v0.6.9-0.20230804172637-c7be7c783f49 // indirect
|
||||
github.com/google/go-cmp v0.6.0 // indirect
|
||||
github.com/google/gnostic-models v0.6.9 // indirect
|
||||
github.com/google/go-cmp v0.7.0 // indirect
|
||||
github.com/google/go-containerregistry v0.16.1 // indirect
|
||||
github.com/google/go-github/v55 v55.0.0 // indirect
|
||||
github.com/google/go-querystring v1.1.0 // indirect
|
||||
github.com/google/gofuzz v1.2.0 // indirect
|
||||
github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db // indirect
|
||||
github.com/google/ko v0.14.1 // indirect
|
||||
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
|
||||
github.com/google/rpmpack v0.5.0 // indirect
|
||||
github.com/google/s2a-go v0.1.7 // indirect
|
||||
github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
|
||||
github.com/google/wire v0.5.0 // indirect
|
||||
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
|
||||
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
|
||||
github.com/gordonklaus/ineffassign v0.0.0-20230610083614-0e73809eb601 // indirect
|
||||
github.com/goreleaser/chglog v0.5.0 // indirect
|
||||
github.com/goreleaser/fileglob v1.3.0 // indirect
|
||||
github.com/goreleaser/goreleaser v1.21.2 // indirect
|
||||
github.com/goreleaser/nfpm/v2 v2.33.1 // indirect
|
||||
github.com/gorilla/websocket v1.5.0 // indirect
|
||||
github.com/gostaticanalysis/analysisutil v0.7.1 // indirect
|
||||
github.com/gostaticanalysis/comment v1.4.2 // indirect
|
||||
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
|
||||
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/go-retryablehttp v0.7.4 // indirect
|
||||
github.com/hashicorp/go-version v1.6.0 // indirect
|
||||
github.com/hashicorp/hcl v1.0.1-vault-5 // indirect
|
||||
github.com/hexops/gotextdiff v1.0.3 // indirect
|
||||
github.com/huandu/xstrings v1.3.3 // indirect
|
||||
github.com/imdario/mergo v0.3.16 // indirect
|
||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||
github.com/invopop/jsonschema v0.9.0 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jgautheron/goconst v1.6.0 // indirect
|
||||
github.com/jingyugao/rowserrcheck v1.1.1 // indirect
|
||||
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
|
||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||
github.com/josharian/intern v1.0.0 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/julz/importas v0.1.0 // indirect
|
||||
github.com/kevinburke/ssh_config v1.2.0 // indirect
|
||||
github.com/kisielk/errcheck v1.6.3 // indirect
|
||||
github.com/kisielk/gotool v1.0.0 // indirect
|
||||
github.com/kkHAIKE/contextcheck v1.1.4 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/klauspost/pgzip v1.2.6 // indirect
|
||||
github.com/kulti/thelper v0.6.3 // indirect
|
||||
github.com/kunwardeep/paralleltest v1.0.8 // indirect
|
||||
github.com/kylelemons/godebug v1.1.0 // indirect
|
||||
github.com/kyoh86/exportloopref v0.1.11 // indirect
|
||||
github.com/ldez/gomoddirectives v0.2.3 // indirect
|
||||
github.com/ldez/tagliatelle v0.5.0 // indirect
|
||||
github.com/leonklingele/grouper v1.1.1 // indirect
|
||||
github.com/letsencrypt/boulder v0.0.0-20231026200631-000cd05d5491 // indirect
|
||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
||||
github.com/lufeee/execinquery v1.2.1 // indirect
|
||||
github.com/macabu/inamedparam v0.1.2 // indirect
|
||||
github.com/magiconair/properties v1.8.7 // indirect
|
||||
github.com/mailru/easyjson v0.9.0 // indirect
|
||||
github.com/maratori/testableexamples v1.0.0 // indirect
|
||||
github.com/maratori/testpackage v1.1.1 // indirect
|
||||
github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.18 // indirect
|
||||
github.com/mattn/go-mastodon v0.0.6 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/mbilski/exhaustivestruct v1.2.0 // indirect
|
||||
github.com/mgechev/revive v1.3.4 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/moricho/tparallel v0.3.1 // indirect
|
||||
github.com/muesli/mango v0.1.0 // indirect
|
||||
github.com/muesli/mango-cobra v1.2.0 // indirect
|
||||
github.com/muesli/mango-pflag v0.1.0 // indirect
|
||||
github.com/muesli/reflow v0.3.0 // indirect
|
||||
github.com/muesli/roff v0.1.0 // indirect
|
||||
github.com/muesli/termenv v0.15.2 // indirect
|
||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||
github.com/nakabonne/nestif v0.3.1 // indirect
|
||||
github.com/nishanths/exhaustive v0.11.0 // indirect
|
||||
github.com/nishanths/predeclared v0.2.2 // indirect
|
||||
github.com/nunnatsa/ginkgolinter v0.14.1 // indirect
|
||||
github.com/oklog/ulid v1.3.1 // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/opencontainers/go-digest v1.0.0 // indirect
|
||||
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
|
||||
github.com/pelletier/go-toml v1.9.5 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/pjbgf/sha1cd v0.3.0 // indirect
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/prometheus/client_golang v1.19.1 // indirect
|
||||
github.com/prometheus/client_model v0.6.1 // indirect
|
||||
github.com/prometheus/common v0.55.0 // indirect
|
||||
github.com/prometheus/procfs v0.15.1 // indirect
|
||||
github.com/spf13/cobra v1.8.1 // indirect
|
||||
github.com/spf13/pflag v1.0.5 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/polyfloyd/go-errorlint v1.4.5 // indirect
|
||||
github.com/prometheus/client_golang v1.22.0 // indirect
|
||||
github.com/prometheus/client_model v0.6.2 // indirect
|
||||
github.com/prometheus/common v0.63.0 // indirect
|
||||
github.com/prometheus/procfs v0.16.0 // indirect
|
||||
github.com/quasilyte/go-ruleguard v0.4.0 // indirect
|
||||
github.com/quasilyte/gogrep v0.5.0 // indirect
|
||||
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727 // indirect
|
||||
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567 // indirect
|
||||
github.com/rivo/uniseg v0.4.2 // indirect
|
||||
github.com/rogpeppe/go-internal v1.14.1 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/ryancurrah/gomodguard v1.3.0 // indirect
|
||||
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
|
||||
github.com/sagikazarmark/locafero v0.3.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/sanposhiho/wastedassign/v2 v2.0.7 // indirect
|
||||
github.com/sasha-s/go-csync v0.0.0-20210812194225-61421b77c44b // indirect
|
||||
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
|
||||
github.com/sashamelentyev/usestdlibvars v1.24.0 // indirect
|
||||
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
|
||||
github.com/securego/gosec/v2 v2.18.2 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
|
||||
github.com/shopspring/decimal v1.2.0 // indirect
|
||||
github.com/sigstore/cosign/v2 v2.2.1 // indirect
|
||||
github.com/sigstore/rekor v1.3.3 // indirect
|
||||
github.com/sigstore/sigstore v1.7.5 // indirect
|
||||
github.com/sirupsen/logrus v1.9.3 // indirect
|
||||
github.com/sivchari/containedctx v1.0.3 // indirect
|
||||
github.com/sivchari/nosnakecase v1.7.0 // indirect
|
||||
github.com/sivchari/tenv v1.7.1 // indirect
|
||||
github.com/skeema/knownhosts v1.1.1 // indirect
|
||||
github.com/slack-go/slack v0.12.3 // indirect
|
||||
github.com/sonatard/noctx v0.0.2 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/sourcegraph/go-diff v0.7.0 // indirect
|
||||
github.com/spf13/afero v1.10.0 // indirect
|
||||
github.com/spf13/cast v1.5.1 // indirect
|
||||
github.com/spf13/cobra v1.9.1 // indirect
|
||||
github.com/spf13/pflag v1.0.6 // indirect
|
||||
github.com/spf13/viper v1.17.0 // indirect
|
||||
github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect
|
||||
github.com/stbenjam/no-sprintf-host-port v0.1.1 // indirect
|
||||
github.com/stoewer/go-strcase v1.3.0 // indirect
|
||||
github.com/stretchr/objx v0.5.2 // indirect
|
||||
github.com/stretchr/testify v1.10.0 // indirect
|
||||
github.com/subosito/gotenv v1.6.0 // indirect
|
||||
github.com/t-yuki/gocover-cobertura v0.0.0-20180217150009-aaee18c8195c // indirect
|
||||
github.com/tdakkota/asciicheck v0.2.0 // indirect
|
||||
github.com/technoweenie/multipartstreamer v1.0.1 // indirect
|
||||
github.com/tetafro/godot v1.4.15 // indirect
|
||||
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966 // indirect
|
||||
github.com/timonwong/loggercheck v0.9.4 // indirect
|
||||
github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect
|
||||
github.com/tomarrell/wrapcheck/v2 v2.8.1 // indirect
|
||||
github.com/tommy-muehle/go-mnd/v2 v2.5.1 // indirect
|
||||
github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect
|
||||
github.com/ulikunitz/xz v0.5.11 // indirect
|
||||
github.com/ultraware/funlen v0.1.0 // indirect
|
||||
github.com/ultraware/whitespace v0.0.5 // indirect
|
||||
github.com/uudashr/gocognit v1.1.2 // indirect
|
||||
github.com/vbatts/tar-split v0.11.5 // indirect
|
||||
github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 // indirect
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||
github.com/x448/float16 v0.8.4 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
|
||||
go.opentelemetry.io/otel v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.28.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.3.1 // indirect
|
||||
github.com/xanzy/go-gitlab v0.93.2 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.3 // indirect
|
||||
github.com/xen0n/gosmopolitan v1.2.2 // indirect
|
||||
github.com/yagipy/maintidx v1.0.0 // indirect
|
||||
github.com/yeya24/promlinter v0.2.0 // indirect
|
||||
github.com/ykadowak/zerologlint v0.1.3 // indirect
|
||||
gitlab.com/bosi/decorder v0.4.1 // indirect
|
||||
gitlab.com/digitalxero/go-conventional-commit v1.0.7 // indirect
|
||||
go-simpler.org/sloglint v0.1.2 // indirect
|
||||
go.mongodb.org/mongo-driver v1.12.1 // indirect
|
||||
go.opencensus.io v0.24.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.53.0 // indirect
|
||||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
|
||||
go.opentelemetry.io/otel v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/sdk v1.35.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.35.0 // indirect
|
||||
go.opentelemetry.io/proto/otlp v1.5.0 // indirect
|
||||
go.tmz.dev/musttag v0.7.2 // indirect
|
||||
go.uber.org/automaxprocs v1.6.0 // indirect
|
||||
go.uber.org/multierr v1.11.0 // indirect
|
||||
go.uber.org/zap v1.27.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
|
||||
golang.org/x/net v0.30.0 // indirect
|
||||
golang.org/x/oauth2 v0.23.0 // indirect
|
||||
golang.org/x/sync v0.8.0 // indirect
|
||||
golang.org/x/sys v0.26.0 // indirect
|
||||
golang.org/x/term v0.25.0 // indirect
|
||||
golang.org/x/text v0.19.0 // indirect
|
||||
golang.org/x/time v0.7.0 // indirect
|
||||
golang.org/x/tools v0.26.0 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20240826202546-f6391c0de4c7 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect
|
||||
google.golang.org/grpc v1.65.0 // indirect
|
||||
google.golang.org/protobuf v1.35.1 // indirect
|
||||
gocloud.dev v0.34.0 // indirect
|
||||
golang.org/x/crypto v0.37.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
|
||||
golang.org/x/exp/typeparams v0.0.0-20230307190834-24139beb5833 // indirect
|
||||
golang.org/x/mod v0.24.0 // indirect
|
||||
golang.org/x/net v0.39.0 // indirect
|
||||
golang.org/x/oauth2 v0.29.0 // indirect
|
||||
golang.org/x/sync v0.13.0 // indirect
|
||||
golang.org/x/sys v0.32.0 // indirect
|
||||
golang.org/x/term v0.31.0 // indirect
|
||||
golang.org/x/text v0.24.0 // indirect
|
||||
golang.org/x/time v0.11.0 // indirect
|
||||
golang.org/x/tools v0.32.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
|
||||
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
|
||||
google.golang.org/api v0.155.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect
|
||||
google.golang.org/genproto/googleapis/api v0.0.0-20250409194420-de1ac958c67a // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250409194420-de1ac958c67a // indirect
|
||||
google.golang.org/grpc v1.71.1 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
|
||||
gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect
|
||||
gopkg.in/inf.v0 v0.9.1 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/mail.v2 v2.3.1 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
honnef.co/go/tools v0.4.6 // indirect
|
||||
k8s.io/apiextensions-apiserver v0.32.1 // indirect
|
||||
k8s.io/apiserver v0.32.1 // indirect
|
||||
k8s.io/component-base v0.32.1 // indirect
|
||||
k8s.io/klog/v2 v2.130.1 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect
|
||||
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
|
||||
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
|
||||
k8s.io/utils v0.0.0-20250321185631-1f6e0b77f77e // indirect
|
||||
mvdan.cc/gofumpt v0.5.0 // indirect
|
||||
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
|
||||
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
|
||||
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d // indirect
|
||||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.32.0 // indirect
|
||||
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
|
||||
sigs.k8s.io/kind v0.20.0 // indirect
|
||||
sigs.k8s.io/randfill v1.0.0 // indirect
|
||||
sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
|
||||
sigs.k8s.io/yaml v1.4.0 // indirect
|
||||
)
|
||||
|
||||
45
internal/config/config.go
Normal file
45
internal/config/config.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
)
|
||||
|
||||
type ConfigLoaderType struct {
|
||||
Client client.Client
|
||||
|
||||
mu sync.Mutex
|
||||
loaded bool
|
||||
config *corev1.ConfigMap
|
||||
err error
|
||||
}
|
||||
|
||||
func NewConfigLoader(k8sClient client.Client) *ConfigLoaderType {
|
||||
return &ConfigLoaderType{Client: k8sClient}
|
||||
}
|
||||
|
||||
func (c *ConfigLoaderType) GetConfig(ctx context.Context, name string) (*corev1.ConfigMap, error) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
if c.loaded {
|
||||
return c.config, c.err
|
||||
}
|
||||
|
||||
cm := &corev1.ConfigMap{}
|
||||
err := c.Client.Get(ctx, types.NamespacedName{
|
||||
Name: name,
|
||||
Namespace: "unifi-network-operator-system",
|
||||
}, cm)
|
||||
|
||||
c.loaded = true
|
||||
c.config = cm
|
||||
c.err = err
|
||||
|
||||
return cm, err
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import (
|
||||
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/config"
|
||||
)
|
||||
|
||||
// FirewallGroupReconciler reconciles a FirewallGroup object
|
||||
@@ -47,12 +48,14 @@ type FirewallGroupReconciler struct {
|
||||
client.Client
|
||||
Scheme *runtime.Scheme
|
||||
UnifiClient *unifi.UnifiClient
|
||||
ConfigLoader *config.ConfigLoaderType
|
||||
}
|
||||
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=firewallgroups,verbs=get;list;watch;create;update;patch;delete
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=firewallgroups/status,verbs=get;update;patch
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=firewallgroups/finalizers,verbs=update
|
||||
// +kubebuilder:rbac:groups="",resources=services,verbs=list;get;watch
|
||||
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=list;get;watch
|
||||
|
||||
// Reconcile is part of the main kubernetes reconciliation loop which aims to
|
||||
// move the current state of the cluster closer to the desired state.
|
||||
@@ -66,6 +69,15 @@ type FirewallGroupReconciler struct {
|
||||
|
||||
func (r *FirewallGroupReconciler) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) {
|
||||
log := log.FromContext(ctx)
|
||||
|
||||
cfg, err := r.ConfigLoader.GetConfig(ctx, "unifi-operator-config")
|
||||
if err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
defaultNs := cfg.Data["defaultNamespace"]
|
||||
log.Info(defaultNs)
|
||||
|
||||
var nwObj unifiv1beta1.FirewallGroup
|
||||
if err := r.Get(ctx, req.NamespacedName, &nwObj); err != nil {
|
||||
return reconcile.Result{}, client.IgnoreNotFound(err)
|
||||
@@ -170,7 +182,7 @@ func (r *FirewallGroupReconciler) Reconcile(ctx context.Context, req reconcile.R
|
||||
nwObj.Status.LastSyncTime = ¤tTime
|
||||
nwObj.Status.SyncedWithUnifi = true
|
||||
|
||||
err := r.UnifiClient.Reauthenticate()
|
||||
err = r.UnifiClient.Reauthenticate()
|
||||
if err != nil {
|
||||
return reconcile.Result{}, err
|
||||
}
|
||||
|
||||
76
internal/controller/firewallrule_controller.go
Normal file
76
internal/controller/firewallrule_controller.go
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
Copyright 2025 Vegard Engen.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
|
||||
unifiv1beta1 "github.com/vegardengen/unifi-network-operator/api/v1beta1"
|
||||
"github.com/vegardengen/unifi-network-operator/internal/unifi"
|
||||
"github.com/vegardengen/unifi-network-operator/internal/config"
|
||||
)
|
||||
|
||||
// FirewallRuleReconciler reconciles a FirewallRule object
|
||||
type FirewallRuleReconciler struct {
|
||||
client.Client
|
||||
Scheme *runtime.Scheme
|
||||
UnifiClient *unifi.UnifiClient
|
||||
ConfigLoader *config.ConfigLoaderType
|
||||
}
|
||||
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=firewallrules,verbs=get;list;watch;create;update;patch;delete
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=firewallrules/status,verbs=get;update;patch
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=firewallrules/finalizers,verbs=update
|
||||
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=list;get;watch
|
||||
|
||||
// Reconcile is part of the main kubernetes reconciliation loop which aims to
|
||||
// move the current state of the cluster closer to the desired state.
|
||||
// TODO(user): Modify the Reconcile function to compare the state specified by
|
||||
// the FirewallRule object against the actual cluster state, and then
|
||||
// perform operations to make the cluster state reflect the state specified by
|
||||
// the user.
|
||||
//
|
||||
// For more details, check Reconcile and its Result here:
|
||||
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/reconcile
|
||||
func (r *FirewallRuleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
||||
log := log.FromContext(ctx)
|
||||
|
||||
// TODO(user): your logic here
|
||||
|
||||
cfg, err := r.ConfigLoader.GetConfig(ctx, "unifi-operator-config")
|
||||
if err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
defaultNs := cfg.Data["defaultNamespace"]
|
||||
log.Info(defaultNs)
|
||||
|
||||
return ctrl.Result{}, nil
|
||||
}
|
||||
|
||||
// SetupWithManager sets up the controller with the Manager.
|
||||
func (r *FirewallRuleReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewControllerManagedBy(mgr).
|
||||
For(&unifiv1beta1.FirewallRule{}).
|
||||
Named("firewallrule").
|
||||
Complete(r)
|
||||
}
|
||||
84
internal/controller/firewallrule_controller_test.go
Normal file
84
internal/controller/firewallrule_controller_test.go
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
Copyright 2025 Vegard Engen.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
unifiv1beta1 "github.com/vegardengen/unifi-network-operator/api/v1beta1"
|
||||
)
|
||||
|
||||
var _ = Describe("FirewallRule Controller", func() {
|
||||
Context("When reconciling a resource", func() {
|
||||
const resourceName = "test-resource"
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
typeNamespacedName := types.NamespacedName{
|
||||
Name: resourceName,
|
||||
Namespace: "default", // TODO(user):Modify as needed
|
||||
}
|
||||
firewallrule := &unifiv1beta1.FirewallRule{}
|
||||
|
||||
BeforeEach(func() {
|
||||
By("creating the custom resource for the Kind FirewallRule")
|
||||
err := k8sClient.Get(ctx, typeNamespacedName, firewallrule)
|
||||
if err != nil && errors.IsNotFound(err) {
|
||||
resource := &unifiv1beta1.FirewallRule{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: resourceName,
|
||||
Namespace: "default",
|
||||
},
|
||||
// TODO(user): Specify other spec details if needed.
|
||||
}
|
||||
Expect(k8sClient.Create(ctx, resource)).To(Succeed())
|
||||
}
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
// TODO(user): Cleanup logic after each test, like removing the resource instance.
|
||||
resource := &unifiv1beta1.FirewallRule{}
|
||||
err := k8sClient.Get(ctx, typeNamespacedName, resource)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
By("Cleanup the specific resource instance FirewallRule")
|
||||
Expect(k8sClient.Delete(ctx, resource)).To(Succeed())
|
||||
})
|
||||
It("should successfully reconcile the resource", func() {
|
||||
By("Reconciling the created resource")
|
||||
controllerReconciler := &FirewallRuleReconciler{
|
||||
Client: k8sClient,
|
||||
Scheme: k8sClient.Scheme(),
|
||||
}
|
||||
|
||||
_, err := controllerReconciler.Reconcile(ctx, reconcile.Request{
|
||||
NamespacedName: typeNamespacedName,
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
// TODO(user): Add more specific assertions depending on your controller's reconciliation logic.
|
||||
// Example: If you expect a certain status condition after reconciliation, verify it here.
|
||||
})
|
||||
})
|
||||
})
|
||||
166
internal/controller/firewallzone_controller.go
Normal file
166
internal/controller/firewallzone_controller.go
Normal file
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
Copyright 2025 Vegard Engen.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"regexp"
|
||||
"time"
|
||||
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
ctrl "sigs.k8s.io/controller-runtime"
|
||||
"sigs.k8s.io/controller-runtime/pkg/client"
|
||||
"sigs.k8s.io/controller-runtime/pkg/log"
|
||||
|
||||
unifiv1beta1 "github.com/vegardengen/unifi-network-operator/api/v1beta1"
|
||||
"github.com/vegardengen/unifi-network-operator/internal/unifi"
|
||||
"github.com/vegardengen/unifi-network-operator/internal/config"
|
||||
)
|
||||
|
||||
// FirewallZoneReconciler reconciles a FirewallZone object
|
||||
type FirewallZoneReconciler struct {
|
||||
client.Client
|
||||
Scheme *runtime.Scheme
|
||||
UnifiClient *unifi.UnifiClient
|
||||
ConfigLoader *config.ConfigLoaderType
|
||||
}
|
||||
|
||||
func toKubeName(input string) string {
|
||||
// Lowercase the input
|
||||
name := strings.ToLower(input)
|
||||
|
||||
// Replace any non-alphanumeric characters with dashes
|
||||
re := regexp.MustCompile(`[^a-z0-9\-\.]+`)
|
||||
name = re.ReplaceAllString(name, "-")
|
||||
|
||||
// Trim leading and trailing non-alphanumerics
|
||||
name = strings.Trim(name, "-.")
|
||||
|
||||
// Ensure it's not empty and doesn't exceed 253 characters
|
||||
if len(name) == 0 {
|
||||
name = "default"
|
||||
} else if len(name) > 253 {
|
||||
name = name[:253]
|
||||
}
|
||||
|
||||
return name
|
||||
}
|
||||
|
||||
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=firewallzones,verbs=get;list;watch;create;update;patch;delete
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=firewallzones/status,verbs=get;update;patch
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=firewallzones/finalizers,verbs=update
|
||||
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=list;get;watch
|
||||
|
||||
// Reconcile is part of the main kubernetes reconciliation loop which aims to
|
||||
// move the current state of the cluster closer to the desired state.
|
||||
// TODO(user): Modify the Reconcile function to compare the state specified by
|
||||
// the FirewallZone object against the actual cluster state, and then
|
||||
// perform operations to make the cluster state reflect the state specified by
|
||||
// the user.
|
||||
//
|
||||
// For more details, check Reconcile and its Result here:
|
||||
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/reconcile
|
||||
func (r *FirewallZoneReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
||||
log := log.FromContext(ctx)
|
||||
|
||||
cfg, err := r.ConfigLoader.GetConfig(ctx, "unifi-operator-config")
|
||||
if err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
defaultNs := cfg.Data["defaultNamespace"]
|
||||
|
||||
var fwzCRDs unifiv1beta1.FirewallZoneList
|
||||
_ = r.List(ctx, &fwzCRDs, client.InNamespace(defaultNs))
|
||||
|
||||
firewall_zones, err := r.UnifiClient.Client.ListFirewallZones(context.Background(), r.UnifiClient.SiteID)
|
||||
if err != nil {
|
||||
log.Error(err, "Could not list firewall zones")
|
||||
return ctrl.Result{RequeueAfter: 10 * time.Minute}, err
|
||||
}
|
||||
log.Info(fmt.Sprintf("Number of resources: %d Number of zones in Unifi: %d", len(fwzCRDs.Items), len(firewall_zones)))
|
||||
|
||||
firewallZoneNamesUnifi := make(map[string]struct{})
|
||||
for _, zone := range firewall_zones {
|
||||
firewallZoneNamesUnifi[zone.Name] = struct{}{}
|
||||
}
|
||||
|
||||
// Step 2: Collect zones in fwzCRDs that are NOT in firewall_zones
|
||||
for _, zone := range fwzCRDs.Items {
|
||||
if _, found := firewallZoneNamesUnifi[zone.Spec.Name]; !found {
|
||||
err := r.Delete(ctx, &zone)
|
||||
if err != nil {
|
||||
return ctrl.Result{RequeueAfter: 10 * time.Minute}, err
|
||||
}
|
||||
}
|
||||
}
|
||||
firewallZoneNamesCRDs := make(map[string]struct{})
|
||||
for _, zoneCRD := range fwzCRDs.Items {
|
||||
firewallZoneNamesCRDs[zoneCRD.Spec.Name] = struct{}{}
|
||||
}
|
||||
for _, unifizone := range firewall_zones {
|
||||
log.Info(fmt.Sprintf("%+v\n", unifizone))
|
||||
if _, found := firewallZoneNamesCRDs[unifizone.Name]; !found {
|
||||
zoneCRD := &unifiv1beta1.FirewallZone {
|
||||
ObjectMeta : ctrl.ObjectMeta {
|
||||
Name: toKubeName(unifizone.Name),
|
||||
Namespace: defaultNs,
|
||||
},
|
||||
Spec: unifiv1beta1.FirewallZoneSpec {
|
||||
Name : unifizone.Name,
|
||||
ID : unifizone.ID,
|
||||
DefaultZone: unifizone.DefaultZone,
|
||||
ZoneKey : unifizone.ZoneKey,
|
||||
NetworkIDs : unifizone.NetworkIDs,
|
||||
},
|
||||
}
|
||||
err := r.Create(ctx, zoneCRD)
|
||||
if err != nil {
|
||||
return ctrl.Result{RequeueAfter: 10 * time.Minute}, err
|
||||
}
|
||||
} else {
|
||||
for _, zoneCRD := range fwzCRDs.Items {
|
||||
if zoneCRD.Spec.Name == unifizone.Name {
|
||||
zoneCRD.Spec = unifiv1beta1.FirewallZoneSpec {
|
||||
Name : unifizone.Name,
|
||||
ID : unifizone.ID,
|
||||
DefaultZone: unifizone.DefaultZone,
|
||||
ZoneKey : unifizone.ZoneKey,
|
||||
NetworkIDs : unifizone.NetworkIDs,
|
||||
}
|
||||
err := r.Update(ctx, &zoneCRD)
|
||||
if err != nil {
|
||||
return ctrl.Result{RequeueAfter: 10 * time.Minute}, err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ctrl.Result{RequeueAfter: 10 * time.Minute}, nil
|
||||
}
|
||||
|
||||
// SetupWithManager sets up the controller with the Manager.
|
||||
func (r *FirewallZoneReconciler) SetupWithManager(mgr ctrl.Manager) error {
|
||||
return ctrl.NewControllerManagedBy(mgr).
|
||||
For(&unifiv1beta1.FirewallZone{}).
|
||||
Named("firewallzone").
|
||||
Complete(r)
|
||||
}
|
||||
84
internal/controller/firewallzone_controller_test.go
Normal file
84
internal/controller/firewallzone_controller_test.go
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
Copyright 2025 Vegard Engen.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
package controller
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
. "github.com/onsi/ginkgo/v2"
|
||||
. "github.com/onsi/gomega"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"sigs.k8s.io/controller-runtime/pkg/reconcile"
|
||||
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
||||
unifiv1beta1 "github.com/vegardengen/unifi-network-operator/api/v1beta1"
|
||||
)
|
||||
|
||||
var _ = Describe("FirewallZone Controller", func() {
|
||||
Context("When reconciling a resource", func() {
|
||||
const resourceName = "test-resource"
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
typeNamespacedName := types.NamespacedName{
|
||||
Name: resourceName,
|
||||
Namespace: "default", // TODO(user):Modify as needed
|
||||
}
|
||||
firewallzone := &unifiv1beta1.FirewallZone{}
|
||||
|
||||
BeforeEach(func() {
|
||||
By("creating the custom resource for the Kind FirewallZone")
|
||||
err := k8sClient.Get(ctx, typeNamespacedName, firewallzone)
|
||||
if err != nil && errors.IsNotFound(err) {
|
||||
resource := &unifiv1beta1.FirewallZone{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: resourceName,
|
||||
Namespace: "default",
|
||||
},
|
||||
// TODO(user): Specify other spec details if needed.
|
||||
}
|
||||
Expect(k8sClient.Create(ctx, resource)).To(Succeed())
|
||||
}
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
// TODO(user): Cleanup logic after each test, like removing the resource instance.
|
||||
resource := &unifiv1beta1.FirewallZone{}
|
||||
err := k8sClient.Get(ctx, typeNamespacedName, resource)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
By("Cleanup the specific resource instance FirewallZone")
|
||||
Expect(k8sClient.Delete(ctx, resource)).To(Succeed())
|
||||
})
|
||||
It("should successfully reconcile the resource", func() {
|
||||
By("Reconciling the created resource")
|
||||
controllerReconciler := &FirewallZoneReconciler{
|
||||
Client: k8sClient,
|
||||
Scheme: k8sClient.Scheme(),
|
||||
}
|
||||
|
||||
_, err := controllerReconciler.Reconcile(ctx, reconcile.Request{
|
||||
NamespacedName: typeNamespacedName,
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
// TODO(user): Add more specific assertions depending on your controller's reconciliation logic.
|
||||
// Example: If you expect a certain status condition after reconciliation, verify it here.
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
|
||||
unifiv1 "github.com/vegardengen/unifi-network-operator/api/v1beta1"
|
||||
"github.com/vegardengen/unifi-network-operator/internal/unifi"
|
||||
"github.com/vegardengen/unifi-network-operator/internal/config"
|
||||
)
|
||||
|
||||
// NetworkconfigurationReconciler reconciles a Networkconfiguration object
|
||||
@@ -34,11 +35,13 @@ type NetworkconfigurationReconciler struct {
|
||||
client.Client
|
||||
Scheme *runtime.Scheme
|
||||
UnifiClient *unifi.UnifiClient
|
||||
ConfigLoader *config.ConfigLoaderType
|
||||
}
|
||||
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=networkconfigurations,verbs=get;list;watch;create;update;patch;delete
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=networkconfigurations/status,verbs=get;update;patch
|
||||
// +kubebuilder:rbac:groups=unifi.engen.priv.no,resources=networkconfigurations/finalizers,verbs=update
|
||||
// +kubebuilder:rbac:groups="",resources=configmaps,verbs=list;get;watch
|
||||
|
||||
// Reconcile is part of the main kubernetes reconciliation loop which aims to
|
||||
// move the current state of the cluster closer to the desired state.
|
||||
@@ -51,6 +54,13 @@ type NetworkconfigurationReconciler struct {
|
||||
// - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.20.2/pkg/reconcile
|
||||
func (r *NetworkconfigurationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
|
||||
log := log.FromContext(ctx)
|
||||
cfg, err := r.ConfigLoader.GetConfig(ctx, "unifi-operator-config")
|
||||
if err != nil {
|
||||
return ctrl.Result{}, err
|
||||
}
|
||||
|
||||
defaultNs := cfg.Data["defaultNamespace"]
|
||||
log.Info(defaultNs)
|
||||
|
||||
var networkCRDs unifiv1.NetworkconfigurationList
|
||||
if err := r.List(ctx, &networkCRDs); err != nil {
|
||||
@@ -78,7 +88,23 @@ func (r *NetworkconfigurationReconciler) Reconcile(ctx context.Context, req ctrl
|
||||
if existing, found := k8sNetworks[networkID]; found {
|
||||
log.Info(fmt.Sprintf("Found network match: %s/%s", existing.Spec.NetworkID, networkID))
|
||||
} else {
|
||||
log.Info(fmt.Sprintf("New network: %s with ID %s", network.Name, network.ID))
|
||||
if network.Purpose == "corporate" {
|
||||
log.Info(fmt.Sprintf("New network: %s with ID %s", network.Name, network.ID))
|
||||
var networkObject unifiv1.Networkconfiguration
|
||||
networkObject.Name = network.Name
|
||||
networkObject.Spec.Name = network.Name
|
||||
networkObject.Spec.NetworkID = network.ID
|
||||
networkObject.Spec.IPSubnet = network.IPSubnet
|
||||
networkObject.Spec.Ipv6InterfaceType = network.IPV6InterfaceType
|
||||
networkObject.Spec.Ipv6PdAutoPrefixidEnabled = network.IPV6PDAutoPrefixidEnabled
|
||||
networkObject.Spec.Ipv6RaEnabled = network.IPV6RaEnabled
|
||||
networkObject.Spec.Ipv6SettingPreference = network.IPV6SettingPreference
|
||||
networkObject.Spec.Ipv6Subnet = network.IPV6Subnet
|
||||
networkObject.Spec.Purpose = network.Purpose
|
||||
networkObject.Spec.Networkgroup = network.NetworkGroup
|
||||
networkObject.Spec.SettingPreference = network.SettingPreference
|
||||
networkObject.Spec.VlanEnabled = network.VLANEnabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user