Skip to content
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
15 changes: 9 additions & 6 deletions .testcoverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ threshold:

exclude:
paths:
- \.pb\.go$ # excludes all protobuf generated files
- ^pkg/generated # exclude generated code
- ^pkg/apis/ # exclude API definitions
- ^pkg/signals # exclude signal handlers from sample controller
- hack/*.go # exclude hack folder
- main.go # application entry point
- \.pb\.go$ # excludes all protobuf generated files
- ^pkg/generated # exclude generated code
- ^pkg/internal/generated # exclude generated code
- ^pkg/internal/apis_test # exclude test API definitions
- ^pkg/apis/ # exclude API definitions
- ^pkg/signals # exclude signal handlers from sample controller
- hack/*.go # exclude hack folder
- tests/mocks # exclude mocks
- main.go # application entry point
20 changes: 16 additions & 4 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,26 @@ source "${CODEGEN_PKG}/kube_codegen.sh"

THIS_PKG="github.com/SneaksAndData/arcane-operator"

if [ -z "${API_ROOT:-}" ]; then
API_ROOT="${SCRIPT_ROOT}/pkg/apis"
fi

if [ -z "${GEN_ROOT:-}" ]; then
GEN_ROOT="${SCRIPT_ROOT}/pkg/generated"
fi

if [ -z "${GEN_PKG:-}" ]; then
GEN_PKG="pkg/generated"
fi

kube::codegen::gen_helpers \
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
"${SCRIPT_ROOT}/pkg/apis"
"${API_ROOT}"

kube::codegen::gen_client \
--with-watch \
--with-applyconfig \
--output-dir "${SCRIPT_ROOT}/pkg/generated" \
--output-pkg "${THIS_PKG}/pkg/generated" \
--output-dir "${GEN_ROOT}" \
--output-pkg "${THIS_PKG}/${GEN_PKG}" \
--boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" \
"${SCRIPT_ROOT}/pkg/apis"
"${API_ROOT}"
22 changes: 22 additions & 0 deletions pkg/internal/apis_test/streaming/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2024. ECCO Data & AI Open-Source Project Maintainers.
*
* 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 streaming

// GroupName is the group name used in this package
const (
GroupName = "streaming.sneaksanddata.com"
)
21 changes: 21 additions & 0 deletions pkg/internal/apis_test/streaming/v1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright (c) 2024. ECCO Data & AI Open-Source Project Maintainers.
*
* 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
// +groupName=streaming.sneaksanddata.com

// Package v1 is the v1 version of the API.
package v1
54 changes: 54 additions & 0 deletions pkg/internal/apis_test/streaming/v1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2024. ECCO Data & AI Open-Source Project Maintainers.
*
* 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 v1

import (
"github.com/SneaksAndData/arcane-operator/pkg/apis/streaming"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: streaming.GroupName, Version: "v1"}

// Kind takes an unqualified kind and returns back a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

var (
// SchemeBuilder initializes a scheme builder
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// AddToScheme is a global function that registers this API group & version to a scheme
AddToScheme = SchemeBuilder.AddToScheme
)

// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&MockStreamDefinition{},
&MockStreamDefinitionList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
40 changes: 40 additions & 0 deletions pkg/internal/apis_test/streaming/v1/tyes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//go: build test

package v1

import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

// MockStreamDefinitionSpec is a mock implementation of the StreamDefinitionSpec for testing purposes.
type MockStreamDefinitionSpec struct {
// Source represents the source of the stream.
Source string `json:"source"`

// Destination represents the destination of the stream.
Destination string `json:"destination"`
}

type MockStreamDefinitionStatus struct {
// Phase represents the current phase of the stream.
Phase string `json:"phase"`
}

// MockStreamDefinition is a mock implementation of the StreamDefinition for testing purposes.
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status
// +kubebuilder:object:root=true
type MockStreamDefinition struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec MockStreamDefinitionSpec `json:"spec,omitempty"`
Status MockStreamDefinitionStatus `json:"status,omitempty"`
}

// MockStreamDefinitionList contains a list of MockStreamDefinition resources
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type MockStreamDefinitionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MockStreamDefinition `json:"items"`
}
119 changes: 119 additions & 0 deletions pkg/internal/apis_test/streaming/v1/zz_generated.deepcopy.go

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

62 changes: 62 additions & 0 deletions pkg/internal/generated/applyconfiguration/internal/internal.go

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

Loading
Loading