Initial commit
Validate and publish / Test image and chart (push) Failing after 2m25s
Validate and publish / Publish image and OCI chart (push) Skipped

This commit is contained in:
feedc0de committed 2026-08-28 23:12:14 +02:00
1 parent 09fe9553d7
commit d45d84462d
32 files changed
+2401 -2

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
// Package v1alpha1 contains the API types for the MikroTik operator.
// +kubebuilder:object:generate=true
// +groupName=mikrotik.brunner.ninja
package v1alpha1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)
var (
GroupVersion = schema.GroupVersion{Group: "mikrotik.brunner.ninja", Version: "v1alpha1"}
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
AddToScheme = SchemeBuilder.AddToScheme
)
+61
View File
@@ -0,0 +1,61 @@
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// NamespacedSecretReference points to a Secret from a cluster-scoped resource.
type NamespacedSecretReference struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
}
type TLSConfig struct {
// InsecureSkipVerify is intended only for initial testing.
InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty"`
// CASecretRef points to a Secret whose ca.crt key contains a PEM CA bundle.
CASecretRef *NamespacedSecretReference `json:"caSecretRef,omitempty"`
}
type MikroTikRouterSpec struct {
// Endpoint is the RouterOS base URL, for example https://router.example.net.
Endpoint string `json:"endpoint"`
// CredentialsSecretRef points to a Secret containing username and password keys.
CredentialsSecretRef NamespacedSecretReference `json:"credentialsSecretRef"`
TLS TLSConfig `json:"tls,omitempty"`
// AllowedNamespaces is an explicit allowlist. An empty list allows no Services.
// The single value "*" allows every namespace.
AllowedNamespaces []string `json:"allowedNamespaces,omitempty"`
}
type MikroTikRouterStatus struct {
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
ManagedRules int32 `json:"managedRules,omitempty"`
LastSyncTime *metav1.Time `json:"lastSyncTime,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster,shortName=mtr
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Endpoint",type=string,JSONPath=`.spec.endpoint`
// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status`
// +kubebuilder:printcolumn:name="Rules",type=integer,JSONPath=`.status.managedRules`
type MikroTikRouter struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec MikroTikRouterSpec `json:"spec,omitempty"`
Status MikroTikRouterStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
type MikroTikRouterList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MikroTikRouter `json:"items"`
}
func init() {
SchemeBuilder.Register(&MikroTikRouter{}, &MikroTikRouterList{})
}
+113
View File
@@ -0,0 +1,113 @@
// Code generated by controller-gen. DO NOT EDIT.
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
func (in *NamespacedSecretReference) DeepCopyInto(out *NamespacedSecretReference) { *out = *in }
func (in *NamespacedSecretReference) DeepCopy() *NamespacedSecretReference {
if in == nil {
return nil
}
out := new(NamespacedSecretReference)
in.DeepCopyInto(out)
return out
}
func (in *TLSConfig) DeepCopyInto(out *TLSConfig) {
*out = *in
if in.CASecretRef != nil {
out.CASecretRef = in.CASecretRef.DeepCopy()
}
}
func (in *TLSConfig) DeepCopy() *TLSConfig {
if in == nil {
return nil
}
out := new(TLSConfig)
in.DeepCopyInto(out)
return out
}
func (in *MikroTikRouterSpec) DeepCopyInto(out *MikroTikRouterSpec) {
*out = *in
in.TLS.DeepCopyInto(&out.TLS)
if in.AllowedNamespaces != nil {
out.AllowedNamespaces = append([]string(nil), in.AllowedNamespaces...)
}
}
func (in *MikroTikRouterSpec) DeepCopy() *MikroTikRouterSpec {
if in == nil {
return nil
}
out := new(MikroTikRouterSpec)
in.DeepCopyInto(out)
return out
}
func (in *MikroTikRouterStatus) DeepCopyInto(out *MikroTikRouterStatus) {
*out = *in
if in.LastSyncTime != nil {
out.LastSyncTime = in.LastSyncTime.DeepCopy()
}
if in.Conditions != nil {
out.Conditions = make([]metav1.Condition, len(in.Conditions))
for i := range in.Conditions {
in.Conditions[i].DeepCopyInto(&out.Conditions[i])
}
}
}
func (in *MikroTikRouterStatus) DeepCopy() *MikroTikRouterStatus {
if in == nil {
return nil
}
out := new(MikroTikRouterStatus)
in.DeepCopyInto(out)
return out
}
func (in *MikroTikRouter) DeepCopyInto(out *MikroTikRouter) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
func (in *MikroTikRouter) DeepCopy() *MikroTikRouter {
if in == nil {
return nil
}
out := new(MikroTikRouter)
in.DeepCopyInto(out)
return out
}
func (in *MikroTikRouter) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
func (in *MikroTikRouterList) DeepCopyInto(out *MikroTikRouterList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
out.Items = make([]MikroTikRouter, len(in.Items))
for i := range in.Items {
in.Items[i].DeepCopyInto(&out.Items[i])
}
}
}
func (in *MikroTikRouterList) DeepCopy() *MikroTikRouterList {
if in == nil {
return nil
}
out := new(MikroTikRouterList)
in.DeepCopyInto(out)
return out
}
func (in *MikroTikRouterList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}