diff --git a/.golangci.yaml b/.golangci.yaml
index a841e8cf2..d46694844 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -77,6 +77,8 @@ linters-settings:
alias: mlSharedTests
- pkg: github.com/arangodb/kube-arangodb/pkg/apis/analytics/v1alpha1
alias: analyticsApi
+ - pkg: github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1
+ alias: networkingApi
- pkg: github.com/arangodb/kube-arangodb/pkg/apis/ml/v1beta1
alias: mlApi
- pkg: github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8501342fe..b7d9770dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,7 @@
# Change Log
## [master](https://github.com/arangodb/kube-arangodb/tree/master) (N/A)
+- (Feature) ArangoRoute CRD
## [1.2.42](https://github.com/arangodb/kube-arangodb/tree/1.2.42) (2024-07-23)
- (Maintenance) Go 1.22.4 & Kubernetes 1.29.6 libraries
diff --git a/Makefile b/Makefile
index bf6f3cf4e..b82382f3a 100644
--- a/Makefile
+++ b/Makefile
@@ -440,7 +440,8 @@ update-generated:
apps:v1 \
ml:v1alpha1 ml:v1beta1 \
scheduler:v1alpha1 scheduler:v1beta1 \
- analytics:v1alpha1" \
+ analytics:v1alpha1 \
+ networking:v1alpha1" \
--go-header-file "./tools/codegen/boilerplate.go.txt" \
$(VERIFYARGS)
GOPATH=$(GOBUILDDIR) $(VENDORDIR)/k8s.io/code-generator/generate-groups.sh \
@@ -894,7 +895,8 @@ CRDS:=apps-job \
replication-deploymentreplication \
ml-storage ml-extension ml-job-batch ml-job-cron \
scheduler-profile \
- analytics-graphanalyticsengine
+ analytics-graphanalyticsengine \
+ networking-route
.PHONY: sync
sync:
diff --git a/chart/kube-arangodb-arm64/crds/networking-route.yaml b/chart/kube-arangodb-arm64/crds/networking-route.yaml
new file mode 100644
index 000000000..514c0763f
--- /dev/null
+++ b/chart/kube-arangodb-arm64/crds/networking-route.yaml
@@ -0,0 +1,22 @@
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: arangoroutes.networking.arangodb.com
+spec:
+ group: networking.arangodb.com
+ names:
+ kind: ArangoRoute
+ listKind: ArangoRouteList
+ plural: arangoroutes
+ singular: arangoroute
+ scope: Namespaced
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/chart/kube-arangodb-arm64/templates/deployment-operator/role.yaml b/chart/kube-arangodb-arm64/templates/deployment-operator/role.yaml
index ad6fd3796..18d5e8582 100644
--- a/chart/kube-arangodb-arm64/templates/deployment-operator/role.yaml
+++ b/chart/kube-arangodb-arm64/templates/deployment-operator/role.yaml
@@ -16,6 +16,9 @@ rules:
- apiGroups: ["database.arangodb.com"]
resources: ["arangodeployments", "arangodeployments/status","arangomembers", "arangomembers/status"]
verbs: ["*"]
+ - apiGroups: ["networking.arangodb.com"]
+ resources: ["arangoroutes", "arangoroutes/status"]
+ verbs: ["*"]
{{- if .Values.rbac.extensions.acs }}
- apiGroups: ["database.arangodb.com"]
resources: ["arangoclustersynchronizations", "arangoclustersynchronizations/status"]
diff --git a/chart/kube-arangodb-enterprise-arm64/crds/networking-route.yaml b/chart/kube-arangodb-enterprise-arm64/crds/networking-route.yaml
new file mode 100644
index 000000000..514c0763f
--- /dev/null
+++ b/chart/kube-arangodb-enterprise-arm64/crds/networking-route.yaml
@@ -0,0 +1,22 @@
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: arangoroutes.networking.arangodb.com
+spec:
+ group: networking.arangodb.com
+ names:
+ kind: ArangoRoute
+ listKind: ArangoRouteList
+ plural: arangoroutes
+ singular: arangoroute
+ scope: Namespaced
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/chart/kube-arangodb-enterprise-arm64/templates/deployment-operator/role.yaml b/chart/kube-arangodb-enterprise-arm64/templates/deployment-operator/role.yaml
index ad6fd3796..18d5e8582 100644
--- a/chart/kube-arangodb-enterprise-arm64/templates/deployment-operator/role.yaml
+++ b/chart/kube-arangodb-enterprise-arm64/templates/deployment-operator/role.yaml
@@ -16,6 +16,9 @@ rules:
- apiGroups: ["database.arangodb.com"]
resources: ["arangodeployments", "arangodeployments/status","arangomembers", "arangomembers/status"]
verbs: ["*"]
+ - apiGroups: ["networking.arangodb.com"]
+ resources: ["arangoroutes", "arangoroutes/status"]
+ verbs: ["*"]
{{- if .Values.rbac.extensions.acs }}
- apiGroups: ["database.arangodb.com"]
resources: ["arangoclustersynchronizations", "arangoclustersynchronizations/status"]
diff --git a/chart/kube-arangodb-enterprise/crds/networking-route.yaml b/chart/kube-arangodb-enterprise/crds/networking-route.yaml
new file mode 100644
index 000000000..514c0763f
--- /dev/null
+++ b/chart/kube-arangodb-enterprise/crds/networking-route.yaml
@@ -0,0 +1,22 @@
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: arangoroutes.networking.arangodb.com
+spec:
+ group: networking.arangodb.com
+ names:
+ kind: ArangoRoute
+ listKind: ArangoRouteList
+ plural: arangoroutes
+ singular: arangoroute
+ scope: Namespaced
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/chart/kube-arangodb-enterprise/templates/deployment-operator/role.yaml b/chart/kube-arangodb-enterprise/templates/deployment-operator/role.yaml
index ad6fd3796..18d5e8582 100644
--- a/chart/kube-arangodb-enterprise/templates/deployment-operator/role.yaml
+++ b/chart/kube-arangodb-enterprise/templates/deployment-operator/role.yaml
@@ -16,6 +16,9 @@ rules:
- apiGroups: ["database.arangodb.com"]
resources: ["arangodeployments", "arangodeployments/status","arangomembers", "arangomembers/status"]
verbs: ["*"]
+ - apiGroups: ["networking.arangodb.com"]
+ resources: ["arangoroutes", "arangoroutes/status"]
+ verbs: ["*"]
{{- if .Values.rbac.extensions.acs }}
- apiGroups: ["database.arangodb.com"]
resources: ["arangoclustersynchronizations", "arangoclustersynchronizations/status"]
diff --git a/chart/kube-arangodb/crds/networking-route.yaml b/chart/kube-arangodb/crds/networking-route.yaml
new file mode 100644
index 000000000..514c0763f
--- /dev/null
+++ b/chart/kube-arangodb/crds/networking-route.yaml
@@ -0,0 +1,22 @@
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: arangoroutes.networking.arangodb.com
+spec:
+ group: networking.arangodb.com
+ names:
+ kind: ArangoRoute
+ listKind: ArangoRouteList
+ plural: arangoroutes
+ singular: arangoroute
+ scope: Namespaced
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/chart/kube-arangodb/templates/deployment-operator/role.yaml b/chart/kube-arangodb/templates/deployment-operator/role.yaml
index ad6fd3796..18d5e8582 100644
--- a/chart/kube-arangodb/templates/deployment-operator/role.yaml
+++ b/chart/kube-arangodb/templates/deployment-operator/role.yaml
@@ -16,6 +16,9 @@ rules:
- apiGroups: ["database.arangodb.com"]
resources: ["arangodeployments", "arangodeployments/status","arangomembers", "arangomembers/status"]
verbs: ["*"]
+ - apiGroups: ["networking.arangodb.com"]
+ resources: ["arangoroutes", "arangoroutes/status"]
+ verbs: ["*"]
{{- if .Values.rbac.extensions.acs }}
- apiGroups: ["database.arangodb.com"]
resources: ["arangoclustersynchronizations", "arangoclustersynchronizations/status"]
diff --git a/docs/api/ArangoRoute.V1Alpha1.md b/docs/api/ArangoRoute.V1Alpha1.md
new file mode 100644
index 000000000..f0e148992
--- /dev/null
+++ b/docs/api/ArangoRoute.V1Alpha1.md
@@ -0,0 +1,91 @@
+---
+layout: page
+parent: CRD reference
+title: ArangoRoute V1Alpha1
+---
+
+# API Reference for ArangoRoute V1Alpha1
+
+## Spec
+
+### .spec.deployment
+
+Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec.go#L27)
+
+Deployment specifies the ArangoDeployment object name
+
+***
+
+### .spec.destination.schema
+
+Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec_destination.go#L30)
+
+Schema defines HTTP/S schema used for connection
+
+***
+
+### .spec.destination.service.checksum
+
+Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/shared/v1/object.go#L61)
+
+UID keeps the information about object Checksum
+
+***
+
+### .spec.destination.service.name
+
+Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/shared/v1/object.go#L52)
+
+Name of the object
+
+***
+
+### .spec.destination.service.namespace
+
+Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/shared/v1/object.go#L55)
+
+Namespace of the object. Should default to the namespace of the parent object
+
+***
+
+### .spec.destination.service.port
+
+Type: `intstr.IntOrString` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec_destination_service.go#L36)
+
+Port defines Port or Port Name used as destination
+
+Links:
+* [Documentation](https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/)
+
+***
+
+### .spec.destination.service.uid
+
+Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/shared/v1/object.go#L58)
+
+UID keeps the information about object UID
+
+***
+
+### .spec.destination.tls.insecure
+
+Type: `boolean` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec_destination_tls.go#L25)
+
+Insecure allows Insecure traffic
+
+***
+
+### .spec.route.path
+
+Type: `string` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec_route.go#L29)
+
+Path specifies the Path route
+
+## Status
+
+### .status.conditions
+
+Type: `api.Conditions` [\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_status.go#L28)
+
+Conditions specific to the entire extension
+
diff --git a/internal/cr_validation_test.go b/internal/cr_validation_test.go
index 6cdfe38fb..b5d8dc04c 100644
--- a/internal/cr_validation_test.go
+++ b/internal/cr_validation_test.go
@@ -40,6 +40,7 @@ import (
deploymentv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
mlApiv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
mlApi "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1beta1"
+ networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
replicationv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v2alpha1"
schedulerApiv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
@@ -283,6 +284,15 @@ func Test_GenerateCRValidationSchemas(t *testing.T) {
},
},
},
+ "networking-route": {
+ fmt.Sprintf("%s/pkg/apis/networking/v1alpha1", root): {
+ "v1alpha1": {
+ objects: map[string]interface{}{
+ "spec": networkingApi.ArangoRoute{}.Spec,
+ },
+ },
+ },
+ },
}
for filePrefix, packagesToVersion := range input {
diff --git a/internal/docs_parser_test.go b/internal/docs_parser_test.go
index bd181ab8f..9f2784e43 100644
--- a/internal/docs_parser_test.go
+++ b/internal/docs_parser_test.go
@@ -293,7 +293,7 @@ func isSimpleType(obj reflect.Type) (string, string, bool) {
}
func extractTag(tag string) (string, bool) {
- parts := strings.SplitN(tag, ",", 2)
+ parts := strings.Split(tag, ",")
if len(parts) == 1 {
return parts[0], false
diff --git a/internal/docs_test.go b/internal/docs_test.go
index cdfd79d2a..b1c8a2003 100644
--- a/internal/docs_test.go
+++ b/internal/docs_test.go
@@ -42,6 +42,7 @@ import (
deploymentApi "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
mlApiv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
mlApi "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1beta1"
+ networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
replicationApi "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
schedulerApiv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
schedulerApi "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1beta1"
@@ -249,6 +250,19 @@ func Test_GenerateAPIDocs(t *testing.T) {
},
},
},
+ "networking": map[string]inputPackage{
+ "v1alpha1": {
+ Types: inputPackageTypes{
+ "ArangoRoute.V1Alpha1": {
+ "Spec": networkingApi.ArangoRoute{}.Spec,
+ "Status": networkingApi.ArangoRoute{}.Status,
+ },
+ },
+ Shared: []string{
+ "shared/v1",
+ },
+ },
+ },
"analytics": map[string]inputPackage{
"v1alpha1": {
Types: inputPackageTypes{
diff --git a/internal/schema_builder_test.go b/internal/schema_builder_test.go
index 4b0a2edbb..af82eb633 100644
--- a/internal/schema_builder_test.go
+++ b/internal/schema_builder_test.go
@@ -228,7 +228,7 @@ func (b *schemaBuilder) StructToSchema(t *testing.T, structObj reflect.Type, pat
schema.Properties[k] = v
}
} else {
- require.NotEmpty(t, n, fullFieldName)
+ require.NotEmpty(t, n, fullFieldName, inline)
schema.Properties[n] = *s
}
}
diff --git a/pkg/apis/networking/definitions.go b/pkg/apis/networking/definitions.go
new file mode 100644
index 000000000..629edad93
--- /dev/null
+++ b/pkg/apis/networking/definitions.go
@@ -0,0 +1,29 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package networking
+
+const (
+ ArangoRouteCRDName = ArangoRouteResourcePlural + "." + ArangoNetworkingGroupName
+ ArangoRouteResourceKind = "ArangoRoute"
+ ArangoRouteResourcePlural = "arangoroutes"
+
+ ArangoNetworkingGroupName = "networking.arangodb.com"
+)
diff --git a/pkg/apis/networking/v1alpha1/doc.go b/pkg/apis/networking/v1alpha1/doc.go
new file mode 100644
index 000000000..441bd1b92
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/doc.go
@@ -0,0 +1,23 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// +k8s:deepcopy-gen=package
+// +groupName=networking.arangodb.com
+package v1alpha1
diff --git a/pkg/apis/networking/v1alpha1/register.go b/pkg/apis/networking/v1alpha1/register.go
new file mode 100644
index 000000000..af7697c9f
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/register.go
@@ -0,0 +1,52 @@
+//
+// DISCLAIMER
+//
+// Copyright 2023-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import (
+ meta "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/runtime"
+ "k8s.io/apimachinery/pkg/runtime/schema"
+
+ "github.com/arangodb/kube-arangodb/pkg/apis/networking"
+)
+
+const (
+ ArangoNetworkingVersion = "v1alpha1"
+)
+
+var (
+ SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
+ AddToScheme = SchemeBuilder.AddToScheme
+
+ SchemeGroupVersion = schema.GroupVersion{Group: networking.ArangoNetworkingGroupName, Version: ArangoNetworkingVersion}
+)
+
+// Resource gets an ArangoCluster GroupResource for a specified resource
+func Resource(resource string) schema.GroupResource {
+ return SchemeGroupVersion.WithResource(resource).GroupResource()
+}
+
+// addKnownTypes adds the set of types defined in this package to the supplied scheme.
+func addKnownTypes(s *runtime.Scheme) error {
+ s.AddKnownTypes(SchemeGroupVersion)
+ meta.AddToGroupVersion(s, SchemeGroupVersion)
+ return nil
+}
diff --git a/pkg/apis/networking/v1alpha1/route.go b/pkg/apis/networking/v1alpha1/route.go
new file mode 100644
index 000000000..4b47f3dcc
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/route.go
@@ -0,0 +1,69 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import (
+ meta "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ "github.com/arangodb/kube-arangodb/pkg/apis/networking"
+)
+
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// ArangoRouteList is a list of Arango Routes.
+type ArangoRouteList struct {
+ meta.TypeMeta `json:",inline"`
+ meta.ListMeta `json:"metadata,omitempty"`
+
+ Items []ArangoRoute `json:"items"`
+}
+
+// +genclient
+// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
+
+// ArangoRoute contains definition and status of the Arango Route.
+type ArangoRoute struct {
+ meta.TypeMeta `json:",inline"`
+ meta.ObjectMeta `json:"metadata,omitempty"`
+
+ Spec ArangoRouteSpec `json:"spec"`
+ Status ArangoRouteStatus `json:"status"`
+}
+
+// AsOwner creates an OwnerReference for the given Extension
+func (a *ArangoRoute) AsOwner() meta.OwnerReference {
+ trueVar := true
+ return meta.OwnerReference{
+ APIVersion: SchemeGroupVersion.String(),
+ Kind: networking.ArangoRouteResourceKind,
+ Name: a.Name,
+ UID: a.UID,
+ Controller: &trueVar,
+ }
+}
+
+func (a *ArangoRoute) GetStatus() ArangoRouteStatus {
+ return a.Status
+}
+
+func (a *ArangoRoute) SetStatus(status ArangoRouteStatus) {
+ a.Status = status
+}
diff --git a/pkg/apis/networking/v1alpha1/route_spec.go b/pkg/apis/networking/v1alpha1/route_spec.go
new file mode 100644
index 000000000..d98caf3ca
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/route_spec.go
@@ -0,0 +1,50 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
+
+type ArangoRouteSpec struct {
+ // Deployment specifies the ArangoDeployment object name
+ Deployment string `json:"deployment,omitempty"`
+
+ // Destination defines the route destination
+ Destination *ArangoRouteSpecDestination `json:"destination,omitempty"`
+
+ // Route defines the route spec
+ Route *ArangoRouteSpecRoute `json:"route,omitempty"`
+}
+
+func (s *ArangoRouteSpec) Validate() error {
+ if s == nil {
+ s = &ArangoRouteSpec{}
+ }
+
+ if err := shared.WithErrors(shared.PrefixResourceErrors("spec",
+ shared.PrefixResourceError("deployment", shared.ValidateResourceName(s.Deployment)),
+ shared.ValidateRequiredInterfacePath("destination", s.Destination),
+ shared.ValidateRequiredInterfacePath("route", s.Route),
+ )); err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/pkg/apis/networking/v1alpha1/route_spec_destination.go b/pkg/apis/networking/v1alpha1/route_spec_destination.go
new file mode 100644
index 000000000..e491bea21
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/route_spec_destination.go
@@ -0,0 +1,50 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
+
+type ArangoRouteSpecDestination struct {
+ // Service defines service upstream reference
+ Service *ArangoRouteSpecDestinationService `json:"service,omitempty"`
+
+ // Schema defines HTTP/S schema used for connection
+ Schema *ArangoRouteSpecDestinationSchema `json:"schema,omitempty"`
+
+ // TLS defines TLS Configuration
+ TLS *ArangoRouteSpecDestinationTLS `json:"tls,omitempty"`
+}
+
+func (s *ArangoRouteSpecDestination) Validate() error {
+ if s == nil {
+ s = &ArangoRouteSpecDestination{}
+ }
+
+ if err := shared.WithErrors(
+ shared.ValidateOptionalInterfacePath("service", s.Service),
+ shared.ValidateOptionalInterfacePath("schema", s.Schema),
+ shared.ValidateOptionalInterfacePath("tls", s.TLS),
+ ); err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/pkg/apis/networking/v1alpha1/route_spec_destination_schema.go b/pkg/apis/networking/v1alpha1/route_spec_destination_schema.go
new file mode 100644
index 000000000..6ad96e2a5
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/route_spec_destination_schema.go
@@ -0,0 +1,55 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import (
+ "github.com/arangodb/kube-arangodb/pkg/util/errors"
+ "github.com/arangodb/kube-arangodb/pkg/util/strings"
+)
+
+type ArangoRouteSpecDestinationSchema string
+
+const (
+ ArangoRouteSpecDestinationSchemaHTTP ArangoRouteSpecDestinationSchema = "http"
+ ArangoRouteSpecDestinationSchemaHTTPS ArangoRouteSpecDestinationSchema = "https"
+ ArangoRouteSpecDestinationSchemaDefault = ArangoRouteSpecDestinationSchemaHTTP
+)
+
+func (a *ArangoRouteSpecDestinationSchema) Get() ArangoRouteSpecDestinationSchema {
+ if a == nil {
+ return ArangoRouteSpecDestinationSchemaDefault
+ }
+
+ return ArangoRouteSpecDestinationSchema(strings.ToLower(string(*a)))
+}
+
+func (a *ArangoRouteSpecDestinationSchema) String() string {
+ return string(a.Get())
+}
+
+func (a *ArangoRouteSpecDestinationSchema) Validate() error {
+ switch x := a.Get(); x {
+ case ArangoRouteSpecDestinationSchemaHTTP, ArangoRouteSpecDestinationSchemaHTTPS:
+ return nil
+ default:
+ return errors.Errorf("Invalid schema: %s", x.String())
+ }
+}
diff --git a/pkg/apis/networking/v1alpha1/route_spec_destination_service.go b/pkg/apis/networking/v1alpha1/route_spec_destination_service.go
new file mode 100644
index 000000000..af55e3edc
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/route_spec_destination_service.go
@@ -0,0 +1,49 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import (
+ "k8s.io/apimachinery/pkg/util/intstr"
+
+ shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
+ sharedApi "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
+)
+
+type ArangoRouteSpecDestinationService struct {
+ *sharedApi.Object `json:",inline,omitempty"`
+
+ // Port defines Port or Port Name used as destination
+ // +doc/type: intstr.IntOrString
+ // +doc/link: Documentation|https://kubernetes.io/docs/tasks/administer-cluster/sysctl-cluster/
+ Port *intstr.IntOrString `json:"port,omitempty"`
+}
+
+func (s *ArangoRouteSpecDestinationService) Validate() error {
+ if s == nil {
+ s = &ArangoRouteSpecDestinationService{}
+ }
+
+ if err := shared.WithErrors(s.Object.Validate()); err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/pkg/apis/networking/v1alpha1/route_spec_destination_tls.go b/pkg/apis/networking/v1alpha1/route_spec_destination_tls.go
new file mode 100644
index 000000000..e5fdb3449
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/route_spec_destination_tls.go
@@ -0,0 +1,30 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+type ArangoRouteSpecDestinationTLS struct {
+ // Insecure allows Insecure traffic
+ Insecure *bool `json:"insecure,omitempty"`
+}
+
+func (s *ArangoRouteSpecDestinationTLS) Validate() error {
+ return nil
+}
diff --git a/pkg/apis/networking/v1alpha1/route_spec_route.go b/pkg/apis/networking/v1alpha1/route_spec_route.go
new file mode 100644
index 000000000..018396094
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/route_spec_route.go
@@ -0,0 +1,52 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import (
+ shared "github.com/arangodb/kube-arangodb/pkg/apis/shared"
+)
+
+type ArangoRouteSpecRoute struct {
+ // Path specifies the Path route
+ Path *string `json:"path,omitempty"`
+}
+
+func (s *ArangoRouteSpecRoute) GetPath() string {
+ if s == nil && s.Path == nil {
+ return "/"
+ }
+
+ return *s.Path
+}
+
+func (s *ArangoRouteSpecRoute) Validate() error {
+ if s == nil {
+ s = &ArangoRouteSpecRoute{}
+ }
+
+ if err := shared.WithErrors(
+ shared.PrefixResourceError("path", shared.ValidateAPIPath(s.GetPath())),
+ ); err != nil {
+ return err
+ }
+
+ return nil
+}
diff --git a/pkg/apis/networking/v1alpha1/route_status.go b/pkg/apis/networking/v1alpha1/route_status.go
new file mode 100644
index 000000000..514db9e44
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/route_status.go
@@ -0,0 +1,29 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
+
+type ArangoRouteStatus struct {
+ // Conditions specific to the entire extension
+ // +doc/type: api.Conditions
+ Conditions api.ConditionList `json:"conditions,omitempty"`
+}
diff --git a/pkg/apis/networking/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/networking/v1alpha1/zz_generated.deepcopy.go
new file mode 100644
index 000000000..6b2e00ac8
--- /dev/null
+++ b/pkg/apis/networking/v1alpha1/zz_generated.deepcopy.go
@@ -0,0 +1,242 @@
+//go:build !ignore_autogenerated
+// +build !ignore_autogenerated
+
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by deepcopy-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ deploymentv1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1"
+ v1 "github.com/arangodb/kube-arangodb/pkg/apis/shared/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+ intstr "k8s.io/apimachinery/pkg/util/intstr"
+)
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ArangoRoute) DeepCopyInto(out *ArangoRoute) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
+ in.Spec.DeepCopyInto(&out.Spec)
+ in.Status.DeepCopyInto(&out.Status)
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoRoute.
+func (in *ArangoRoute) DeepCopy() *ArangoRoute {
+ if in == nil {
+ return nil
+ }
+ out := new(ArangoRoute)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ArangoRoute) 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 *ArangoRouteList) DeepCopyInto(out *ArangoRouteList) {
+ *out = *in
+ out.TypeMeta = in.TypeMeta
+ in.ListMeta.DeepCopyInto(&out.ListMeta)
+ if in.Items != nil {
+ in, out := &in.Items, &out.Items
+ *out = make([]ArangoRoute, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoRouteList.
+func (in *ArangoRouteList) DeepCopy() *ArangoRouteList {
+ if in == nil {
+ return nil
+ }
+ out := new(ArangoRouteList)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
+func (in *ArangoRouteList) 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 *ArangoRouteSpec) DeepCopyInto(out *ArangoRouteSpec) {
+ *out = *in
+ if in.Destination != nil {
+ in, out := &in.Destination, &out.Destination
+ *out = new(ArangoRouteSpecDestination)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.Route != nil {
+ in, out := &in.Route, &out.Route
+ *out = new(ArangoRouteSpecRoute)
+ (*in).DeepCopyInto(*out)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoRouteSpec.
+func (in *ArangoRouteSpec) DeepCopy() *ArangoRouteSpec {
+ if in == nil {
+ return nil
+ }
+ out := new(ArangoRouteSpec)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ArangoRouteSpecDestination) DeepCopyInto(out *ArangoRouteSpecDestination) {
+ *out = *in
+ if in.Service != nil {
+ in, out := &in.Service, &out.Service
+ *out = new(ArangoRouteSpecDestinationService)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.Schema != nil {
+ in, out := &in.Schema, &out.Schema
+ *out = new(ArangoRouteSpecDestinationSchema)
+ **out = **in
+ }
+ if in.TLS != nil {
+ in, out := &in.TLS, &out.TLS
+ *out = new(ArangoRouteSpecDestinationTLS)
+ (*in).DeepCopyInto(*out)
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoRouteSpecDestination.
+func (in *ArangoRouteSpecDestination) DeepCopy() *ArangoRouteSpecDestination {
+ if in == nil {
+ return nil
+ }
+ out := new(ArangoRouteSpecDestination)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ArangoRouteSpecDestinationService) DeepCopyInto(out *ArangoRouteSpecDestinationService) {
+ *out = *in
+ if in.Object != nil {
+ in, out := &in.Object, &out.Object
+ *out = new(v1.Object)
+ (*in).DeepCopyInto(*out)
+ }
+ if in.Port != nil {
+ in, out := &in.Port, &out.Port
+ *out = new(intstr.IntOrString)
+ **out = **in
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoRouteSpecDestinationService.
+func (in *ArangoRouteSpecDestinationService) DeepCopy() *ArangoRouteSpecDestinationService {
+ if in == nil {
+ return nil
+ }
+ out := new(ArangoRouteSpecDestinationService)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ArangoRouteSpecDestinationTLS) DeepCopyInto(out *ArangoRouteSpecDestinationTLS) {
+ *out = *in
+ if in.Insecure != nil {
+ in, out := &in.Insecure, &out.Insecure
+ *out = new(bool)
+ **out = **in
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoRouteSpecDestinationTLS.
+func (in *ArangoRouteSpecDestinationTLS) DeepCopy() *ArangoRouteSpecDestinationTLS {
+ if in == nil {
+ return nil
+ }
+ out := new(ArangoRouteSpecDestinationTLS)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ArangoRouteSpecRoute) DeepCopyInto(out *ArangoRouteSpecRoute) {
+ *out = *in
+ if in.Path != nil {
+ in, out := &in.Path, &out.Path
+ *out = new(string)
+ **out = **in
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoRouteSpecRoute.
+func (in *ArangoRouteSpecRoute) DeepCopy() *ArangoRouteSpecRoute {
+ if in == nil {
+ return nil
+ }
+ out := new(ArangoRouteSpecRoute)
+ in.DeepCopyInto(out)
+ return out
+}
+
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *ArangoRouteStatus) DeepCopyInto(out *ArangoRouteStatus) {
+ *out = *in
+ if in.Conditions != nil {
+ in, out := &in.Conditions, &out.Conditions
+ *out = make(deploymentv1.ConditionList, len(*in))
+ for i := range *in {
+ (*in)[i].DeepCopyInto(&(*out)[i])
+ }
+ }
+ return
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ArangoRouteStatus.
+func (in *ArangoRouteStatus) DeepCopy() *ArangoRouteStatus {
+ if in == nil {
+ return nil
+ }
+ out := new(ArangoRouteStatus)
+ in.DeepCopyInto(out)
+ return out
+}
diff --git a/pkg/apis/shared/validate.go b/pkg/apis/shared/validate.go
index 7d221de38..e415d4fff 100644
--- a/pkg/apis/shared/validate.go
+++ b/pkg/apis/shared/validate.go
@@ -33,12 +33,17 @@ import (
var (
resourceNameRE = regexp.MustCompile(`^([0-9\-\.a-z])+$`)
+ apiPathRE = regexp.MustCompile(`^/([A-Za-z0-9\-]+/)*$`)
)
const (
ServiceTypeNone core.ServiceType = "None"
)
+type ValidateInterface interface {
+ Validate() error
+}
+
// ValidateResourceName validates a kubernetes resource name.
// If not valid, an error is returned.
// See https://kubernetes.io/docs/concepts/overview/working-with-objects/names/
@@ -70,6 +75,19 @@ func ValidateUID(uid types.UID) error {
return err
}
+// ValidateAPIPath validates if it is valid API Path
+func ValidateAPIPath(path string) error {
+ if path == "" {
+ return nil
+ }
+
+ if apiPathRE.MatchString(path) {
+ return nil
+ }
+
+ return errors.WithStack(errors.Errorf("String '%s' is not a valid api path", path))
+}
+
// ValidatePullPolicy Validates core.PullPolicy
func ValidatePullPolicy(in core.PullPolicy) error {
switch in {
@@ -80,19 +98,19 @@ func ValidatePullPolicy(in core.PullPolicy) error {
return errors.Errorf("Unknown pull policy: '%s'", string(in))
}
-type ValidateInterface interface {
- Validate() error
-}
-
func Validate[T interface{}](in T) error {
- return validate(in)
+ res, _ := validate(in)
+ return res
}
-func validate(in any) error {
- if v, ok := in.(ValidateInterface); ok {
- return v.Validate()
+func validate(in any) (error, bool) {
+ if in == nil {
+ return nil, false
}
- return nil
+ if v, ok := in.(ValidateInterface); ok {
+ return v.Validate(), true
+ }
+ return nil, false
}
// ValidateOptional Validates object if is not nil
@@ -104,6 +122,17 @@ func ValidateOptional[T interface{}](in *T, validator func(T) error) error {
return nil
}
+// ValidateOptionalInterface Validates object if is not nil
+func ValidateOptionalInterface[T ValidateInterface](in T) error {
+ res, _ := validate(in)
+ return res
+}
+
+// ValidateOptionalInterfacePath Validates object if is not nil with path
+func ValidateOptionalInterfacePath[T ValidateInterface](path string, in T) error {
+ return PrefixResourceError(path, ValidateOptionalInterface(in))
+}
+
// ValidateRequired Validates object and required not nil value
func ValidateRequired[T interface{}](in *T, validator func(T) error) error {
if in != nil {
@@ -113,6 +142,20 @@ func ValidateRequired[T interface{}](in *T, validator func(T) error) error {
return errors.Errorf("should be not nil")
}
+// ValidateRequiredInterface Validates object if is not nil
+func ValidateRequiredInterface[T ValidateInterface](in T) error {
+ res, ok := validate(in)
+ if !ok {
+ return errors.Errorf("should be not nil")
+ }
+ return res
+}
+
+// ValidateRequiredInterfacePath Validates object if is not nil with path
+func ValidateRequiredInterfacePath[T ValidateInterface](path string, in T) error {
+ return PrefixResourceError(path, ValidateRequiredInterface(in))
+}
+
// ValidateList validates all elements on the list
func ValidateList[T interface{}](in []T, validator func(T) error) error {
errors := make([]error, len(in))
diff --git a/pkg/apis/shared/validate_test.go b/pkg/apis/shared/validate_test.go
index 06dad2c24..31b7f6787 100644
--- a/pkg/apis/shared/validate_test.go
+++ b/pkg/apis/shared/validate_test.go
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
-// Copyright 2023 ArangoDB GmbH, Cologne, Germany
+// Copyright 2023-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -31,3 +31,14 @@ func Test_ValidateUID(t *testing.T) {
require.Error(t, ValidateUID(""))
require.NoError(t, ValidateUID(uuid.NewUUID()))
}
+
+func Test_ValidateAPIPath(t *testing.T) {
+ require.NoError(t, ValidateAPIPath(""))
+ require.NoError(t, ValidateAPIPath("/"))
+ require.Error(t, ValidateAPIPath("//"))
+ require.Error(t, ValidateAPIPath("/api/zz"))
+ require.NoError(t, ValidateAPIPath("/api/"))
+ require.NoError(t, ValidateAPIPath("/api/test/qw/"))
+ require.NoError(t, ValidateAPIPath("/api/test/2/"))
+ require.Error(t, ValidateAPIPath("/&/"))
+}
diff --git a/pkg/crd/crds/crds.go b/pkg/crd/crds/crds.go
index 6afef097c..8158a8745 100644
--- a/pkg/crd/crds/crds.go
+++ b/pkg/crd/crds/crds.go
@@ -90,6 +90,9 @@ func AllDefinitions() []Definition {
// Analytics
AnalyticsGAEDefinitionWithOptions(),
+
+ // Networking
+ NetworkingRouteDefinitionWithOptions(),
}
}
diff --git a/pkg/crd/crds/crds_test.go b/pkg/crd/crds/crds_test.go
index 6f558f4eb..60368f107 100644
--- a/pkg/crd/crds/crds_test.go
+++ b/pkg/crd/crds/crds_test.go
@@ -144,6 +144,7 @@ func Test_CRDGetters(t *testing.T) {
StorageLocalStorageWithOptions,
SchedulerProfileWithOptions,
AnalyticsGAEWithOptions,
+ NetworkingRouteWithOptions,
}
require.Equal(t, len(AllDefinitions()), len(getters))
diff --git a/pkg/crd/crds/networking-route.go b/pkg/crd/crds/networking-route.go
new file mode 100644
index 000000000..fd570e313
--- /dev/null
+++ b/pkg/crd/crds/networking-route.go
@@ -0,0 +1,51 @@
+//
+// DISCLAIMER
+//
+// Copyright 2023-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package crds
+
+import (
+ _ "embed"
+
+ apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
+)
+
+func NetworkingRouteWithOptions(opts ...func(*CRDOptions)) *apiextensions.CustomResourceDefinition {
+ return getCRD(NetworkingRouteDefinitionData(), opts...)
+}
+
+func NetworkingRouteDefinitionWithOptions(opts ...func(*CRDOptions)) Definition {
+ return Definition{
+ DefinitionData: NetworkingRouteDefinitionData(),
+ CRD: NetworkingRouteWithOptions(opts...),
+ }
+}
+
+func NetworkingRouteDefinitionData() DefinitionData {
+ return DefinitionData{
+ definition: networkingRoute,
+ schemaDefinition: networkingRouteSchemaRaw,
+ }
+}
+
+//go:embed networking-route.yaml
+var networkingRoute []byte
+
+//go:embed networking-route.schema.generated.yaml
+var networkingRouteSchemaRaw []byte
diff --git a/pkg/crd/crds/networking-route.schema.generated.yaml b/pkg/crd/crds/networking-route.schema.generated.yaml
new file mode 100644
index 000000000..ee0df1501
--- /dev/null
+++ b/pkg/crd/crds/networking-route.schema.generated.yaml
@@ -0,0 +1,55 @@
+v1alpha1:
+ openAPIV3Schema:
+ properties:
+ spec:
+ properties:
+ deployment:
+ description: Deployment specifies the ArangoDeployment object name
+ type: string
+ destination:
+ description: Destination defines the route destination
+ properties:
+ schema:
+ description: Schema defines HTTP/S schema used for connection
+ type: string
+ service:
+ description: Service defines service upstream reference
+ properties:
+ checksum:
+ description: UID keeps the information about object Checksum
+ type: string
+ name:
+ description: Name of the object
+ type: string
+ namespace:
+ description: Namespace of the object. Should default to the namespace of the parent object
+ type: string
+ port:
+ description: Port defines Port or Port Name used as destination
+ type: string
+ x-kubernetes-int-or-string: true
+ uid:
+ description: UID keeps the information about object UID
+ type: string
+ type: object
+ tls:
+ description: TLS defines TLS Configuration
+ properties:
+ insecure:
+ description: Insecure allows Insecure traffic
+ type: boolean
+ type: object
+ type: object
+ route:
+ description: Route defines the route spec
+ properties:
+ path:
+ description: Path specifies the Path route
+ type: string
+ type: object
+ type: object
+ status:
+ description: Object with preserved fields for backward compatibility
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ type: object
diff --git a/pkg/crd/crds/networking-route.yaml b/pkg/crd/crds/networking-route.yaml
new file mode 100644
index 000000000..514c0763f
--- /dev/null
+++ b/pkg/crd/crds/networking-route.yaml
@@ -0,0 +1,22 @@
+apiVersion: apiextensions.k8s.io/v1
+kind: CustomResourceDefinition
+metadata:
+ name: arangoroutes.networking.arangodb.com
+spec:
+ group: networking.arangodb.com
+ names:
+ kind: ArangoRoute
+ listKind: ArangoRouteList
+ plural: arangoroutes
+ singular: arangoroute
+ scope: Namespaced
+ versions:
+ - name: v1alpha1
+ schema:
+ openAPIV3Schema:
+ type: object
+ x-kubernetes-preserve-unknown-fields: true
+ served: true
+ storage: true
+ subresources:
+ status: {}
diff --git a/pkg/crd/networking.go b/pkg/crd/networking.go
new file mode 100644
index 000000000..911892724
--- /dev/null
+++ b/pkg/crd/networking.go
@@ -0,0 +1,40 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package crd
+
+import (
+ "github.com/arangodb/kube-arangodb/pkg/crd/crds"
+)
+
+func init() {
+ defs := []func(...func(options *crds.CRDOptions)) crds.Definition{
+ crds.NetworkingRouteDefinitionWithOptions,
+ }
+ for _, getDef := range defs {
+ defFn := getDef // bring into scope
+ registerCRDWithPanic(func(opts *crds.CRDOptions) crds.Definition {
+ return defFn(opts.AsFunc())
+ }, &crds.CRDOptions{
+ WithSchema: true,
+ WithPreserve: false,
+ })
+ }
+}
diff --git a/pkg/deployment/resources/inspector/ar.go b/pkg/deployment/resources/inspector/ar.go
new file mode 100644
index 000000000..cdb37e4c5
--- /dev/null
+++ b/pkg/deployment/resources/inspector/ar.go
@@ -0,0 +1,192 @@
+//
+// DISCLAIMER
+//
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package inspector
+
+import (
+ "context"
+ "time"
+
+ meta "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ "github.com/arangodb/kube-arangodb/pkg/util/errors"
+ "github.com/arangodb/kube-arangodb/pkg/util/globals"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/definitions"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/throttle"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/version"
+)
+
+func init() {
+ requireRegisterInspectorLoader(arangoRoutesInspectorLoaderObj)
+}
+
+var arangoRoutesInspectorLoaderObj = arangoRoutesInspectorLoader{}
+
+type arangoRoutesInspectorLoader struct {
+}
+
+func (p arangoRoutesInspectorLoader) Component() definitions.Component {
+ return definitions.ArangoRoute
+}
+
+func (p arangoRoutesInspectorLoader) Load(ctx context.Context, i *inspectorState) {
+ var q arangoRoutesInspector
+ p.loadV1Alpha1(ctx, i, &q)
+ i.arangoRoutes = &q
+ q.state = i
+ q.last = time.Now()
+}
+
+func (p arangoRoutesInspectorLoader) loadV1Alpha1(ctx context.Context, i *inspectorState, q *arangoRoutesInspector) {
+ var z arangoRoutesInspectorV1Alpha1
+
+ z.arangoRouteInspector = q
+
+ z.arangoRoutes, z.err = p.getV1ArangoRoutes(ctx, i)
+
+ q.v1alpha1 = &z
+}
+
+func (p arangoRoutesInspectorLoader) getV1ArangoRoutes(ctx context.Context, i *inspectorState) (map[string]*networkingApi.ArangoRoute, error) {
+ objs, err := p.getV1ArangoRoutesList(ctx, i)
+ if err != nil {
+ return nil, err
+ }
+
+ r := make(map[string]*networkingApi.ArangoRoute, len(objs))
+
+ for id := range objs {
+ r[objs[id].GetName()] = objs[id]
+ }
+
+ return r, nil
+}
+
+func (p arangoRoutesInspectorLoader) getV1ArangoRoutesList(ctx context.Context, i *inspectorState) ([]*networkingApi.ArangoRoute, error) {
+ ctxChild, cancel := globals.GetGlobalTimeouts().Kubernetes().WithTimeout(ctx)
+ defer cancel()
+ obj, err := i.client.Arango().NetworkingV1alpha1().ArangoRoutes(i.namespace).List(ctxChild, meta.ListOptions{
+ Limit: globals.GetGlobals().Kubernetes().RequestBatchSize().Get(),
+ })
+
+ if err != nil {
+ return nil, err
+ }
+
+ items := obj.Items
+ cont := obj.Continue
+ var s = int64(len(items))
+
+ if z := obj.RemainingItemCount; z != nil {
+ s += *z
+ }
+
+ ptrs := make([]*networkingApi.ArangoRoute, 0, s)
+
+ for {
+ for id := range items {
+ ptrs = append(ptrs, &items[id])
+ }
+
+ if cont == "" {
+ break
+ }
+
+ items, cont, err = p.getV1ArangoRoutesListRequest(ctx, i, cont)
+
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ return ptrs, nil
+}
+
+func (p arangoRoutesInspectorLoader) getV1ArangoRoutesListRequest(ctx context.Context, i *inspectorState, cont string) ([]networkingApi.ArangoRoute, string, error) {
+ ctxChild, cancel := globals.GetGlobalTimeouts().Kubernetes().WithTimeout(ctx)
+ defer cancel()
+ obj, err := i.client.Arango().NetworkingV1alpha1().ArangoRoutes(i.namespace).List(ctxChild, meta.ListOptions{
+ Limit: globals.GetGlobals().Kubernetes().RequestBatchSize().Get(),
+ Continue: cont,
+ })
+
+ if err != nil {
+ return nil, "", err
+ }
+
+ return obj.Items, obj.Continue, err
+}
+
+func (p arangoRoutesInspectorLoader) Verify(i *inspectorState) error {
+ return nil
+}
+
+func (p arangoRoutesInspectorLoader) Copy(from, to *inspectorState, override bool) {
+ if to.arangoRoutes != nil {
+ if !override {
+ return
+ }
+ }
+
+ to.arangoRoutes = from.arangoRoutes
+ to.arangoRoutes.state = to
+}
+
+func (p arangoRoutesInspectorLoader) Name() string {
+ return "arangoRoutes"
+}
+
+type arangoRoutesInspector struct {
+ state *inspectorState
+
+ last time.Time
+
+ v1alpha1 *arangoRoutesInspectorV1Alpha1
+}
+
+func (p *arangoRoutesInspector) LastRefresh() time.Time {
+ return p.last
+}
+
+func (p *arangoRoutesInspector) Refresh(ctx context.Context) error {
+ p.Throttle(p.state.throttles).Invalidate()
+ return p.state.refresh(ctx, arangoRoutesInspectorLoaderObj)
+}
+
+func (p *arangoRoutesInspector) Version() version.Version {
+ return version.V1
+}
+
+func (p *arangoRoutesInspector) Throttle(c throttle.Components) throttle.Throttle {
+ return c.ArangoRoute()
+}
+
+func (p *arangoRoutesInspector) validate() error {
+ if p == nil {
+ return errors.Errorf("ArangoRouteInspector is nil")
+ }
+
+ if p.state == nil {
+ return errors.Errorf("Parent is nil")
+ }
+
+ return p.v1alpha1.validate()
+}
diff --git a/pkg/deployment/resources/inspector/ar_anonymous.go b/pkg/deployment/resources/inspector/ar_anonymous.go
new file mode 100644
index 000000000..501ebb1e1
--- /dev/null
+++ b/pkg/deployment/resources/inspector/ar_anonymous.go
@@ -0,0 +1,45 @@
+//
+// DISCLAIMER
+//
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package inspector
+
+import (
+ "k8s.io/apimachinery/pkg/runtime/schema"
+
+ networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/constants"
+)
+
+func (p *arangoRoutesInspector) Anonymous(gvk schema.GroupVersionKind) (anonymous.Interface, bool) {
+ g := constants.ArangoRouteGKv1()
+
+ if g.Kind == gvk.Kind && g.Group == gvk.Group {
+ switch gvk.Version {
+ case constants.ArangoRouteVersionV1Alpha1, DefaultVersion:
+ if p.v1alpha1 == nil || p.v1alpha1.err != nil {
+ return nil, false
+ }
+ return anonymous.NewAnonymous[*networkingApi.ArangoRoute](g, p.state.arangoRoutes.v1alpha1, p.state.ArangoRouteModInterface().V1Alpha1()), true
+ }
+ }
+
+ return nil, false
+}
diff --git a/pkg/deployment/resources/inspector/ar_gvk.go b/pkg/deployment/resources/inspector/ar_gvk.go
new file mode 100644
index 000000000..a1bb4caed
--- /dev/null
+++ b/pkg/deployment/resources/inspector/ar_gvk.go
@@ -0,0 +1,43 @@
+//
+// DISCLAIMER
+//
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package inspector
+
+import (
+ "k8s.io/apimachinery/pkg/runtime/schema"
+
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/constants"
+)
+
+func (p *arangoRoutesInspectorV1Alpha1) GroupVersionKind() schema.GroupVersionKind {
+ return constants.ArangoRouteGKv1()
+}
+
+func (p *arangoRoutesInspectorV1Alpha1) GroupVersionResource() schema.GroupVersionResource {
+ return constants.ArangoRouteGRv1()
+}
+
+func (p *arangoRoutesInspector) GroupKind() schema.GroupKind {
+ return constants.ArangoRouteGK()
+}
+
+func (p *arangoRoutesInspector) GroupResource() schema.GroupResource {
+ return constants.ArangoRouteGR()
+}
diff --git a/pkg/deployment/resources/inspector/ar_mod.go b/pkg/deployment/resources/inspector/ar_mod.go
new file mode 100644
index 000000000..eb9fd854f
--- /dev/null
+++ b/pkg/deployment/resources/inspector/ar_mod.go
@@ -0,0 +1,47 @@
+//
+// DISCLAIMER
+//
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package inspector
+
+import (
+ networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ arangoRoutev1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoroute/v1alpha1"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/definitions"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/generic"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/mods"
+)
+
+func (i *inspectorState) ArangoRouteModInterface() mods.ArangoRouteMods {
+ return arangoRouteMod{
+ i: i,
+ }
+}
+
+type arangoRouteMod struct {
+ i *inspectorState
+}
+
+func (p arangoRouteMod) V1Alpha1() arangoRoutev1.ModInterface {
+ return wrapMod[*networkingApi.ArangoRoute](definitions.ArangoRoute, p.i.GetThrottles, p.clientv1alpha1)
+}
+
+func (p arangoRouteMod) clientv1alpha1() generic.ModStatusClient[*networkingApi.ArangoRoute] {
+ return p.i.Client().Arango().NetworkingV1alpha1().ArangoRoutes(p.i.Namespace())
+}
diff --git a/pkg/deployment/resources/inspector/ar_v1alpha1.go b/pkg/deployment/resources/inspector/ar_v1alpha1.go
new file mode 100644
index 000000000..7d7c0d655
--- /dev/null
+++ b/pkg/deployment/resources/inspector/ar_v1alpha1.go
@@ -0,0 +1,138 @@
+//
+// DISCLAIMER
+//
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package inspector
+
+import (
+ "context"
+
+ apiErrors "k8s.io/apimachinery/pkg/api/errors"
+ meta "k8s.io/apimachinery/pkg/apis/meta/v1"
+
+ networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ "github.com/arangodb/kube-arangodb/pkg/util/errors"
+ ins "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoroute/v1alpha1"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/constants"
+)
+
+func (p *arangoRoutesInspector) V1Alpha1() (ins.Inspector, error) {
+ if p.v1alpha1.err != nil {
+ return nil, p.v1alpha1.err
+ }
+
+ return p.v1alpha1, nil
+}
+
+type arangoRoutesInspectorV1Alpha1 struct {
+ arangoRouteInspector *arangoRoutesInspector
+
+ arangoRoutes map[string]*networkingApi.ArangoRoute
+ err error
+}
+
+func (p *arangoRoutesInspectorV1Alpha1) Filter(filters ...ins.Filter) []*networkingApi.ArangoRoute {
+ z := p.ListSimple()
+
+ r := make([]*networkingApi.ArangoRoute, 0, len(z))
+
+ for _, o := range z {
+ if !ins.FilterObject(o, filters...) {
+ continue
+ }
+
+ r = append(r, o)
+ }
+
+ return r
+}
+
+func (p *arangoRoutesInspectorV1Alpha1) validate() error {
+ if p == nil {
+ return errors.Errorf("ArangoRoutesV1AlphaInspector is nil")
+ }
+
+ if p.arangoRouteInspector == nil {
+ return errors.Errorf("Parent is nil")
+ }
+
+ if p.arangoRoutes == nil && p.err == nil {
+ return errors.Errorf("ArangoRoutes or err should be not nil")
+ }
+
+ if p.arangoRoutes != nil && p.err != nil {
+ return errors.Errorf("ArangoRoutes or err cannot be not nil together")
+ }
+
+ return nil
+}
+
+func (p *arangoRoutesInspectorV1Alpha1) ListSimple() []*networkingApi.ArangoRoute {
+ var r []*networkingApi.ArangoRoute
+ for _, arangoRoute := range p.arangoRoutes {
+ r = append(r, arangoRoute)
+ }
+
+ return r
+}
+
+func (p *arangoRoutesInspectorV1Alpha1) GetSimple(name string) (*networkingApi.ArangoRoute, bool) {
+ arangoRoute, ok := p.arangoRoutes[name]
+ if !ok {
+ return nil, false
+ }
+
+ return arangoRoute, true
+}
+
+func (p *arangoRoutesInspectorV1Alpha1) Iterate(action ins.Action, filters ...ins.Filter) error {
+ for _, arangoRoute := range p.arangoRoutes {
+ if err := p.iterateArangoRoute(arangoRoute, action, filters...); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+func (p *arangoRoutesInspectorV1Alpha1) iterateArangoRoute(arangoRoute *networkingApi.ArangoRoute, action ins.Action, filters ...ins.Filter) error {
+ for _, f := range filters {
+ if f == nil {
+ continue
+ }
+
+ if !f(arangoRoute) {
+ return nil
+ }
+ }
+
+ return action(arangoRoute)
+}
+
+func (p *arangoRoutesInspectorV1Alpha1) Read() ins.ReadInterface {
+ return p
+}
+
+func (p *arangoRoutesInspectorV1Alpha1) Get(ctx context.Context, name string, opts meta.GetOptions) (*networkingApi.ArangoRoute, error) {
+ if s, ok := p.GetSimple(name); !ok {
+ return nil, apiErrors.NewNotFound(constants.ArangoRouteGR(), name)
+ } else {
+ return s, nil
+ }
+}
diff --git a/pkg/deployment/resources/inspector/inspector.go b/pkg/deployment/resources/inspector/inspector.go
index 55bcb6d0e..d28fae726 100644
--- a/pkg/deployment/resources/inspector/inspector.go
+++ b/pkg/deployment/resources/inspector/inspector.go
@@ -42,6 +42,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoclustersynchronization"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangomember"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoroute"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangotask"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/definitions"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/endpoints"
@@ -134,6 +135,7 @@ type inspectorState struct {
serviceMonitors *serviceMonitorsInspector
arangoMembers *arangoMembersInspector
arangoTasks *arangoTasksInspector
+ arangoRoutes *arangoRoutesInspector
arangoClusterSynchronizations *arangoClusterSynchronizationsInspector
endpoints *endpointsInspector
@@ -167,6 +169,10 @@ func (i *inspectorState) RegisterInformers(k8s informers.SharedInformerFactory,
arango.Database().V1().ArangoTasks().Informer().AddEventHandler(i.eventHandler(definitions.ArangoTask))
}
+ if _, err := i.ArangoRoute().V1Alpha1(); err == nil {
+ arango.Networking().V1alpha1().ArangoRoutes().Informer().AddEventHandler(i.eventHandler(definitions.ArangoRoute))
+ }
+
if _, err := i.ArangoClusterSynchronization().V1(); err == nil {
arango.Database().V1().ArangoClusterSynchronizations().Informer().AddEventHandler(i.eventHandler(definitions.ArangoClusterSynchronization))
}
@@ -225,6 +231,7 @@ func (i *inspectorState) AnonymousObjects() []anonymous.Impl {
i.serviceMonitors,
i.arangoMembers,
i.arangoTasks,
+ i.arangoRoutes,
i.arangoClusterSynchronizations,
i.endpoints,
}
@@ -317,6 +324,10 @@ func (i *inspectorState) ArangoTask() arangotask.Definition {
return i.arangoTasks
}
+func (i *inspectorState) ArangoRoute() arangoroute.Definition {
+ return i.arangoRoutes
+}
+
func (i *inspectorState) Refresh(ctx context.Context) error {
return i.refresh(ctx, inspectorLoadersList...)
}
@@ -464,6 +475,10 @@ func (i *inspectorState) validate() error {
return err
}
+ if err := i.arangoRoutes.validate(); err != nil {
+ return err
+ }
+
if err := i.arangoTasks.validate(); err != nil {
return err
}
@@ -495,6 +510,7 @@ func (i *inspectorState) copyCore() *inspectorState {
serviceMonitors: i.serviceMonitors,
arangoMembers: i.arangoMembers,
arangoTasks: i.arangoTasks,
+ arangoRoutes: i.arangoRoutes,
arangoClusterSynchronizations: i.arangoClusterSynchronizations,
throttles: i.throttles.Copy(),
versionInfo: i.versionInfo,
diff --git a/pkg/deployment/resources/inspector/inspector_test.go b/pkg/deployment/resources/inspector/inspector_test.go
index c856fcd0c..848a92189 100644
--- a/pkg/deployment/resources/inspector/inspector_test.go
+++ b/pkg/deployment/resources/inspector/inspector_test.go
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
-// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -142,7 +142,7 @@ func getAllTypes() []string {
func Test_Inspector_RefreshMatrix(t *testing.T) {
c := kclient.NewFakeClient()
- tc := throttle.NewThrottleComponents(time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour)
+ tc := throttle.NewThrottleComponents(time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour)
i := NewInspector(tc, c, "test", "test")
@@ -302,7 +302,7 @@ func Test_Inspector_Load(t *testing.T) {
func Test_Inspector_Invalidate(t *testing.T) {
c := kclient.NewFakeClient()
- tc := throttle.NewThrottleComponents(time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour)
+ tc := throttle.NewThrottleComponents(time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour)
i := NewInspector(tc, c, "test", "test")
diff --git a/pkg/deployment/resources/inspector/pdbs_version_test.go b/pkg/deployment/resources/inspector/pdbs_version_test.go
index 1ab15bbb3..cea38d963 100644
--- a/pkg/deployment/resources/inspector/pdbs_version_test.go
+++ b/pkg/deployment/resources/inspector/pdbs_version_test.go
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
-// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -52,7 +52,7 @@ func Test_PDB_Versions(t *testing.T) {
GitVersion: v,
})
- tc := throttle.NewThrottleComponents(time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour)
+ tc := throttle.NewThrottleComponents(time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour, time.Hour)
i := NewInspector(tc, c, "test", "test")
require.NoError(t, i.Refresh(context.Background()))
diff --git a/pkg/deployment/resources/inspector/throttles.go b/pkg/deployment/resources/inspector/throttles.go
index 15345ca03..39cf020b1 100644
--- a/pkg/deployment/resources/inspector/throttles.go
+++ b/pkg/deployment/resources/inspector/throttles.go
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
-// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -31,6 +31,7 @@ func NewDefaultThrottle() throttle.Components {
30*time.Second, // ArangoDeploymentSynchronization
30*time.Second, // ArangoMember
30*time.Second, // ArangoTask
+ 30*time.Second, // ArangoRoute
30*time.Second, // Node
30*time.Second, // PV
15*time.Second, // PVC
diff --git a/pkg/generated/clientset/versioned/clientset.go b/pkg/generated/clientset/versioned/clientset.go
index d2f139f70..a4de07d21 100644
--- a/pkg/generated/clientset/versioned/clientset.go
+++ b/pkg/generated/clientset/versioned/clientset.go
@@ -33,6 +33,7 @@ import (
databasev2alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/deployment/v2alpha1"
mlv1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/ml/v1alpha1"
mlv1beta1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/ml/v1beta1"
+ networkingv1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/networking/v1alpha1"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/replication/v1"
replicationv2alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/replication/v2alpha1"
schedulerv1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/scheduler/v1alpha1"
@@ -52,6 +53,7 @@ type Interface interface {
DatabaseV2alpha1() databasev2alpha1.DatabaseV2alpha1Interface
MlV1alpha1() mlv1alpha1.MlV1alpha1Interface
MlV1beta1() mlv1beta1.MlV1beta1Interface
+ NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface
ReplicationV1() replicationv1.ReplicationV1Interface
ReplicationV2alpha1() replicationv2alpha1.ReplicationV2alpha1Interface
SchedulerV1alpha1() schedulerv1alpha1.SchedulerV1alpha1Interface
@@ -69,6 +71,7 @@ type Clientset struct {
databaseV2alpha1 *databasev2alpha1.DatabaseV2alpha1Client
mlV1alpha1 *mlv1alpha1.MlV1alpha1Client
mlV1beta1 *mlv1beta1.MlV1beta1Client
+ networkingV1alpha1 *networkingv1alpha1.NetworkingV1alpha1Client
replicationV1 *replicationv1.ReplicationV1Client
replicationV2alpha1 *replicationv2alpha1.ReplicationV2alpha1Client
schedulerV1alpha1 *schedulerv1alpha1.SchedulerV1alpha1Client
@@ -111,6 +114,11 @@ func (c *Clientset) MlV1beta1() mlv1beta1.MlV1beta1Interface {
return c.mlV1beta1
}
+// NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client
+func (c *Clientset) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface {
+ return c.networkingV1alpha1
+}
+
// ReplicationV1 retrieves the ReplicationV1Client
func (c *Clientset) ReplicationV1() replicationv1.ReplicationV1Interface {
return c.replicationV1
@@ -208,6 +216,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset,
if err != nil {
return nil, err
}
+ cs.networkingV1alpha1, err = networkingv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient)
+ if err != nil {
+ return nil, err
+ }
cs.replicationV1, err = replicationv1.NewForConfigAndClient(&configShallowCopy, httpClient)
if err != nil {
return nil, err
@@ -256,6 +268,7 @@ func New(c rest.Interface) *Clientset {
cs.databaseV2alpha1 = databasev2alpha1.New(c)
cs.mlV1alpha1 = mlv1alpha1.New(c)
cs.mlV1beta1 = mlv1beta1.New(c)
+ cs.networkingV1alpha1 = networkingv1alpha1.New(c)
cs.replicationV1 = replicationv1.New(c)
cs.replicationV2alpha1 = replicationv2alpha1.New(c)
cs.schedulerV1alpha1 = schedulerv1alpha1.New(c)
diff --git a/pkg/generated/clientset/versioned/fake/clientset_generated.go b/pkg/generated/clientset/versioned/fake/clientset_generated.go
index 499793aa7..661164523 100644
--- a/pkg/generated/clientset/versioned/fake/clientset_generated.go
+++ b/pkg/generated/clientset/versioned/fake/clientset_generated.go
@@ -38,6 +38,8 @@ import (
fakemlv1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/ml/v1alpha1/fake"
mlv1beta1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/ml/v1beta1"
fakemlv1beta1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/ml/v1beta1/fake"
+ networkingv1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/networking/v1alpha1"
+ fakenetworkingv1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/replication/v1"
fakereplicationv1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/replication/v1/fake"
replicationv2alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/replication/v2alpha1"
@@ -140,6 +142,11 @@ func (c *Clientset) MlV1beta1() mlv1beta1.MlV1beta1Interface {
return &fakemlv1beta1.FakeMlV1beta1{Fake: &c.Fake}
}
+// NetworkingV1alpha1 retrieves the NetworkingV1alpha1Client
+func (c *Clientset) NetworkingV1alpha1() networkingv1alpha1.NetworkingV1alpha1Interface {
+ return &fakenetworkingv1alpha1.FakeNetworkingV1alpha1{Fake: &c.Fake}
+}
+
// ReplicationV1 retrieves the ReplicationV1Client
func (c *Clientset) ReplicationV1() replicationv1.ReplicationV1Interface {
return &fakereplicationv1.FakeReplicationV1{Fake: &c.Fake}
diff --git a/pkg/generated/clientset/versioned/fake/register.go b/pkg/generated/clientset/versioned/fake/register.go
index 2f65785ee..1804338cb 100644
--- a/pkg/generated/clientset/versioned/fake/register.go
+++ b/pkg/generated/clientset/versioned/fake/register.go
@@ -30,6 +30,7 @@ import (
databasev2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
mlv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
mlv1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1beta1"
+ networkingv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
replicationv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v2alpha1"
schedulerv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
@@ -53,6 +54,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
databasev2alpha1.AddToScheme,
mlv1alpha1.AddToScheme,
mlv1beta1.AddToScheme,
+ networkingv1alpha1.AddToScheme,
replicationv1.AddToScheme,
replicationv2alpha1.AddToScheme,
schedulerv1alpha1.AddToScheme,
diff --git a/pkg/generated/clientset/versioned/scheme/register.go b/pkg/generated/clientset/versioned/scheme/register.go
index cdaeb9465..3e5ad3944 100644
--- a/pkg/generated/clientset/versioned/scheme/register.go
+++ b/pkg/generated/clientset/versioned/scheme/register.go
@@ -30,6 +30,7 @@ import (
databasev2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
mlv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
mlv1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1beta1"
+ networkingv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
replicationv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v2alpha1"
schedulerv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
@@ -53,6 +54,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
databasev2alpha1.AddToScheme,
mlv1alpha1.AddToScheme,
mlv1beta1.AddToScheme,
+ networkingv1alpha1.AddToScheme,
replicationv1.AddToScheme,
replicationv2alpha1.AddToScheme,
schedulerv1alpha1.AddToScheme,
diff --git a/pkg/generated/clientset/versioned/typed/networking/v1alpha1/arangoroute.go b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/arangoroute.go
new file mode 100644
index 000000000..7713adf9a
--- /dev/null
+++ b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/arangoroute.go
@@ -0,0 +1,199 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ "context"
+ "time"
+
+ v1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ scheme "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/scheme"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ rest "k8s.io/client-go/rest"
+)
+
+// ArangoRoutesGetter has a method to return a ArangoRouteInterface.
+// A group's client should implement this interface.
+type ArangoRoutesGetter interface {
+ ArangoRoutes(namespace string) ArangoRouteInterface
+}
+
+// ArangoRouteInterface has methods to work with ArangoRoute resources.
+type ArangoRouteInterface interface {
+ Create(ctx context.Context, arangoRoute *v1alpha1.ArangoRoute, opts v1.CreateOptions) (*v1alpha1.ArangoRoute, error)
+ Update(ctx context.Context, arangoRoute *v1alpha1.ArangoRoute, opts v1.UpdateOptions) (*v1alpha1.ArangoRoute, error)
+ UpdateStatus(ctx context.Context, arangoRoute *v1alpha1.ArangoRoute, opts v1.UpdateOptions) (*v1alpha1.ArangoRoute, error)
+ Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
+ DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
+ Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.ArangoRoute, error)
+ List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.ArangoRouteList, error)
+ Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
+ Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ArangoRoute, err error)
+ ArangoRouteExpansion
+}
+
+// arangoRoutes implements ArangoRouteInterface
+type arangoRoutes struct {
+ client rest.Interface
+ ns string
+}
+
+// newArangoRoutes returns a ArangoRoutes
+func newArangoRoutes(c *NetworkingV1alpha1Client, namespace string) *arangoRoutes {
+ return &arangoRoutes{
+ client: c.RESTClient(),
+ ns: namespace,
+ }
+}
+
+// Get takes name of the arangoRoute, and returns the corresponding arangoRoute object, and an error if there is any.
+func (c *arangoRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ArangoRoute, err error) {
+ result = &v1alpha1.ArangoRoute{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("arangoroutes").
+ Name(name).
+ VersionedParams(&options, scheme.ParameterCodec).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// List takes label and field selectors, and returns the list of ArangoRoutes that match those selectors.
+func (c *arangoRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ArangoRouteList, err error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ result = &v1alpha1.ArangoRouteList{}
+ err = c.client.Get().
+ Namespace(c.ns).
+ Resource("arangoroutes").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Watch returns a watch.Interface that watches the requested arangoRoutes.
+func (c *arangoRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ var timeout time.Duration
+ if opts.TimeoutSeconds != nil {
+ timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
+ }
+ opts.Watch = true
+ return c.client.Get().
+ Namespace(c.ns).
+ Resource("arangoroutes").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Watch(ctx)
+}
+
+// Create takes the representation of a arangoRoute and creates it. Returns the server's representation of the arangoRoute, and an error, if there is any.
+func (c *arangoRoutes) Create(ctx context.Context, arangoRoute *v1alpha1.ArangoRoute, opts v1.CreateOptions) (result *v1alpha1.ArangoRoute, err error) {
+ result = &v1alpha1.ArangoRoute{}
+ err = c.client.Post().
+ Namespace(c.ns).
+ Resource("arangoroutes").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(arangoRoute).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Update takes the representation of a arangoRoute and updates it. Returns the server's representation of the arangoRoute, and an error, if there is any.
+func (c *arangoRoutes) Update(ctx context.Context, arangoRoute *v1alpha1.ArangoRoute, opts v1.UpdateOptions) (result *v1alpha1.ArangoRoute, err error) {
+ result = &v1alpha1.ArangoRoute{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("arangoroutes").
+ Name(arangoRoute.Name).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(arangoRoute).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *arangoRoutes) UpdateStatus(ctx context.Context, arangoRoute *v1alpha1.ArangoRoute, opts v1.UpdateOptions) (result *v1alpha1.ArangoRoute, err error) {
+ result = &v1alpha1.ArangoRoute{}
+ err = c.client.Put().
+ Namespace(c.ns).
+ Resource("arangoroutes").
+ Name(arangoRoute.Name).
+ SubResource("status").
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(arangoRoute).
+ Do(ctx).
+ Into(result)
+ return
+}
+
+// Delete takes name of the arangoRoute and deletes it. Returns an error if one occurs.
+func (c *arangoRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("arangoroutes").
+ Name(name).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *arangoRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ var timeout time.Duration
+ if listOpts.TimeoutSeconds != nil {
+ timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
+ }
+ return c.client.Delete().
+ Namespace(c.ns).
+ Resource("arangoroutes").
+ VersionedParams(&listOpts, scheme.ParameterCodec).
+ Timeout(timeout).
+ Body(&opts).
+ Do(ctx).
+ Error()
+}
+
+// Patch applies the patch and returns the patched arangoRoute.
+func (c *arangoRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ArangoRoute, err error) {
+ result = &v1alpha1.ArangoRoute{}
+ err = c.client.Patch(pt).
+ Namespace(c.ns).
+ Resource("arangoroutes").
+ Name(name).
+ SubResource(subresources...).
+ VersionedParams(&opts, scheme.ParameterCodec).
+ Body(data).
+ Do(ctx).
+ Into(result)
+ return
+}
diff --git a/pkg/generated/clientset/versioned/typed/networking/v1alpha1/doc.go b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/doc.go
new file mode 100644
index 000000000..f45dab6c5
--- /dev/null
+++ b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/doc.go
@@ -0,0 +1,24 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// This package has the automatically generated typed clients.
+package v1alpha1
diff --git a/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake/doc.go b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake/doc.go
new file mode 100644
index 000000000..cc487d814
--- /dev/null
+++ b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake/doc.go
@@ -0,0 +1,24 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by client-gen. DO NOT EDIT.
+
+// Package fake has the automatically generated clients.
+package fake
diff --git a/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_arangoroute.go b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_arangoroute.go
new file mode 100644
index 000000000..021a9d6f7
--- /dev/null
+++ b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_arangoroute.go
@@ -0,0 +1,145 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ "context"
+
+ v1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ labels "k8s.io/apimachinery/pkg/labels"
+ types "k8s.io/apimachinery/pkg/types"
+ watch "k8s.io/apimachinery/pkg/watch"
+ testing "k8s.io/client-go/testing"
+)
+
+// FakeArangoRoutes implements ArangoRouteInterface
+type FakeArangoRoutes struct {
+ Fake *FakeNetworkingV1alpha1
+ ns string
+}
+
+var arangoroutesResource = v1alpha1.SchemeGroupVersion.WithResource("arangoroutes")
+
+var arangoroutesKind = v1alpha1.SchemeGroupVersion.WithKind("ArangoRoute")
+
+// Get takes name of the arangoRoute, and returns the corresponding arangoRoute object, and an error if there is any.
+func (c *FakeArangoRoutes) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.ArangoRoute, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewGetAction(arangoroutesResource, c.ns, name), &v1alpha1.ArangoRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ArangoRoute), err
+}
+
+// List takes label and field selectors, and returns the list of ArangoRoutes that match those selectors.
+func (c *FakeArangoRoutes) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.ArangoRouteList, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewListAction(arangoroutesResource, arangoroutesKind, c.ns, opts), &v1alpha1.ArangoRouteList{})
+
+ if obj == nil {
+ return nil, err
+ }
+
+ label, _, _ := testing.ExtractFromListOptions(opts)
+ if label == nil {
+ label = labels.Everything()
+ }
+ list := &v1alpha1.ArangoRouteList{ListMeta: obj.(*v1alpha1.ArangoRouteList).ListMeta}
+ for _, item := range obj.(*v1alpha1.ArangoRouteList).Items {
+ if label.Matches(labels.Set(item.Labels)) {
+ list.Items = append(list.Items, item)
+ }
+ }
+ return list, err
+}
+
+// Watch returns a watch.Interface that watches the requested arangoRoutes.
+func (c *FakeArangoRoutes) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
+ return c.Fake.
+ InvokesWatch(testing.NewWatchAction(arangoroutesResource, c.ns, opts))
+
+}
+
+// Create takes the representation of a arangoRoute and creates it. Returns the server's representation of the arangoRoute, and an error, if there is any.
+func (c *FakeArangoRoutes) Create(ctx context.Context, arangoRoute *v1alpha1.ArangoRoute, opts v1.CreateOptions) (result *v1alpha1.ArangoRoute, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewCreateAction(arangoroutesResource, c.ns, arangoRoute), &v1alpha1.ArangoRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ArangoRoute), err
+}
+
+// Update takes the representation of a arangoRoute and updates it. Returns the server's representation of the arangoRoute, and an error, if there is any.
+func (c *FakeArangoRoutes) Update(ctx context.Context, arangoRoute *v1alpha1.ArangoRoute, opts v1.UpdateOptions) (result *v1alpha1.ArangoRoute, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateAction(arangoroutesResource, c.ns, arangoRoute), &v1alpha1.ArangoRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ArangoRoute), err
+}
+
+// UpdateStatus was generated because the type contains a Status member.
+// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
+func (c *FakeArangoRoutes) UpdateStatus(ctx context.Context, arangoRoute *v1alpha1.ArangoRoute, opts v1.UpdateOptions) (*v1alpha1.ArangoRoute, error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewUpdateSubresourceAction(arangoroutesResource, "status", c.ns, arangoRoute), &v1alpha1.ArangoRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ArangoRoute), err
+}
+
+// Delete takes name of the arangoRoute and deletes it. Returns an error if one occurs.
+func (c *FakeArangoRoutes) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
+ _, err := c.Fake.
+ Invokes(testing.NewDeleteActionWithOptions(arangoroutesResource, c.ns, name, opts), &v1alpha1.ArangoRoute{})
+
+ return err
+}
+
+// DeleteCollection deletes a collection of objects.
+func (c *FakeArangoRoutes) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
+ action := testing.NewDeleteCollectionAction(arangoroutesResource, c.ns, listOpts)
+
+ _, err := c.Fake.Invokes(action, &v1alpha1.ArangoRouteList{})
+ return err
+}
+
+// Patch applies the patch and returns the patched arangoRoute.
+func (c *FakeArangoRoutes) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.ArangoRoute, err error) {
+ obj, err := c.Fake.
+ Invokes(testing.NewPatchSubresourceAction(arangoroutesResource, c.ns, name, pt, data, subresources...), &v1alpha1.ArangoRoute{})
+
+ if obj == nil {
+ return nil, err
+ }
+ return obj.(*v1alpha1.ArangoRoute), err
+}
diff --git a/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_networking_client.go b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_networking_client.go
new file mode 100644
index 000000000..1e1794418
--- /dev/null
+++ b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/fake/fake_networking_client.go
@@ -0,0 +1,44 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package fake
+
+import (
+ v1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/typed/networking/v1alpha1"
+ rest "k8s.io/client-go/rest"
+ testing "k8s.io/client-go/testing"
+)
+
+type FakeNetworkingV1alpha1 struct {
+ *testing.Fake
+}
+
+func (c *FakeNetworkingV1alpha1) ArangoRoutes(namespace string) v1alpha1.ArangoRouteInterface {
+ return &FakeArangoRoutes{c, namespace}
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *FakeNetworkingV1alpha1) RESTClient() rest.Interface {
+ var ret *rest.RESTClient
+ return ret
+}
diff --git a/pkg/generated/clientset/versioned/typed/networking/v1alpha1/generated_expansion.go b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/generated_expansion.go
new file mode 100644
index 000000000..52d86c425
--- /dev/null
+++ b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/generated_expansion.go
@@ -0,0 +1,25 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package v1alpha1
+
+type ArangoRouteExpansion interface{}
diff --git a/pkg/generated/clientset/versioned/typed/networking/v1alpha1/networking_client.go b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/networking_client.go
new file mode 100644
index 000000000..b8a690bff
--- /dev/null
+++ b/pkg/generated/clientset/versioned/typed/networking/v1alpha1/networking_client.go
@@ -0,0 +1,111 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by client-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ "net/http"
+
+ v1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned/scheme"
+ rest "k8s.io/client-go/rest"
+)
+
+type NetworkingV1alpha1Interface interface {
+ RESTClient() rest.Interface
+ ArangoRoutesGetter
+}
+
+// NetworkingV1alpha1Client is used to interact with features provided by the networking.arangodb.com group.
+type NetworkingV1alpha1Client struct {
+ restClient rest.Interface
+}
+
+func (c *NetworkingV1alpha1Client) ArangoRoutes(namespace string) ArangoRouteInterface {
+ return newArangoRoutes(c, namespace)
+}
+
+// NewForConfig creates a new NetworkingV1alpha1Client for the given config.
+// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
+// where httpClient was generated with rest.HTTPClientFor(c).
+func NewForConfig(c *rest.Config) (*NetworkingV1alpha1Client, error) {
+ config := *c
+ if err := setConfigDefaults(&config); err != nil {
+ return nil, err
+ }
+ httpClient, err := rest.HTTPClientFor(&config)
+ if err != nil {
+ return nil, err
+ }
+ return NewForConfigAndClient(&config, httpClient)
+}
+
+// NewForConfigAndClient creates a new NetworkingV1alpha1Client for the given config and http client.
+// Note the http client provided takes precedence over the configured transport values.
+func NewForConfigAndClient(c *rest.Config, h *http.Client) (*NetworkingV1alpha1Client, error) {
+ config := *c
+ if err := setConfigDefaults(&config); err != nil {
+ return nil, err
+ }
+ client, err := rest.RESTClientForConfigAndClient(&config, h)
+ if err != nil {
+ return nil, err
+ }
+ return &NetworkingV1alpha1Client{client}, nil
+}
+
+// NewForConfigOrDie creates a new NetworkingV1alpha1Client for the given config and
+// panics if there is an error in the config.
+func NewForConfigOrDie(c *rest.Config) *NetworkingV1alpha1Client {
+ client, err := NewForConfig(c)
+ if err != nil {
+ panic(err)
+ }
+ return client
+}
+
+// New creates a new NetworkingV1alpha1Client for the given RESTClient.
+func New(c rest.Interface) *NetworkingV1alpha1Client {
+ return &NetworkingV1alpha1Client{c}
+}
+
+func setConfigDefaults(config *rest.Config) error {
+ gv := v1alpha1.SchemeGroupVersion
+ config.GroupVersion = &gv
+ config.APIPath = "/apis"
+ config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
+
+ if config.UserAgent == "" {
+ config.UserAgent = rest.DefaultKubernetesUserAgent()
+ }
+
+ return nil
+}
+
+// RESTClient returns a RESTClient that is used to communicate
+// with API server by this client implementation.
+func (c *NetworkingV1alpha1Client) RESTClient() rest.Interface {
+ if c == nil {
+ return nil
+ }
+ return c.restClient
+}
diff --git a/pkg/generated/informers/externalversions/factory.go b/pkg/generated/informers/externalversions/factory.go
index 484ba4ea1..180f55ea6 100644
--- a/pkg/generated/informers/externalversions/factory.go
+++ b/pkg/generated/informers/externalversions/factory.go
@@ -34,6 +34,7 @@ import (
deployment "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/deployment"
internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
ml "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/ml"
+ networking "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/networking"
replication "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/replication"
scheduler "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/scheduler"
storage "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/storage"
@@ -269,6 +270,7 @@ type SharedInformerFactory interface {
Backup() backup.Interface
Database() deployment.Interface
Ml() ml.Interface
+ Networking() networking.Interface
Replication() replication.Interface
Scheduler() scheduler.Interface
Storage() storage.Interface
@@ -294,6 +296,10 @@ func (f *sharedInformerFactory) Ml() ml.Interface {
return ml.New(f, f.namespace, f.tweakListOptions)
}
+func (f *sharedInformerFactory) Networking() networking.Interface {
+ return networking.New(f, f.namespace, f.tweakListOptions)
+}
+
func (f *sharedInformerFactory) Replication() replication.Interface {
return replication.New(f, f.namespace, f.tweakListOptions)
}
diff --git a/pkg/generated/informers/externalversions/generic.go b/pkg/generated/informers/externalversions/generic.go
index 108f70a45..00f3e40c3 100644
--- a/pkg/generated/informers/externalversions/generic.go
+++ b/pkg/generated/informers/externalversions/generic.go
@@ -32,6 +32,7 @@ import (
v2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v2alpha1"
mlv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1alpha1"
v1beta1 "github.com/arangodb/kube-arangodb/pkg/apis/ml/v1beta1"
+ networkingv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
replicationv1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v1"
replicationv2alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/replication/v2alpha1"
schedulerv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/scheduler/v1alpha1"
@@ -117,6 +118,10 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case v1beta1.SchemeGroupVersion.WithResource("arangomlstorages"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Ml().V1beta1().ArangoMLStorages().Informer()}, nil
+ // Group=networking.arangodb.com, Version=v1alpha1
+ case networkingv1alpha1.SchemeGroupVersion.WithResource("arangoroutes"):
+ return &genericInformer{resource: resource.GroupResource(), informer: f.Networking().V1alpha1().ArangoRoutes().Informer()}, nil
+
// Group=replication.database.arangodb.com, Version=v1
case replicationv1.SchemeGroupVersion.WithResource("arangodeploymentreplications"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Replication().V1().ArangoDeploymentReplications().Informer()}, nil
diff --git a/pkg/generated/informers/externalversions/networking/interface.go b/pkg/generated/informers/externalversions/networking/interface.go
new file mode 100644
index 000000000..2013452d9
--- /dev/null
+++ b/pkg/generated/informers/externalversions/networking/interface.go
@@ -0,0 +1,50 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by informer-gen. DO NOT EDIT.
+
+package networking
+
+import (
+ internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
+ v1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/networking/v1alpha1"
+)
+
+// Interface provides access to each of this group's versions.
+type Interface interface {
+ // V1alpha1 provides access to shared informers for resources in V1alpha1.
+ V1alpha1() v1alpha1.Interface
+}
+
+type group struct {
+ factory internalinterfaces.SharedInformerFactory
+ namespace string
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+}
+
+// New returns a new Interface.
+func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
+ return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
+}
+
+// V1alpha1 returns a new v1alpha1.Interface.
+func (g *group) V1alpha1() v1alpha1.Interface {
+ return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
+}
diff --git a/pkg/generated/informers/externalversions/networking/v1alpha1/arangoroute.go b/pkg/generated/informers/externalversions/networking/v1alpha1/arangoroute.go
new file mode 100644
index 000000000..6544ecae6
--- /dev/null
+++ b/pkg/generated/informers/externalversions/networking/v1alpha1/arangoroute.go
@@ -0,0 +1,94 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by informer-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ "context"
+ time "time"
+
+ networkingv1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ versioned "github.com/arangodb/kube-arangodb/pkg/generated/clientset/versioned"
+ internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
+ v1alpha1 "github.com/arangodb/kube-arangodb/pkg/generated/listers/networking/v1alpha1"
+ v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+ runtime "k8s.io/apimachinery/pkg/runtime"
+ watch "k8s.io/apimachinery/pkg/watch"
+ cache "k8s.io/client-go/tools/cache"
+)
+
+// ArangoRouteInformer provides access to a shared informer and lister for
+// ArangoRoutes.
+type ArangoRouteInformer interface {
+ Informer() cache.SharedIndexInformer
+ Lister() v1alpha1.ArangoRouteLister
+}
+
+type arangoRouteInformer struct {
+ factory internalinterfaces.SharedInformerFactory
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+ namespace string
+}
+
+// NewArangoRouteInformer constructs a new informer for ArangoRoute type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewArangoRouteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
+ return NewFilteredArangoRouteInformer(client, namespace, resyncPeriod, indexers, nil)
+}
+
+// NewFilteredArangoRouteInformer constructs a new informer for ArangoRoute type.
+// Always prefer using an informer factory to get a shared informer instead of getting an independent
+// one. This reduces memory footprint and number of connections to the server.
+func NewFilteredArangoRouteInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
+ return cache.NewSharedIndexInformer(
+ &cache.ListWatch{
+ ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.NetworkingV1alpha1().ArangoRoutes(namespace).List(context.TODO(), options)
+ },
+ WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
+ if tweakListOptions != nil {
+ tweakListOptions(&options)
+ }
+ return client.NetworkingV1alpha1().ArangoRoutes(namespace).Watch(context.TODO(), options)
+ },
+ },
+ &networkingv1alpha1.ArangoRoute{},
+ resyncPeriod,
+ indexers,
+ )
+}
+
+func (f *arangoRouteInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
+ return NewFilteredArangoRouteInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
+}
+
+func (f *arangoRouteInformer) Informer() cache.SharedIndexInformer {
+ return f.factory.InformerFor(&networkingv1alpha1.ArangoRoute{}, f.defaultInformer)
+}
+
+func (f *arangoRouteInformer) Lister() v1alpha1.ArangoRouteLister {
+ return v1alpha1.NewArangoRouteLister(f.Informer().GetIndexer())
+}
diff --git a/pkg/generated/informers/externalversions/networking/v1alpha1/interface.go b/pkg/generated/informers/externalversions/networking/v1alpha1/interface.go
new file mode 100644
index 000000000..316876c87
--- /dev/null
+++ b/pkg/generated/informers/externalversions/networking/v1alpha1/interface.go
@@ -0,0 +1,49 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by informer-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ internalinterfaces "github.com/arangodb/kube-arangodb/pkg/generated/informers/externalversions/internalinterfaces"
+)
+
+// Interface provides access to all the informers in this group version.
+type Interface interface {
+ // ArangoRoutes returns a ArangoRouteInformer.
+ ArangoRoutes() ArangoRouteInformer
+}
+
+type version struct {
+ factory internalinterfaces.SharedInformerFactory
+ namespace string
+ tweakListOptions internalinterfaces.TweakListOptionsFunc
+}
+
+// New returns a new Interface.
+func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
+ return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
+}
+
+// ArangoRoutes returns a ArangoRouteInformer.
+func (v *version) ArangoRoutes() ArangoRouteInformer {
+ return &arangoRouteInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
+}
diff --git a/pkg/generated/listers/networking/v1alpha1/arangoroute.go b/pkg/generated/listers/networking/v1alpha1/arangoroute.go
new file mode 100644
index 000000000..737f34c10
--- /dev/null
+++ b/pkg/generated/listers/networking/v1alpha1/arangoroute.go
@@ -0,0 +1,103 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by lister-gen. DO NOT EDIT.
+
+package v1alpha1
+
+import (
+ v1alpha1 "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ "k8s.io/apimachinery/pkg/api/errors"
+ "k8s.io/apimachinery/pkg/labels"
+ "k8s.io/client-go/tools/cache"
+)
+
+// ArangoRouteLister helps list ArangoRoutes.
+// All objects returned here must be treated as read-only.
+type ArangoRouteLister interface {
+ // List lists all ArangoRoutes in the indexer.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v1alpha1.ArangoRoute, err error)
+ // ArangoRoutes returns an object that can list and get ArangoRoutes.
+ ArangoRoutes(namespace string) ArangoRouteNamespaceLister
+ ArangoRouteListerExpansion
+}
+
+// arangoRouteLister implements the ArangoRouteLister interface.
+type arangoRouteLister struct {
+ indexer cache.Indexer
+}
+
+// NewArangoRouteLister returns a new ArangoRouteLister.
+func NewArangoRouteLister(indexer cache.Indexer) ArangoRouteLister {
+ return &arangoRouteLister{indexer: indexer}
+}
+
+// List lists all ArangoRoutes in the indexer.
+func (s *arangoRouteLister) List(selector labels.Selector) (ret []*v1alpha1.ArangoRoute, err error) {
+ err = cache.ListAll(s.indexer, selector, func(m interface{}) {
+ ret = append(ret, m.(*v1alpha1.ArangoRoute))
+ })
+ return ret, err
+}
+
+// ArangoRoutes returns an object that can list and get ArangoRoutes.
+func (s *arangoRouteLister) ArangoRoutes(namespace string) ArangoRouteNamespaceLister {
+ return arangoRouteNamespaceLister{indexer: s.indexer, namespace: namespace}
+}
+
+// ArangoRouteNamespaceLister helps list and get ArangoRoutes.
+// All objects returned here must be treated as read-only.
+type ArangoRouteNamespaceLister interface {
+ // List lists all ArangoRoutes in the indexer for a given namespace.
+ // Objects returned here must be treated as read-only.
+ List(selector labels.Selector) (ret []*v1alpha1.ArangoRoute, err error)
+ // Get retrieves the ArangoRoute from the indexer for a given namespace and name.
+ // Objects returned here must be treated as read-only.
+ Get(name string) (*v1alpha1.ArangoRoute, error)
+ ArangoRouteNamespaceListerExpansion
+}
+
+// arangoRouteNamespaceLister implements the ArangoRouteNamespaceLister
+// interface.
+type arangoRouteNamespaceLister struct {
+ indexer cache.Indexer
+ namespace string
+}
+
+// List lists all ArangoRoutes in the indexer for a given namespace.
+func (s arangoRouteNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.ArangoRoute, err error) {
+ err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
+ ret = append(ret, m.(*v1alpha1.ArangoRoute))
+ })
+ return ret, err
+}
+
+// Get retrieves the ArangoRoute from the indexer for a given namespace and name.
+func (s arangoRouteNamespaceLister) Get(name string) (*v1alpha1.ArangoRoute, error) {
+ obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
+ if err != nil {
+ return nil, err
+ }
+ if !exists {
+ return nil, errors.NewNotFound(v1alpha1.Resource("arangoroute"), name)
+ }
+ return obj.(*v1alpha1.ArangoRoute), nil
+}
diff --git a/pkg/generated/listers/networking/v1alpha1/expansion_generated.go b/pkg/generated/listers/networking/v1alpha1/expansion_generated.go
new file mode 100644
index 000000000..e0d7ccab7
--- /dev/null
+++ b/pkg/generated/listers/networking/v1alpha1/expansion_generated.go
@@ -0,0 +1,31 @@
+//
+// DISCLAIMER
+//
+// Copyright 2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+// Code generated by lister-gen. DO NOT EDIT.
+
+package v1alpha1
+
+// ArangoRouteListerExpansion allows custom methods to be added to
+// ArangoRouteLister.
+type ArangoRouteListerExpansion interface{}
+
+// ArangoRouteNamespaceListerExpansion allows custom methods to be added to
+// ArangoRouteNamespaceLister.
+type ArangoRouteNamespaceListerExpansion interface{}
diff --git a/pkg/util/k8sutil/inspector/arangoroute/definition.go b/pkg/util/k8sutil/inspector/arangoroute/definition.go
new file mode 100644
index 000000000..e78513740
--- /dev/null
+++ b/pkg/util/k8sutil/inspector/arangoroute/definition.go
@@ -0,0 +1,44 @@
+//
+// DISCLAIMER
+//
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package arangoroute
+
+import (
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/anonymous"
+ v1alpha1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoroute/v1alpha1"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/refresh"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/version"
+)
+
+type Inspector interface {
+ ArangoRoute() Definition
+}
+
+type Definition interface {
+ refresh.Inspector
+
+ gvk.GK
+ anonymous.Impl
+
+ Version() version.Version
+
+ V1Alpha1() (v1alpha1.Inspector, error)
+}
diff --git a/pkg/util/k8sutil/inspector/arangoroute/v1alpha1/loader.go b/pkg/util/k8sutil/inspector/arangoroute/v1alpha1/loader.go
new file mode 100644
index 000000000..8fc237eed
--- /dev/null
+++ b/pkg/util/k8sutil/inspector/arangoroute/v1alpha1/loader.go
@@ -0,0 +1,53 @@
+//
+// DISCLAIMER
+//
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import (
+ networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/gvk"
+)
+
+type Inspector interface {
+ gvk.GVK
+
+ ListSimple() []*networkingApi.ArangoRoute
+ GetSimple(name string) (*networkingApi.ArangoRoute, bool)
+ Filter(filters ...Filter) []*networkingApi.ArangoRoute
+ Iterate(action Action, filters ...Filter) error
+ Read() ReadInterface
+}
+
+type Filter func(at *networkingApi.ArangoRoute) bool
+type Action func(at *networkingApi.ArangoRoute) error
+
+func FilterObject(at *networkingApi.ArangoRoute, filters ...Filter) bool {
+ for _, f := range filters {
+ if f == nil {
+ continue
+ }
+
+ if !f(at) {
+ return false
+ }
+ }
+
+ return true
+}
diff --git a/pkg/util/k8sutil/inspector/arangoroute/v1alpha1/reader.go b/pkg/util/k8sutil/inspector/arangoroute/v1alpha1/reader.go
new file mode 100644
index 000000000..bd51d3ef6
--- /dev/null
+++ b/pkg/util/k8sutil/inspector/arangoroute/v1alpha1/reader.go
@@ -0,0 +1,50 @@
+//
+// DISCLAIMER
+//
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package v1alpha1
+
+import (
+ "context"
+
+ meta "k8s.io/apimachinery/pkg/apis/meta/v1"
+ "k8s.io/apimachinery/pkg/types"
+
+ networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+)
+
+// ModInterface has methods to work with ArangoTask resources only for creation
+type ModInterface interface {
+ Create(ctx context.Context, arangotask *networkingApi.ArangoRoute, opts meta.CreateOptions) (*networkingApi.ArangoRoute, error)
+ Update(ctx context.Context, arangotask *networkingApi.ArangoRoute, opts meta.UpdateOptions) (*networkingApi.ArangoRoute, error)
+ UpdateStatus(ctx context.Context, arangotask *networkingApi.ArangoRoute, opts meta.UpdateOptions) (*networkingApi.ArangoRoute, error)
+ Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts meta.PatchOptions, subresources ...string) (result *networkingApi.ArangoRoute, err error)
+ Delete(ctx context.Context, name string, opts meta.DeleteOptions) error
+}
+
+// Interface has methods to work with ArangoTask resources.
+type Interface interface {
+ ModInterface
+ ReadInterface
+}
+
+// ReadInterface has methods to work with ArangoTask resources with ReadOnly mode.
+type ReadInterface interface {
+ Get(ctx context.Context, name string, opts meta.GetOptions) (*networkingApi.ArangoRoute, error)
+}
diff --git a/pkg/util/k8sutil/inspector/constants/ar_constants.go b/pkg/util/k8sutil/inspector/constants/ar_constants.go
new file mode 100644
index 000000000..13541bd93
--- /dev/null
+++ b/pkg/util/k8sutil/inspector/constants/ar_constants.go
@@ -0,0 +1,66 @@
+//
+// DISCLAIMER
+//
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
+//
+// 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.
+//
+// Copyright holder is ArangoDB GmbH, Cologne, Germany
+//
+
+package constants
+
+import (
+ "k8s.io/apimachinery/pkg/runtime/schema"
+
+ "github.com/arangodb/kube-arangodb/pkg/apis/networking"
+ networkingApi "github.com/arangodb/kube-arangodb/pkg/apis/networking/v1alpha1"
+)
+
+// ArangoRoute
+const (
+ ArangoRouteGroup = networking.ArangoNetworkingGroupName
+ ArangoRouteResource = networking.ArangoRouteResourcePlural
+ ArangoRouteKind = networking.ArangoRouteResourceKind
+ ArangoRouteVersionV1Alpha1 = networkingApi.ArangoNetworkingVersion
+)
+
+func ArangoRouteGK() schema.GroupKind {
+ return schema.GroupKind{
+ Group: ArangoRouteGroup,
+ Kind: ArangoRouteKind,
+ }
+}
+
+func ArangoRouteGKv1() schema.GroupVersionKind {
+ return schema.GroupVersionKind{
+ Group: ArangoRouteGroup,
+ Kind: ArangoRouteKind,
+ Version: ArangoRouteVersionV1Alpha1,
+ }
+}
+
+func ArangoRouteGR() schema.GroupResource {
+ return schema.GroupResource{
+ Group: ArangoRouteGroup,
+ Resource: ArangoRouteResource,
+ }
+}
+
+func ArangoRouteGRv1() schema.GroupVersionResource {
+ return schema.GroupVersionResource{
+ Group: ArangoRouteGroup,
+ Resource: ArangoRouteResource,
+ Version: ArangoRouteVersionV1Alpha1,
+ }
+}
diff --git a/pkg/util/k8sutil/inspector/definitions/components.go b/pkg/util/k8sutil/inspector/definitions/components.go
index 14974cc8f..af4b8c115 100644
--- a/pkg/util/k8sutil/inspector/definitions/components.go
+++ b/pkg/util/k8sutil/inspector/definitions/components.go
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
-// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ const (
ArangoClusterSynchronization Component = "ArangoClusterSynchronization"
ArangoMember Component = "ArangoMember"
ArangoTask Component = "ArangoTask"
+ ArangoRoute Component = "ArangoRoute"
Node Component = "Node"
PersistentVolume Component = "PersistentVolume"
PersistentVolumeClaim Component = "PersistentVolumeClaim"
@@ -45,6 +46,7 @@ func AllComponents() []Component {
ArangoClusterSynchronization,
ArangoMember,
ArangoTask,
+ ArangoRoute,
Node,
PersistentVolume,
PersistentVolumeClaim,
diff --git a/pkg/util/k8sutil/inspector/inspector.go b/pkg/util/k8sutil/inspector/inspector.go
index d799af6c1..763c37643 100644
--- a/pkg/util/k8sutil/inspector/inspector.go
+++ b/pkg/util/k8sutil/inspector/inspector.go
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
-// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@ import (
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoclustersynchronization"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangodeployment"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangomember"
+ "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoroute"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangotask"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/endpoints"
"github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/mods"
@@ -90,6 +91,7 @@ type Inspector interface {
persistentvolume.Inspector
arangoclustersynchronization.Inspector
arangotask.Inspector
+ arangoroute.Inspector
mods.Mods
diff --git a/pkg/util/k8sutil/inspector/mods/mods.go b/pkg/util/k8sutil/inspector/mods/mods.go
index b33336967..e5bfc6e23 100644
--- a/pkg/util/k8sutil/inspector/mods/mods.go
+++ b/pkg/util/k8sutil/inspector/mods/mods.go
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
-// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ package mods
import (
arangoclustersynchronizationv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoclustersynchronization/v1"
arangomemberv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangomember/v1"
+ arangoroutev1alpha1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangoroute/v1alpha1"
arangotaskv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/arangotask/v1"
endpointsv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/endpoints/v1"
persistentvolumeclaimv1 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/inspector/persistentvolumeclaim/v1"
@@ -78,6 +79,10 @@ type ArangoClusterSynchronizationMods interface {
V1() arangoclustersynchronizationv1.ModInterface
}
+type ArangoRouteMods interface {
+ V1Alpha1() arangoroutev1alpha1.ModInterface
+}
+
type Mods interface {
PodsModInterface() PodsMods
ServiceAccountsModInterface() ServiceAccountsMods
@@ -91,4 +96,5 @@ type Mods interface {
ArangoMemberModInterface() ArangoMemberMods
ArangoTaskModInterface() ArangoTaskMods
ArangoClusterSynchronizationModInterface() ArangoClusterSynchronizationMods
+ ArangoRouteModInterface() ArangoRouteMods
}
diff --git a/pkg/util/k8sutil/inspector/throttle/throttle.go b/pkg/util/k8sutil/inspector/throttle/throttle.go
index 0095355fa..96bacf9f2 100644
--- a/pkg/util/k8sutil/inspector/throttle/throttle.go
+++ b/pkg/util/k8sutil/inspector/throttle/throttle.go
@@ -1,7 +1,7 @@
//
// DISCLAIMER
//
-// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany
+// Copyright 2016-2024 ArangoDB GmbH, Cologne, Germany
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -32,14 +32,15 @@ type Inspector interface {
}
func NewAlwaysThrottleComponents() Components {
- return NewThrottleComponents(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
+ return NewThrottleComponents(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
}
-func NewThrottleComponents(acs, am, at, node, pvc, pod, pv, pdb, secret, service, serviceAccount, sm, endpoints time.Duration) Components {
+func NewThrottleComponents(acs, am, at, ar, node, pvc, pod, pv, pdb, secret, service, serviceAccount, sm, endpoints time.Duration) Components {
return &throttleComponents{
arangoClusterSynchronization: NewThrottle(acs),
arangoMember: NewThrottle(am),
arangoTask: NewThrottle(at),
+ arangoRoute: NewThrottle(ar),
node: NewThrottle(node),
persistentVolume: NewThrottle(pv),
persistentVolumeClaim: NewThrottle(pvc),
@@ -57,6 +58,7 @@ type Components interface {
ArangoClusterSynchronization() Throttle
ArangoMember() Throttle
ArangoTask() Throttle
+ ArangoRoute() Throttle
Node() Throttle
PersistentVolume() Throttle
PersistentVolumeClaim() Throttle
@@ -79,6 +81,7 @@ type throttleComponents struct {
arangoClusterSynchronization Throttle
arangoMember Throttle
arangoTask Throttle
+ arangoRoute Throttle
node Throttle
persistentVolume Throttle
persistentVolumeClaim Throttle
@@ -126,6 +129,8 @@ func (t *throttleComponents) Get(c definitions.Component) Throttle {
return t.arangoMember
case definitions.ArangoTask:
return t.arangoTask
+ case definitions.ArangoRoute:
+ return t.arangoRoute
case definitions.Node:
return t.node
case definitions.PersistentVolume:
@@ -156,6 +161,7 @@ func (t *throttleComponents) Copy() Components {
arangoClusterSynchronization: t.arangoClusterSynchronization.Copy(),
arangoMember: t.arangoMember.Copy(),
arangoTask: t.arangoTask.Copy(),
+ arangoRoute: t.arangoRoute.Copy(),
node: t.node.Copy(),
persistentVolume: t.persistentVolume.Copy(),
persistentVolumeClaim: t.persistentVolumeClaim.Copy(),
@@ -181,6 +187,10 @@ func (t *throttleComponents) ArangoTask() Throttle {
return t.arangoTask
}
+func (t *throttleComponents) ArangoRoute() Throttle {
+ return t.arangoRoute
+}
+
func (t *throttleComponents) Node() Throttle {
return t.node
}