Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add networking group #359

Merged
merged 1 commit into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,9 @@ check: manifests generate addlicense lint test # Generate manifests, code, lint,
docs: ## Run go generate to generate API reference documentation.
go run github.com/ahmetb/gen-crd-api-reference-docs -api-dir ./apis/common/v1alpha1 -config ./hack/api-reference/common-config.json -template-dir ./hack/api-reference/template -out-file ./docs/api-reference/common.md
go run github.com/ahmetb/gen-crd-api-reference-docs -api-dir ./apis/compute/v1alpha1 -config ./hack/api-reference/compute-config.json -template-dir ./hack/api-reference/template -out-file ./docs/api-reference/compute.md
go run github.com/ahmetb/gen-crd-api-reference-docs -api-dir ./apis/ipam/v1alpha1 -config ./hack/api-reference/ipam-config.json -template-dir ./hack/api-reference/template -out-file ./docs/api-reference/ipam.md
go run github.com/ahmetb/gen-crd-api-reference-docs -api-dir ./apis/storage/v1alpha1 -config ./hack/api-reference/storage-config.json -template-dir ./hack/api-reference/template -out-file ./docs/api-reference/storage.md
# TODO: Enable once first types are there # go run github.com/ahmetb/gen-crd-api-reference-docs -api-dir ./apis/networking/v1alpha1 -config ./hack/api-reference/networking-config.json -template-dir ./hack/api-reference/template -out-file ./docs/api-reference/networking.md
go run github.com/ahmetb/gen-crd-api-reference-docs -api-dir ./apis/ipam/v1alpha1 -config ./hack/api-reference/ipam-config.json -template-dir ./hack/api-reference/template -out-file ./docs/api-reference/ipam.md

.PHONY: start-docs
start-docs: ## Start the local mkdocs based development environment.
Expand Down
24 changes: 24 additions & 0 deletions apis/networking/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2021 by the OnMetal authors.
*
* 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.
*/

// +k8s:deepcopy-gen=package,register
// +k8s:openapi-gen=true
// +k8s:defaulter-gen=TypeMeta
// +k8s:protobuf-gen=package
// +groupName=networking.api.onmetal.de

// Package networking is the internal version of the API.
package networking // import "github.com/onmetal/onmetal-api/apis/networking"
28 changes: 28 additions & 0 deletions apis/networking/install/install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2022 OnMetal authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package install

import (
"github.com/onmetal/onmetal-api/apis/networking"
"github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)

func Install(scheme *runtime.Scheme) {
utilruntime.Must(networking.AddToScheme(scheme))
utilruntime.Must(v1alpha1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(v1alpha1.SchemeGroupVersion))
}
48 changes: 48 additions & 0 deletions apis/networking/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2021 by the OnMetal authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Package networking contains API Schema definitions for the networking internal API group
//+kubebuilder:object:generate=true
//+groupName=networking.api.onmetal.de
package networking

import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "networking.api.onmetal.de", Version: runtime.APIVersionInternal}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

func Resource(name string) schema.GroupResource {
return schema.GroupResource{
Group: SchemeGroupVersion.Group,
Resource: name,
}
}

func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion)
return nil
}
25 changes: 25 additions & 0 deletions apis/networking/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2021 by the OnMetal authors.
*
* 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.
*/

// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=github.com/onmetal/onmetal-api/apis/networking
// +k8s:openapi-gen=true
// +k8s:defaulter-gen=TypeMeta
// +k8s:protobuf-gen=package
// +groupName=networking.api.onmetal.de

// Package v1alpha1 is the v1alpha1 version of the API.
package v1alpha1 // import "github.com/onmetal/onmetal-api/apis/networking/v1alpha1"
51 changes: 51 additions & 0 deletions apis/networking/v1alpha1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2021 by the OnMetal authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the networking v1alpha1 API group
//+kubebuilder:object:generate=true
//+groupName=networking.api.onmetal.de
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "networking.api.onmetal.de", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

func Resource(name string) schema.GroupResource {
return schema.GroupResource{
Group: SchemeGroupVersion.Group,
Resource: name,
}
}

func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
35 changes: 35 additions & 0 deletions apis/networking/v1alpha1/zz_generated.conversion.go

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

21 changes: 21 additions & 0 deletions apis/networking/v1alpha1/zz_generated.deepcopy.go

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

32 changes: 32 additions & 0 deletions apis/networking/v1alpha1/zz_generated.defaults.go

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

21 changes: 21 additions & 0 deletions apis/networking/zz_generated.deepcopy.go

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

1 change: 1 addition & 0 deletions apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func (c completedConfig) New() (*OnmetalAPIServer, error) {
restStorageProviders := []RESTStorageProvider{
ipamrest.StorageProvider{},
computerest.StorageProvider{},
//networkingrest.StorageProvider{}, TODO: Include once there are resources
storagerest.StorageProvider{},
}

Expand Down
3 changes: 3 additions & 0 deletions app/apiserver/apiserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func NewResourceConfig() *serverstorage.ResourceConfig {
cfg.EnableVersions(
computev1alpha1.SchemeGroupVersion,
storagev1alpha1.SchemeGroupVersion,
//networkingv1alpha1.SchemeGroupVersion, TODO: Include once there are resources
ipamv1alpha1.SchemeGroupVersion,
)
return cfg
Expand All @@ -66,6 +67,7 @@ func NewOnmetalAPIServerOptions() *OnmetalAPIServerOptions {
api.Codecs.LegacyCodec(
computev1alpha1.SchemeGroupVersion,
storagev1alpha1.SchemeGroupVersion,
//networkingv1alpha1.SchemeGroupVersion, TODO: Include once there are resources
ipamv1alpha1.SchemeGroupVersion,
),
),
Expand All @@ -74,6 +76,7 @@ func NewOnmetalAPIServerOptions() *OnmetalAPIServerOptions {
computev1alpha1.SchemeGroupVersion,
schema.GroupKind{Group: computev1alpha1.SchemeGroupVersion.Group},
schema.GroupKind{Group: storagev1alpha1.SchemeGroupVersion.Group},
//schema.GroupKind{Group: networkingv1alpha1.SchemeGroupVersion.Group}, TODO: Include once there are resources
schema.GroupKind{Group: ipamv1alpha1.SchemeGroupVersion.Group},
)
return o
Expand Down
1 change: 1 addition & 0 deletions config/apiserver/apiservice/bases/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ kind: Kustomization
resources:
- v1alpha1.compute.api.onmetal.de.yaml
- v1alpha1.storage.api.onmetal.de.yaml
# TODO: Include once there are resources - v1alpha1.networking.api.onmetal.de.yaml
- v1alpha1.ipam.api.onmetal.de.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# TODO: rename once there are resources
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
name: v1alpha1.networking.api.onmetal.de
spec:
group: networking.api.onmetal.de
version: v1alpha1
service:
namespace: system
name: apiserver-service
groupPriorityMinimum: 2000
versionPriority: 100
2 changes: 1 addition & 1 deletion controllers/compute/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,6 @@ func SetupTest(ctx context.Context) *corev1.Namespace {
var _ = AfterSuite(func() {
cancel()
By("tearing down the test environment")
err := testEnv.Stop()
err := envtestutils.StopWithExtensions(testEnv, testEnvExt)
Expect(err).NotTo(HaveOccurred())
})
2 changes: 1 addition & 1 deletion controllers/storage/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,6 @@ var _ = AfterSuite(func() {
cancel()

By("tearing down the test environment")
err := testEnv.Stop()
err := envtestutils.StopWithExtensions(testEnv, testEnvExt)
Expect(err).NotTo(HaveOccurred())
})
2 changes: 1 addition & 1 deletion docs/api-reference/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,5 +366,5 @@ When specified, allowed values are NoSchedule.</p>
<hr/>
<p><em>
Generated with <code>gen-crd-api-reference-docs</code>
on git commit <code>bbff837</code>.
on git commit <code>6a1408b</code>.
</em></p>
2 changes: 1 addition & 1 deletion docs/api-reference/compute.md
Original file line number Diff line number Diff line change
Expand Up @@ -1148,5 +1148,5 @@ string
<hr/>
<p><em>
Generated with <code>gen-crd-api-reference-docs</code>
on git commit <code>bbff837</code>.
on git commit <code>6a1408b</code>.
</em></p>
2 changes: 1 addition & 1 deletion docs/api-reference/ipam.md
Original file line number Diff line number Diff line change
Expand Up @@ -1905,5 +1905,5 @@ PrefixSpace
<hr/>
<p><em>
Generated with <code>gen-crd-api-reference-docs</code>
on git commit <code>bbff837</code>.
on git commit <code>6a1408b</code>.
</em></p>
Loading