Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -509,4 +509,12 @@ resources:
kind: StandaloneDatabase
path: github.com/kloudlite/operator/apis/mongodb.msvc/v1
version: v1
- api:
crdVersion: v1
namespaced: true
domain: kloudlite.io
group: crds
kind: ServiceIntercept
path: github.com/kloudlite/operator/apis/crds/v1
version: v1
version: "3"
74 changes: 74 additions & 0 deletions apis/crds/v1/serviceintercept_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package v1

import (
"github.com/kloudlite/operator/pkg/constants"
rApi "github.com/kloudlite/operator/pkg/operator"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type SvcInterceptPortMappings struct {
ContainerPort uint16 `json:"containerPort"`
ServicePort uint16 `json:"servicePort"`
}

type ServiceInterceptSpec struct {
ToAddr string `json:"toAddress"`
PortMappings []SvcInterceptPortMappings `json:"portMappings"`
}

type ServiceInterceptStatus struct {
rApi.Status `json:",inline"`
Selector map[string]string `json:"selector,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:JSONPath=".status.lastReconcileTime",name=Seen,type=date
// +kubebuilder:printcolumn:JSONPath=".metadata.annotations.kloudlite\\.io\\/operator\\.checks",name=Checks,type=string
// +kubebuilder:printcolumn:JSONPath=".metadata.annotations.kloudlite\\.io\\/operator\\.resource\\.ready",name=Ready,type=string
// +kubebuilder:printcolumn:JSONPath=".metadata.creationTimestamp",name=Age,type=date
// ServiceIntercept is the Schema for the serviceintercepts API
type ServiceIntercept struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ServiceInterceptSpec `json:"spec,omitempty"`
Status ServiceInterceptStatus `json:"status,omitempty" graphql:"noinput"`
}

func (svci *ServiceIntercept) EnsureGVK() {
if svci != nil {
svci.SetGroupVersionKind(GroupVersion.WithKind("ServiceIntercept"))
}
}

func (svci *ServiceIntercept) GetStatus() *rApi.Status {
return &svci.Status.Status
}

func (svci *ServiceIntercept) GetEnsuredLabels() map[string]string {
m := map[string]string{
"kloudlite.io/svci.name": svci.Name,
}

return m
}

func (svci *ServiceIntercept) GetEnsuredAnnotations() map[string]string {
return map[string]string{
constants.AnnotationKeys.GroupVersionKind: GroupVersion.WithKind("ServiceIntercept").String(),
}
}

//+kubebuilder:object:root=true

// ServiceInterceptList contains a list of ServiceIntercept
type ServiceInterceptList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ServiceIntercept `json:"items"`
}

func init() {
SchemeBuilder.Register(&ServiceIntercept{}, &ServiceInterceptList{})
}
117 changes: 117 additions & 0 deletions apis/crds/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions cmd/agent-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
routers "github.com/kloudlite/operator/operators/routers/controller"
// nodepool "github.com/kloudlite/operator/operators/nodepool/controller"
// wireguard "github.com/kloudlite/operator/operators/wireguard/controller"
serviceIntercept "github.com/kloudlite/operator/operators/service-intercept/controller"
)

func main() {
Expand Down Expand Up @@ -50,5 +51,7 @@ func main() {

networkingv1.RegisterInto(mgr)

serviceIntercept.RegisterInto(mgr)

mgr.Start()
}
3 changes: 3 additions & 0 deletions cmd/platform-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
msvcMysql "github.com/kloudlite/operator/operators/msvc-mysql/controller"
msvcPostgres "github.com/kloudlite/operator/operators/msvc-postgres/controller"
msvcRedis "github.com/kloudlite/operator/operators/msvc-redis/controller"
serviceIntercept "github.com/kloudlite/operator/operators/service-intercept/controller"
)

func main() {
Expand All @@ -42,6 +43,8 @@ func main() {

lifecycle.RegisterInto(mgr)

serviceIntercept.RegisterInto(mgr)

// clusters.RegisterInto(mgr)
// nodepool.RegisterInto(mgr) // MIGRATE
// virtualMachine.RegisterInto(mgr)
Expand Down
Loading
Loading