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

Adjust webhook for handling NFSv3 #42

Draft
wants to merge 42 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
40d1b54
fix
NikolayDemchuk Oct 16, 2024
ebfe764
fix
NikolayDemchuk Oct 16, 2024
92c9505
fix
NikolayDemchuk Oct 16, 2024
2dbb679
fix
NikolayDemchuk Oct 17, 2024
883ab52
fix
NikolayDemchuk Oct 17, 2024
12d9d0b
fix
NikolayDemchuk Oct 18, 2024
5bbb329
some verbosity
NikolayDemchuk Oct 22, 2024
4b6a225
bump CI
NikolayDemchuk Nov 19, 2024
64dd324
fix filename
NikolayDemchuk Nov 20, 2024
1b4d023
added templates for prometheus
NikolayDemchuk Nov 21, 2024
859f8b9
try
NikolayDemchuk Nov 27, 2024
2768282
fix
NikolayDemchuk Nov 27, 2024
4ea125e
fix
NikolayDemchuk Nov 27, 2024
622fb05
fix
NikolayDemchuk Nov 27, 2024
956a331
fix
NikolayDemchuk Nov 27, 2024
f4b72e0
fix
NikolayDemchuk Nov 27, 2024
addf72b
fix
NikolayDemchuk Nov 27, 2024
eca8b25
fix
NikolayDemchuk Nov 27, 2024
d40b8a1
fix
NikolayDemchuk Nov 27, 2024
97c58da
fix
NikolayDemchuk Nov 27, 2024
c390f53
fix
NikolayDemchuk Nov 27, 2024
67fd4c8
fixes
NikolayDemchuk Nov 28, 2024
0faa180
testing
NikolayDemchuk Nov 29, 2024
ecd2c9d
test
NikolayDemchuk Nov 29, 2024
556027a
fix
NikolayDemchuk Nov 29, 2024
8580ce0
fix
NikolayDemchuk Nov 29, 2024
b052b13
fix
NikolayDemchuk Nov 29, 2024
05ccc7e
testing
NikolayDemchuk Dec 2, 2024
31bb1bc
fix
NikolayDemchuk Dec 2, 2024
79ae397
added rbac for mc list
NikolayDemchuk Dec 2, 2024
2211ef4
fix
NikolayDemchuk Dec 2, 2024
76619e5
rbac tryouts
NikolayDemchuk Dec 2, 2024
95e245f
fix
NikolayDemchuk Dec 2, 2024
943360f
fix
NikolayDemchuk Dec 2, 2024
0b7510c
fix
NikolayDemchuk Dec 2, 2024
6d7e873
fixes
NikolayDemchuk Dec 3, 2024
14f3c56
fix
NikolayDemchuk Dec 3, 2024
319b0ba
fix
NikolayDemchuk Dec 3, 2024
f612e5a
fix
NikolayDemchuk Dec 3, 2024
92766e9
git push
NikolayDemchuk Dec 3, 2024
dacb37d
fix
NikolayDemchuk Dec 3, 2024
f825b41
added mc_watcher
NikolayDemchuk Dec 9, 2024
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
114 changes: 114 additions & 0 deletions api/v1alpha1/module_config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/*
Copyright 2023 Flant JSC

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

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

var (
// ModuleConfigGVR GroupVersionResource
ModuleConfigGVR = schema.GroupVersionResource{
Group: SchemeGroupVersion.Group,
Version: SchemeGroupVersion.Version,
Resource: "moduleconfigs",
}
ModuleConfigGVK = schema.GroupVersionKind{
Group: SchemeGroupVersion.Group,
Version: SchemeGroupVersion.Version,
Kind: "ModuleConfig",
}
)

var _ runtime.Object = (*ModuleConfig)(nil)

// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ModuleConfig is a configuration for module or for global config values.
type ModuleConfig struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ModuleConfigSpec `json:"spec"`

Status ModuleConfigStatus `json:"status,omitempty"`
}

// SettingsValues empty interface in needed to handle DeepCopy generation. DeepCopy does not work with unnamed empty interfaces
type SettingsValues map[string]interface{}

func (v *SettingsValues) DeepCopy() *SettingsValues {
nmap := make(map[string]interface{}, len(*v))

for key, value := range *v {
nmap[key] = value
}

vv := SettingsValues(nmap)

return &vv
}

func (v SettingsValues) DeepCopyInto(out *SettingsValues) {
{
v := &v
clone := v.DeepCopy()
*out = *clone
return
}
}

type ModuleConfigSpec struct {
Version int `json:"version,omitempty"`
Settings SettingsValues `json:"settings,omitempty"`
Enabled *bool `json:"enabled,omitempty"`
}

type ModuleConfigStatus struct {
Version string `json:"version"`
Message string `json:"message"`
}

// +k8s:deepcopy-gen=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// ModuleConfigList is a list of ModuleConfig resources
type ModuleConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`

Items []ModuleConfig `json:"items"`
}

type moduleConfigKind struct{}

func (in *ModuleConfigStatus) GetObjectKind() schema.ObjectKind {
return &moduleConfigKind{}
}

func (f *moduleConfigKind) SetGroupVersionKind(_ schema.GroupVersionKind) {}
func (f *moduleConfigKind) GroupVersionKind() schema.GroupVersionKind {
return ModuleConfigGVK
}
12 changes: 12 additions & 0 deletions api/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const (
NFSStorageClassKind = "NFSStorageClass"
APIGroup = "storage.deckhouse.io"
APIVersion = "v1alpha1"
APIGroupMC = "deckhouse.io"
)

// SchemeGroupVersion is group version used to register these objects
Expand All @@ -34,6 +35,11 @@ var (
Group: APIGroup,
Version: APIVersion,
}

SchemeGroupVersionMC = schema.GroupVersion{
Group: APIGroupMC,
Version: APIVersion,
}
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
AddToScheme = SchemeBuilder.AddToScheme
)
Expand All @@ -44,6 +50,12 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&NFSStorageClass{},
&NFSStorageClassList{},
)

scheme.AddKnownTypes(SchemeGroupVersionMC,
&ModuleConfig{},
&ModuleConfigList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
metav1.AddToGroupVersion(scheme, SchemeGroupVersionMC)
return nil
}
99 changes: 99 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,102 @@ func (in *NFSStorageClassList) DeepCopyObject() runtime.Object {
}
return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ModuleConfig) DeepCopyInto(out *ModuleConfig) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
out.Status = in.Status
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleConfig.
func (in *ModuleConfig) DeepCopy() *ModuleConfig {
if in == nil {
return nil
}
out := new(ModuleConfig)
in.DeepCopyInto(out)
return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ModuleConfig) 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 *ModuleConfigList) DeepCopyInto(out *ModuleConfigList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]ModuleConfig, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleConfigList.
func (in *ModuleConfigList) DeepCopy() *ModuleConfigList {
if in == nil {
return nil
}
out := new(ModuleConfigList)
in.DeepCopyInto(out)
return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ModuleConfigList) 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 *ModuleConfigSpec) DeepCopyInto(out *ModuleConfigSpec) {
*out = *in
in.Settings.DeepCopyInto(&out.Settings)
if in.Enabled != nil {
in, out := &in.Enabled, &out.Enabled
*out = new(bool)
**out = **in
}
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleConfigSpec.
func (in *ModuleConfigSpec) DeepCopy() *ModuleConfigSpec {
if in == nil {
return nil
}
out := new(ModuleConfigSpec)
in.DeepCopyInto(out)
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ModuleConfigStatus) DeepCopyInto(out *ModuleConfigStatus) {
*out = *in
return
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleConfigStatus.
func (in *ModuleConfigStatus) DeepCopy() *ModuleConfigStatus {
if in == nil {
return nil
}
out := new(ModuleConfigStatus)
in.DeepCopyInto(out)
return out
}
4 changes: 3 additions & 1 deletion images/controller/src/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module d8-controller
go 1.22.2

require (
github.com/deckhouse/csi-nfs/api v0.0.0-20240803013516-738ee1ca87bc
github.com/deckhouse/csi-nfs/api v0.0.0-20241129063443-ecd2c9d45a03
github.com/go-logr/logr v1.4.1
github.com/onsi/ginkgo/v2 v2.15.0
github.com/onsi/gomega v1.31.0
Expand Down Expand Up @@ -70,3 +70,5 @@ require (
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)

// replace github.com/deckhouse/csi-nfs/api => ../../../api
4 changes: 2 additions & 2 deletions images/controller/src/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckhouse/csi-nfs/api v0.0.0-20240803013516-738ee1ca87bc h1:FRil0A1OjAHQl5Hkf2eVcU6/jrtLKMVfIOo5RDQf5NM=
github.com/deckhouse/csi-nfs/api v0.0.0-20240803013516-738ee1ca87bc/go.mod h1:/vXhdSgMvU4dP2MvOHOFZua9MvJoAPLM/hk6p7rE+Jc=
github.com/deckhouse/csi-nfs/api v0.0.0-20241129063443-ecd2c9d45a03 h1:K2QkWZTnn4LUKgxpS9DSGVXXPYuVuL2pq+825GUWAIQ=
github.com/deckhouse/csi-nfs/api v0.0.0-20241129063443-ecd2c9d45a03/go.mod h1:/vXhdSgMvU4dP2MvOHOFZua9MvJoAPLM/hk6p7rE+Jc=
github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g=
github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc=
github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84=
Expand Down
Loading
Loading