Skip to content

Commit

Permalink
[Feature] ArangoRoute CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
ajanikow committed Jul 25, 2024
1 parent 375c89e commit 589abc6
Show file tree
Hide file tree
Showing 71 changed files with 2,850 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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:
Expand Down
22 changes: 22 additions & 0 deletions chart/kube-arangodb-arm64/crds/networking-route.yaml
Original file line number Diff line number Diff line change
@@ -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: {}
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
22 changes: 22 additions & 0 deletions chart/kube-arangodb-enterprise-arm64/crds/networking-route.yaml
Original file line number Diff line number Diff line change
@@ -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: {}
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
22 changes: 22 additions & 0 deletions chart/kube-arangodb-enterprise/crds/networking-route.yaml
Original file line number Diff line number Diff line change
@@ -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: {}
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
22 changes: 22 additions & 0 deletions chart/kube-arangodb/crds/networking-route.yaml
Original file line number Diff line number Diff line change
@@ -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: {}
3 changes: 3 additions & 0 deletions chart/kube-arangodb/templates/deployment-operator/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
91 changes: 91 additions & 0 deletions docs/api/ArangoRoute.V1Alpha1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
layout: page
parent: CRD reference
title: ArangoRoute V1Alpha1
---

# API Reference for ArangoRoute V1Alpha1

## Spec

### .spec.deployment

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec.go#L7)</sup>

Deployment specifies the ArangoDeployment object name

***

### .spec.destination.schema

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec_destination.go#L10)</sup>

Schema defines HTTP/S schema used for connection

***

### .spec.destination.service.checksum

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/shared/v1/object.go#L61)</sup>

UID keeps the information about object Checksum

***

### .spec.destination.service.name

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/shared/v1/object.go#L52)</sup>

Name of the object

***

### .spec.destination.service.namespace

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/shared/v1/object.go#L55)</sup>

Namespace of the object. Should default to the namespace of the parent object

***

### .spec.destination.service.port

Type: `intstr.IntOrString` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec_destination_service.go#L16)</sup>

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` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/shared/v1/object.go#L58)</sup>

UID keeps the information about object UID

***

### .spec.destination.tls.insecure

Type: `boolean` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec_destination_tls.go#L5)</sup>

Insecure allows Insecure traffic

***

### .spec.route.path

Type: `string` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_spec_route.go#L9)</sup>

Path specifies the Path route

## Status

### .status.conditions

Type: `api.Conditions` <sup>[\[ref\]](https://github.com/arangodb/kube-arangodb/blob/1.2.42/pkg/apis/networking/v1alpha1/route_status.go#L8)</sup>

Conditions specific to the entire extension

10 changes: 10 additions & 0 deletions internal/cr_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/docs_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions internal/docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion internal/schema_builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
29 changes: 29 additions & 0 deletions pkg/apis/networking/definitions.go
Original file line number Diff line number Diff line change
@@ -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"
)
23 changes: 23 additions & 0 deletions pkg/apis/networking/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 589abc6

Please sign in to comment.