diff --git a/Makefile b/Makefile index 197ceaeaf..ecedea0e1 100644 --- a/Makefile +++ b/Makefile @@ -49,9 +49,9 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust $(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./onmetal-controller-manager/controllers/...;./api/..." output:rbac:artifacts:config=config/controller/rbac .PHONY: generate -generate: vgopath deepcopy-gen client-gen lister-gen informer-gen defaulter-gen conversion-gen openapi-gen - go mod download +generate: vgopath models-schema deepcopy-gen client-gen lister-gen informer-gen defaulter-gen conversion-gen openapi-gen applyconfiguration-gen VGOPATH=$(VGOPATH) \ + MODELS_SCHEMA=$(MODELS_SCHEMA) \ DEEPCOPY_GEN=$(DEEPCOPY_GEN) \ CLIENT_GEN=$(CLIENT_GEN) \ LISTER_GEN=$(LISTER_GEN) \ @@ -59,6 +59,7 @@ generate: vgopath deepcopy-gen client-gen lister-gen informer-gen defaulter-gen DEFAULTER_GEN=$(DEFAULTER_GEN) \ CONVERSION_GEN=$(CONVERSION_GEN) \ OPENAPI_GEN=$(OPENAPI_GEN) \ + APPLYCONFIGURATION_GEN=$(APPLYCONFIGURATION_GEN) \ ./hack/update-codegen.sh .PHONY: fmt @@ -75,6 +76,7 @@ lint: ## Run golangci-lint on the code. .PHONY: clean clean: ## Clean any artifacts that can be regenerated. + rm -rf client-go/applyconfigurations rm -rf client-go/informers rm -rf client-go/listers rm -rf client-go/onmetalapi @@ -85,7 +87,7 @@ add-license: addlicense ## Add license headers to all go files. find . -name '*.go' -exec $(ADDLICENSE) -c 'OnMetal authors' {} + .PHONY: check-license -check-license: ## Check that every file has a license header present. +check-license: addlicense ## Check that every file has a license header present. find . -name '*.go' -exec $(ADDLICENSE) -check -c 'OnMetal authors' {} + .PHONY: check @@ -245,9 +247,11 @@ INFORMER_GEN ?= $(LOCALBIN)/informer-gen DEFAULTER_GEN ?= $(LOCALBIN)/defaulter-gen CONVERSION_GEN ?= $(LOCALBIN)/conversion-gen OPENAPI_GEN ?= $(LOCALBIN)/openapi-gen +APPLYCONFIGURATION_GEN ?= $(LOCALBIN)/applyconfiguration-gen VGOPATH ?= $(LOCALBIN)/vgopath GEN_CRD_API_REFERENCE_DOCS ?= $(LOCALBIN)/gen-crd-api-reference-docs ADDLICENSE ?= $(LOCALBIN)/addlicense +MODELS_SCHEMA ?= $(LOCALBIN)/models-schema ## Tool Versions KUSTOMIZE_VERSION ?= v3.8.7 @@ -308,6 +312,11 @@ openapi-gen: $(OPENAPI_GEN) ## Download openapi-gen locally if necessary. $(OPENAPI_GEN): $(LOCALBIN) test -s $(LOCALBIN)/openapi-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/openapi-gen@$(CODE_GENERATOR_VERSION) +.PHONY: applyconfiguration-gen +applyconfiguration-gen: $(APPLYCONFIGURATION_GEN) ## Download applyconfiguration-gen locally if necessary. +$(APPLYCONFIGURATION_GEN): $(LOCALBIN) + test -s $(LOCALBIN)/applyconfiguration-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/applyconfiguration-gen@$(CODE_GENERATOR_VERSION) + .PHONY: vgopath vgopath: $(VGOPATH) ## Download vgopath locally if necessary. $(VGOPATH): $(LOCALBIN) @@ -331,5 +340,10 @@ $(GEN_CRD_API_REFERENCE_DOCS): $(LOCALBIN) .PHONY: addlicense addlicense: $(ADDLICENSE) ## Download addlicense locally if necessary. $(ADDLICENSE): $(LOCALBIN) - test-s $(LOCALBIN)/addlicense || GOBIN=$(LOCALBIN) go install github.com/google/addlicense@$(ADDLICENSE_VERSION) + test -s $(LOCALBIN)/addlicense || GOBIN=$(LOCALBIN) go install github.com/google/addlicense@$(ADDLICENSE_VERSION) + +.PHONY: models-schema +models-schema: $(MODELS_SCHEMA) ## Install models-schema locally if necessary. +$(MODELS_SCHEMA): $(LOCALBIN) + test -s $(LOCALBIN)/models-schema || GOBIN=$(LOCALBIN) go install github.com/onmetal/onmetal-api/models-schema diff --git a/api/common/v1alpha1/common_types.go b/api/common/v1alpha1/common_types.go index 92a1c0ff1..25c602044 100644 --- a/api/common/v1alpha1/common_types.go +++ b/api/common/v1alpha1/common_types.go @@ -43,9 +43,11 @@ const ( // ConfigMapKeySelector is a reference to a specific 'key' within a ConfigMap resource. // In some instances, `key` is a required field. +// +structType=atomic type ConfigMapKeySelector struct { - // The name of the ConfigMap resource being referred to. - corev1.LocalObjectReference `json:",inline"` + // Name of the referent. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name string `json:"name,omitempty"` // The key of the entry in the ConfigMap resource's `data` field to be used. // Some instances of this field may be defaulted, in others it may be // required. @@ -55,9 +57,11 @@ type ConfigMapKeySelector struct { // SecretKeySelector is a reference to a specific 'key' within a Secret resource. // In some instances, `key` is a required field. +// +structType=atomic type SecretKeySelector struct { - // The name of the Secret resource being referred to. - corev1.LocalObjectReference `json:",inline"` + // Name of the referent. + // More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names + Name string `json:"name,omitempty"` // The key of the entry in the Secret resource's `data` field to be used. // Some instances of this field may be defaulted, in others it may be // required. @@ -66,6 +70,7 @@ type SecretKeySelector struct { } // LocalUIDReference is a reference to another entity including its UID +// +structType=atomic type LocalUIDReference struct { // Name is the name of the referenced entity. Name string `json:"name"` diff --git a/api/common/v1alpha1/register.go b/api/common/v1alpha1/register.go new file mode 100644 index 000000000..a6f543e49 --- /dev/null +++ b/api/common/v1alpha1/register.go @@ -0,0 +1,32 @@ +/* + * 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 common v1alpha1 API group +// +groupName=common.api.onmetal.de +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // SchemeGroupVersion is group version used to register these objects + SchemeGroupVersion = schema.GroupVersion{Group: "common.api.onmetal.de", Version: "v1alpha1"} +) + +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} diff --git a/api/common/v1alpha1/zz_generated.deepcopy.go b/api/common/v1alpha1/zz_generated.deepcopy.go index 7291f9bf8..d3b8245ff 100644 --- a/api/common/v1alpha1/zz_generated.deepcopy.go +++ b/api/common/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -23,7 +23,6 @@ package v1alpha1 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConfigMapKeySelector) DeepCopyInto(out *ConfigMapKeySelector) { *out = *in - out.LocalObjectReference = in.LocalObjectReference return } @@ -74,7 +73,6 @@ func (in *LocalUIDReference) DeepCopy() *LocalUIDReference { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SecretKeySelector) DeepCopyInto(out *SecretKeySelector) { *out = *in - out.LocalObjectReference = in.LocalObjectReference return } diff --git a/api/compute/v1alpha1/machine_types.go b/api/compute/v1alpha1/machine_types.go index c0d580b48..e1b0a3cdd 100644 --- a/api/compute/v1alpha1/machine_types.go +++ b/api/compute/v1alpha1/machine_types.go @@ -39,14 +39,23 @@ type MachineSpec struct { // ImagePullSecretRef is an optional secret for pulling the image of a machine. ImagePullSecretRef *corev1.LocalObjectReference `json:"imagePullSecret,omitempty"` // NetworkInterfaces define a list of network interfaces present on the machine - NetworkInterfaces []NetworkInterface `json:"networkInterfaces,omitempty"` + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + NetworkInterfaces []NetworkInterface `json:"networkInterfaces,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"` // Volumes are volumes attached to this machine. - Volumes []Volume `json:"volumes,omitempty"` + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + Volumes []Volume `json:"volumes,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"` // IgnitionRef is a reference to a secret containing the ignition YAML for the machine to boot up. // If key is empty, DefaultIgnitionKey will be used as fallback. IgnitionRef *commonv1alpha1.SecretKeySelector `json:"ignitionRef,omitempty"` // EFIVars are variables to pass to EFI while booting up. - EFIVars []EFIVar `json:"efiVars,omitempty"` + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + EFIVars []EFIVar `json:"efiVars,omitempty" patchStrategy:"merge,retainKeys" patchMergeKey:"name"` // Tolerations define tolerations the Machine has. Only MachinePools whose taints // covered by Tolerations will be considered to run the Machine. Tolerations []commonv1alpha1.Toleration `json:"tolerations,omitempty"` @@ -85,9 +94,10 @@ type NetworkInterfaceSource struct { type Volume struct { // Name is the name of the Volume Name string `json:"name"` - // Device is the device name where the volume should be attached. If empty, - // an unused device name will be determined if possible. - Device string `json:"device,omitempty"` + // Device is the device name where the volume should be attached. + // Pointer to distinguish between explicit zero and not specified. + // If empty, an unused device name will be determined if possible. + Device *string `json:"device,omitempty"` // VolumeSource is the source where the storage for the Volume resides at. VolumeSource `json:",inline"` } diff --git a/api/compute/v1alpha1/machineclass_types.go b/api/compute/v1alpha1/machineclass_types.go index af8825d4a..c41ea8ac7 100644 --- a/api/compute/v1alpha1/machineclass_types.go +++ b/api/compute/v1alpha1/machineclass_types.go @@ -28,8 +28,7 @@ var ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +genclient -// +genClient:nonNamespaced -// +genClient:noStatus +// +genclient:nonNamespaced // MachineClass is the Schema for the machineclasses API type MachineClass struct { diff --git a/api/compute/v1alpha1/machinepool_types.go b/api/compute/v1alpha1/machinepool_types.go index d052ac1b7..fb708aab3 100644 --- a/api/compute/v1alpha1/machinepool_types.go +++ b/api/compute/v1alpha1/machinepool_types.go @@ -126,7 +126,7 @@ const ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +genclient -// +genClient:nonNamespaced +// +genclient:nonNamespaced // MachinePool is the Schema for the machinepools API type MachinePool struct { diff --git a/api/compute/v1alpha1/zz_generated.deepcopy.go b/api/compute/v1alpha1/zz_generated.deepcopy.go index ee5d79f14..cb176e6f2 100644 --- a/api/compute/v1alpha1/zz_generated.deepcopy.go +++ b/api/compute/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -676,6 +676,11 @@ func (in *ReferencedVolumeStatus) DeepCopy() *ReferencedVolumeStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Volume) DeepCopyInto(out *Volume) { *out = *in + if in.Device != nil { + in, out := &in.Device, &out.Device + *out = new(string) + **out = **in + } in.VolumeSource.DeepCopyInto(&out.VolumeSource) return } diff --git a/api/ipam/v1alpha1/zz_generated.deepcopy.go b/api/ipam/v1alpha1/zz_generated.deepcopy.go index f3992409d..bff74b8bc 100644 --- a/api/ipam/v1alpha1/zz_generated.deepcopy.go +++ b/api/ipam/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/api/networking/v1alpha1/natgateway_type.go b/api/networking/v1alpha1/natgateway_type.go index 2f4fd4eb5..25a3eb416 100644 --- a/api/networking/v1alpha1/natgateway_type.go +++ b/api/networking/v1alpha1/natgateway_type.go @@ -37,7 +37,10 @@ type NATGatewaySpec struct { // IPFamilies are the ip families the load balancer should have. IPFamilies []corev1.IPFamily `json:"ipFamilies"` // IPs are the ips the NAT gateway should allocate. - IPs []NATGatewayIP `json:"ips"` + // +optional + // +patchMergeKey=name + // +patchStrategy=merge,retainKeys + IPs []NATGatewayIP `json:"ips" patchStrategy:"merge,retainKeys" patchMergeKey:"name"` // NetworkRef is the Network this NATGateway should belong to. NetworkRef corev1.LocalObjectReference `json:"networkRef"` // NetworkInterfaceSelector defines the NetworkInterfaces diff --git a/api/networking/v1alpha1/natgatewayrouting_type.go b/api/networking/v1alpha1/natgatewayrouting_type.go index c4d2da768..1a4ca8ee4 100644 --- a/api/networking/v1alpha1/natgatewayrouting_type.go +++ b/api/networking/v1alpha1/natgatewayrouting_type.go @@ -19,6 +19,7 @@ package v1alpha1 import ( commonv1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ) // +genclient @@ -37,7 +38,10 @@ type NATGatewayRouting struct { } type NATGatewayDestination struct { - commonv1alpha1.LocalUIDReference `json:",inline"` + // Name is the name of the referenced entity. + Name string `json:"name"` + // UID is the UID of the referenced entity. + UID types.UID `json:"uid"` // IPs are the nat gateway ips used. IPs []NATGatewayDestinationIP `json:"ips"` } diff --git a/api/networking/v1alpha1/zz_generated.deepcopy.go b/api/networking/v1alpha1/zz_generated.deepcopy.go index 5da8833a4..ddf2e54e0 100644 --- a/api/networking/v1alpha1/zz_generated.deepcopy.go +++ b/api/networking/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -503,7 +503,6 @@ func (in *NATGateway) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NATGatewayDestination) DeepCopyInto(out *NATGatewayDestination) { *out = *in - out.LocalUIDReference = in.LocalUIDReference if in.IPs != nil { in, out := &in.IPs, &out.IPs *out = make([]NATGatewayDestinationIP, len(*in)) diff --git a/api/storage/v1alpha1/volumeclass_types.go b/api/storage/v1alpha1/volumeclass_types.go index e852f2eaf..3d39a4879 100644 --- a/api/storage/v1alpha1/volumeclass_types.go +++ b/api/storage/v1alpha1/volumeclass_types.go @@ -36,7 +36,6 @@ var ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +genclient // +genclient:nonNamespaced -// +genclient:noStatus // VolumeClass is the Schema for the volumeclasses API type VolumeClass struct { diff --git a/api/storage/v1alpha1/zz_generated.deepcopy.go b/api/storage/v1alpha1/zz_generated.deepcopy.go index 053e573e0..166935bc1 100644 --- a/api/storage/v1alpha1/zz_generated.deepcopy.go +++ b/api/storage/v1alpha1/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/applyconfigurations/common/v1alpha1/localuidreference.go b/client-go/applyconfigurations/common/v1alpha1/localuidreference.go new file mode 100644 index 000000000..83f3d60cf --- /dev/null +++ b/client-go/applyconfigurations/common/v1alpha1/localuidreference.go @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + types "k8s.io/apimachinery/pkg/types" +) + +// LocalUIDReferenceApplyConfiguration represents an declarative configuration of the LocalUIDReference type for use +// with apply. +type LocalUIDReferenceApplyConfiguration struct { + Name *string `json:"name,omitempty"` + UID *types.UID `json:"uid,omitempty"` +} + +// LocalUIDReferenceApplyConfiguration constructs an declarative configuration of the LocalUIDReference type for use with +// apply. +func LocalUIDReference() *LocalUIDReferenceApplyConfiguration { + return &LocalUIDReferenceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *LocalUIDReferenceApplyConfiguration) WithName(value string) *LocalUIDReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *LocalUIDReferenceApplyConfiguration) WithUID(value types.UID) *LocalUIDReferenceApplyConfiguration { + b.UID = &value + return b +} diff --git a/client-go/applyconfigurations/common/v1alpha1/secretkeyselector.go b/client-go/applyconfigurations/common/v1alpha1/secretkeyselector.go new file mode 100644 index 000000000..d3bf3b1b7 --- /dev/null +++ b/client-go/applyconfigurations/common/v1alpha1/secretkeyselector.go @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// SecretKeySelectorApplyConfiguration represents an declarative configuration of the SecretKeySelector type for use +// with apply. +type SecretKeySelectorApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Key *string `json:"key,omitempty"` +} + +// SecretKeySelectorApplyConfiguration constructs an declarative configuration of the SecretKeySelector type for use with +// apply. +func SecretKeySelector() *SecretKeySelectorApplyConfiguration { + return &SecretKeySelectorApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *SecretKeySelectorApplyConfiguration) WithName(value string) *SecretKeySelectorApplyConfiguration { + b.Name = &value + return b +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *SecretKeySelectorApplyConfiguration) WithKey(value string) *SecretKeySelectorApplyConfiguration { + b.Key = &value + return b +} diff --git a/client-go/applyconfigurations/common/v1alpha1/taint.go b/client-go/applyconfigurations/common/v1alpha1/taint.go new file mode 100644 index 000000000..e54f8d7ed --- /dev/null +++ b/client-go/applyconfigurations/common/v1alpha1/taint.go @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" +) + +// TaintApplyConfiguration represents an declarative configuration of the Taint type for use +// with apply. +type TaintApplyConfiguration struct { + Key *string `json:"key,omitempty"` + Value *string `json:"value,omitempty"` + Effect *v1alpha1.TaintEffect `json:"effect,omitempty"` +} + +// TaintApplyConfiguration constructs an declarative configuration of the Taint type for use with +// apply. +func Taint() *TaintApplyConfiguration { + return &TaintApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *TaintApplyConfiguration) WithKey(value string) *TaintApplyConfiguration { + b.Key = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *TaintApplyConfiguration) WithValue(value string) *TaintApplyConfiguration { + b.Value = &value + return b +} + +// WithEffect sets the Effect field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Effect field is set to the value of the last call. +func (b *TaintApplyConfiguration) WithEffect(value v1alpha1.TaintEffect) *TaintApplyConfiguration { + b.Effect = &value + return b +} diff --git a/client-go/applyconfigurations/common/v1alpha1/toleration.go b/client-go/applyconfigurations/common/v1alpha1/toleration.go new file mode 100644 index 000000000..1d0f14a25 --- /dev/null +++ b/client-go/applyconfigurations/common/v1alpha1/toleration.go @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" +) + +// TolerationApplyConfiguration represents an declarative configuration of the Toleration type for use +// with apply. +type TolerationApplyConfiguration struct { + Key *string `json:"key,omitempty"` + Operator *v1alpha1.TolerationOperator `json:"operator,omitempty"` + Value *string `json:"value,omitempty"` + Effect *v1alpha1.TaintEffect `json:"effect,omitempty"` +} + +// TolerationApplyConfiguration constructs an declarative configuration of the Toleration type for use with +// apply. +func Toleration() *TolerationApplyConfiguration { + return &TolerationApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *TolerationApplyConfiguration) WithKey(value string) *TolerationApplyConfiguration { + b.Key = &value + return b +} + +// WithOperator sets the Operator field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Operator field is set to the value of the last call. +func (b *TolerationApplyConfiguration) WithOperator(value v1alpha1.TolerationOperator) *TolerationApplyConfiguration { + b.Operator = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *TolerationApplyConfiguration) WithValue(value string) *TolerationApplyConfiguration { + b.Value = &value + return b +} + +// WithEffect sets the Effect field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Effect field is set to the value of the last call. +func (b *TolerationApplyConfiguration) WithEffect(value v1alpha1.TaintEffect) *TolerationApplyConfiguration { + b.Effect = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/daemonendpoint.go b/client-go/applyconfigurations/compute/v1alpha1/daemonendpoint.go new file mode 100644 index 000000000..54e8ce6e9 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/daemonendpoint.go @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// DaemonEndpointApplyConfiguration represents an declarative configuration of the DaemonEndpoint type for use +// with apply. +type DaemonEndpointApplyConfiguration struct { + Port *int32 `json:"port,omitempty"` +} + +// DaemonEndpointApplyConfiguration constructs an declarative configuration of the DaemonEndpoint type for use with +// apply. +func DaemonEndpoint() *DaemonEndpointApplyConfiguration { + return &DaemonEndpointApplyConfiguration{} +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *DaemonEndpointApplyConfiguration) WithPort(value int32) *DaemonEndpointApplyConfiguration { + b.Port = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/efivar.go b/client-go/applyconfigurations/compute/v1alpha1/efivar.go new file mode 100644 index 000000000..80de34be9 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/efivar.go @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// EFIVarApplyConfiguration represents an declarative configuration of the EFIVar type for use +// with apply. +type EFIVarApplyConfiguration struct { + Name *string `json:"name,omitempty"` + UUID *string `json:"uuid,omitempty"` + Value *string `json:"value,omitempty"` +} + +// EFIVarApplyConfiguration constructs an declarative configuration of the EFIVar type for use with +// apply. +func EFIVar() *EFIVarApplyConfiguration { + return &EFIVarApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *EFIVarApplyConfiguration) WithName(value string) *EFIVarApplyConfiguration { + b.Name = &value + return b +} + +// WithUUID sets the UUID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UUID field is set to the value of the last call. +func (b *EFIVarApplyConfiguration) WithUUID(value string) *EFIVarApplyConfiguration { + b.UUID = &value + return b +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *EFIVarApplyConfiguration) WithValue(value string) *EFIVarApplyConfiguration { + b.Value = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/emptydiskvolumesource.go b/client-go/applyconfigurations/compute/v1alpha1/emptydiskvolumesource.go new file mode 100644 index 000000000..fe0d1102a --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/emptydiskvolumesource.go @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// EmptyDiskVolumeSourceApplyConfiguration represents an declarative configuration of the EmptyDiskVolumeSource type for use +// with apply. +type EmptyDiskVolumeSourceApplyConfiguration struct { + SizeLimit *resource.Quantity `json:"sizeLimit,omitempty"` +} + +// EmptyDiskVolumeSourceApplyConfiguration constructs an declarative configuration of the EmptyDiskVolumeSource type for use with +// apply. +func EmptyDiskVolumeSource() *EmptyDiskVolumeSourceApplyConfiguration { + return &EmptyDiskVolumeSourceApplyConfiguration{} +} + +// WithSizeLimit sets the SizeLimit field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SizeLimit field is set to the value of the last call. +func (b *EmptyDiskVolumeSourceApplyConfiguration) WithSizeLimit(value resource.Quantity) *EmptyDiskVolumeSourceApplyConfiguration { + b.SizeLimit = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/emptydiskvolumestatus.go b/client-go/applyconfigurations/compute/v1alpha1/emptydiskvolumestatus.go new file mode 100644 index 000000000..7067b55ed --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/emptydiskvolumestatus.go @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + resource "k8s.io/apimachinery/pkg/api/resource" +) + +// EmptyDiskVolumeStatusApplyConfiguration represents an declarative configuration of the EmptyDiskVolumeStatus type for use +// with apply. +type EmptyDiskVolumeStatusApplyConfiguration struct { + Size *resource.Quantity `json:"size,omitempty"` +} + +// EmptyDiskVolumeStatusApplyConfiguration constructs an declarative configuration of the EmptyDiskVolumeStatus type for use with +// apply. +func EmptyDiskVolumeStatus() *EmptyDiskVolumeStatusApplyConfiguration { + return &EmptyDiskVolumeStatusApplyConfiguration{} +} + +// WithSize sets the Size field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Size field is set to the value of the last call. +func (b *EmptyDiskVolumeStatusApplyConfiguration) WithSize(value resource.Quantity) *EmptyDiskVolumeStatusApplyConfiguration { + b.Size = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/ephemeralnetworkinterfacesource.go b/client-go/applyconfigurations/compute/v1alpha1/ephemeralnetworkinterfacesource.go new file mode 100644 index 000000000..fb720fcca --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/ephemeralnetworkinterfacesource.go @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" +) + +// EphemeralNetworkInterfaceSourceApplyConfiguration represents an declarative configuration of the EphemeralNetworkInterfaceSource type for use +// with apply. +type EphemeralNetworkInterfaceSourceApplyConfiguration struct { + NetworkInterfaceTemplate *v1alpha1.NetworkInterfaceTemplateSpecApplyConfiguration `json:"networkInterfaceTemplate,omitempty"` +} + +// EphemeralNetworkInterfaceSourceApplyConfiguration constructs an declarative configuration of the EphemeralNetworkInterfaceSource type for use with +// apply. +func EphemeralNetworkInterfaceSource() *EphemeralNetworkInterfaceSourceApplyConfiguration { + return &EphemeralNetworkInterfaceSourceApplyConfiguration{} +} + +// WithNetworkInterfaceTemplate sets the NetworkInterfaceTemplate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkInterfaceTemplate field is set to the value of the last call. +func (b *EphemeralNetworkInterfaceSourceApplyConfiguration) WithNetworkInterfaceTemplate(value *v1alpha1.NetworkInterfaceTemplateSpecApplyConfiguration) *EphemeralNetworkInterfaceSourceApplyConfiguration { + b.NetworkInterfaceTemplate = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/ephemeralvolumesource.go b/client-go/applyconfigurations/compute/v1alpha1/ephemeralvolumesource.go new file mode 100644 index 000000000..0645d52c8 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/ephemeralvolumesource.go @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/storage/v1alpha1" +) + +// EphemeralVolumeSourceApplyConfiguration represents an declarative configuration of the EphemeralVolumeSource type for use +// with apply. +type EphemeralVolumeSourceApplyConfiguration struct { + VolumeTemplate *v1alpha1.VolumeTemplateSpecApplyConfiguration `json:"volumeTemplate,omitempty"` +} + +// EphemeralVolumeSourceApplyConfiguration constructs an declarative configuration of the EphemeralVolumeSource type for use with +// apply. +func EphemeralVolumeSource() *EphemeralVolumeSourceApplyConfiguration { + return &EphemeralVolumeSourceApplyConfiguration{} +} + +// WithVolumeTemplate sets the VolumeTemplate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeTemplate field is set to the value of the last call. +func (b *EphemeralVolumeSourceApplyConfiguration) WithVolumeTemplate(value *v1alpha1.VolumeTemplateSpecApplyConfiguration) *EphemeralVolumeSourceApplyConfiguration { + b.VolumeTemplate = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machine.go b/client-go/applyconfigurations/compute/v1alpha1/machine.go new file mode 100644 index 000000000..ad54361c0 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machine.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + computev1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// MachineApplyConfiguration represents an declarative configuration of the Machine type for use +// with apply. +type MachineApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *MachineSpecApplyConfiguration `json:"spec,omitempty"` + Status *MachineStatusApplyConfiguration `json:"status,omitempty"` +} + +// Machine constructs an declarative configuration of the Machine type for use with +// apply. +func Machine(name, namespace string) *MachineApplyConfiguration { + b := &MachineApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Machine") + b.WithAPIVersion("compute.api.onmetal.de/v1alpha1") + return b +} + +// ExtractMachine extracts the applied configuration owned by fieldManager from +// machine. If no managedFields are found in machine for fieldManager, a +// MachineApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// machine must be a unmodified Machine API object that was retrieved from the Kubernetes API. +// ExtractMachine provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractMachine(machine *computev1alpha1.Machine, fieldManager string) (*MachineApplyConfiguration, error) { + return extractMachine(machine, fieldManager, "") +} + +// ExtractMachineStatus is the same as ExtractMachine except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractMachineStatus(machine *computev1alpha1.Machine, fieldManager string) (*MachineApplyConfiguration, error) { + return extractMachine(machine, fieldManager, "status") +} + +func extractMachine(machine *computev1alpha1.Machine, fieldManager string, subresource string) (*MachineApplyConfiguration, error) { + b := &MachineApplyConfiguration{} + err := managedfields.ExtractInto(machine, internal.Parser().Type("com.github.onmetal.onmetal-api.api.compute.v1alpha1.Machine"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(machine.Name) + b.WithNamespace(machine.Namespace) + + b.WithKind("Machine") + b.WithAPIVersion("compute.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithKind(value string) *MachineApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithAPIVersion(value string) *MachineApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithName(value string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithGenerateName(value string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithNamespace(value string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithUID(value types.UID) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithResourceVersion(value string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithGeneration(value int64) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachineApplyConfiguration) WithLabels(entries map[string]string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachineApplyConfiguration) WithAnnotations(entries map[string]string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MachineApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MachineApplyConfiguration) WithFinalizers(values ...string) *MachineApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *MachineApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithSpec(value *MachineSpecApplyConfiguration) *MachineApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MachineApplyConfiguration) WithStatus(value *MachineStatusApplyConfiguration) *MachineApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machineclass.go b/client-go/applyconfigurations/compute/v1alpha1/machineclass.go new file mode 100644 index 000000000..f02e1e0f3 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machineclass.go @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// MachineClassApplyConfiguration represents an declarative configuration of the MachineClass type for use +// with apply. +type MachineClassApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Capabilities *corev1.ResourceList `json:"capabilities,omitempty"` +} + +// MachineClass constructs an declarative configuration of the MachineClass type for use with +// apply. +func MachineClass(name string) *MachineClassApplyConfiguration { + b := &MachineClassApplyConfiguration{} + b.WithName(name) + b.WithKind("MachineClass") + b.WithAPIVersion("compute.api.onmetal.de/v1alpha1") + return b +} + +// ExtractMachineClass extracts the applied configuration owned by fieldManager from +// machineClass. If no managedFields are found in machineClass for fieldManager, a +// MachineClassApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// machineClass must be a unmodified MachineClass API object that was retrieved from the Kubernetes API. +// ExtractMachineClass provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractMachineClass(machineClass *v1alpha1.MachineClass, fieldManager string) (*MachineClassApplyConfiguration, error) { + return extractMachineClass(machineClass, fieldManager, "") +} + +// ExtractMachineClassStatus is the same as ExtractMachineClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractMachineClassStatus(machineClass *v1alpha1.MachineClass, fieldManager string) (*MachineClassApplyConfiguration, error) { + return extractMachineClass(machineClass, fieldManager, "status") +} + +func extractMachineClass(machineClass *v1alpha1.MachineClass, fieldManager string, subresource string) (*MachineClassApplyConfiguration, error) { + b := &MachineClassApplyConfiguration{} + err := managedfields.ExtractInto(machineClass, internal.Parser().Type("com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachineClass"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(machineClass.Name) + + b.WithKind("MachineClass") + b.WithAPIVersion("compute.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithKind(value string) *MachineClassApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithAPIVersion(value string) *MachineClassApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithName(value string) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithGenerateName(value string) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithNamespace(value string) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithUID(value types.UID) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithResourceVersion(value string) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithGeneration(value int64) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachineClassApplyConfiguration) WithLabels(entries map[string]string) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachineClassApplyConfiguration) WithAnnotations(entries map[string]string) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MachineClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MachineClassApplyConfiguration) WithFinalizers(values ...string) *MachineClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *MachineClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithCapabilities sets the Capabilities field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Capabilities field is set to the value of the last call. +func (b *MachineClassApplyConfiguration) WithCapabilities(value corev1.ResourceList) *MachineClassApplyConfiguration { + b.Capabilities = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinecondition.go b/client-go/applyconfigurations/compute/v1alpha1/machinecondition.go new file mode 100644 index 000000000..c5c03fb33 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machinecondition.go @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// MachineConditionApplyConfiguration represents an declarative configuration of the MachineCondition type for use +// with apply. +type MachineConditionApplyConfiguration struct { + Type *v1alpha1.MachineConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// MachineConditionApplyConfiguration constructs an declarative configuration of the MachineCondition type for use with +// apply. +func MachineCondition() *MachineConditionApplyConfiguration { + return &MachineConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MachineConditionApplyConfiguration) WithType(value v1alpha1.MachineConditionType) *MachineConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MachineConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *MachineConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *MachineConditionApplyConfiguration) WithReason(value string) *MachineConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *MachineConditionApplyConfiguration) WithMessage(value string) *MachineConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *MachineConditionApplyConfiguration) WithObservedGeneration(value int64) *MachineConditionApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *MachineConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *MachineConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinepool.go b/client-go/applyconfigurations/compute/v1alpha1/machinepool.go new file mode 100644 index 000000000..29121c44b --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machinepool.go @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + computev1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// MachinePoolApplyConfiguration represents an declarative configuration of the MachinePool type for use +// with apply. +type MachinePoolApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *MachinePoolSpecApplyConfiguration `json:"spec,omitempty"` + Status *MachinePoolStatusApplyConfiguration `json:"status,omitempty"` +} + +// MachinePool constructs an declarative configuration of the MachinePool type for use with +// apply. +func MachinePool(name string) *MachinePoolApplyConfiguration { + b := &MachinePoolApplyConfiguration{} + b.WithName(name) + b.WithKind("MachinePool") + b.WithAPIVersion("compute.api.onmetal.de/v1alpha1") + return b +} + +// ExtractMachinePool extracts the applied configuration owned by fieldManager from +// machinePool. If no managedFields are found in machinePool for fieldManager, a +// MachinePoolApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// machinePool must be a unmodified MachinePool API object that was retrieved from the Kubernetes API. +// ExtractMachinePool provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractMachinePool(machinePool *computev1alpha1.MachinePool, fieldManager string) (*MachinePoolApplyConfiguration, error) { + return extractMachinePool(machinePool, fieldManager, "") +} + +// ExtractMachinePoolStatus is the same as ExtractMachinePool except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractMachinePoolStatus(machinePool *computev1alpha1.MachinePool, fieldManager string) (*MachinePoolApplyConfiguration, error) { + return extractMachinePool(machinePool, fieldManager, "status") +} + +func extractMachinePool(machinePool *computev1alpha1.MachinePool, fieldManager string, subresource string) (*MachinePoolApplyConfiguration, error) { + b := &MachinePoolApplyConfiguration{} + err := managedfields.ExtractInto(machinePool, internal.Parser().Type("com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePool"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(machinePool.Name) + + b.WithKind("MachinePool") + b.WithAPIVersion("compute.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithKind(value string) *MachinePoolApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithAPIVersion(value string) *MachinePoolApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithName(value string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithGenerateName(value string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithNamespace(value string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithUID(value types.UID) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithResourceVersion(value string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithGeneration(value int64) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithCreationTimestamp(value metav1.Time) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *MachinePoolApplyConfiguration) WithLabels(entries map[string]string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *MachinePoolApplyConfiguration) WithAnnotations(entries map[string]string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *MachinePoolApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *MachinePoolApplyConfiguration) WithFinalizers(values ...string) *MachinePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *MachinePoolApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithSpec(value *MachinePoolSpecApplyConfiguration) *MachinePoolApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MachinePoolApplyConfiguration) WithStatus(value *MachinePoolStatusApplyConfiguration) *MachinePoolApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinepooladdress.go b/client-go/applyconfigurations/compute/v1alpha1/machinepooladdress.go new file mode 100644 index 000000000..6cb8962a1 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machinepooladdress.go @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" +) + +// MachinePoolAddressApplyConfiguration represents an declarative configuration of the MachinePoolAddress type for use +// with apply. +type MachinePoolAddressApplyConfiguration struct { + Type *v1alpha1.MachinePoolAddressType `json:"type,omitempty"` + Address *string `json:"address,omitempty"` +} + +// MachinePoolAddressApplyConfiguration constructs an declarative configuration of the MachinePoolAddress type for use with +// apply. +func MachinePoolAddress() *MachinePoolAddressApplyConfiguration { + return &MachinePoolAddressApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MachinePoolAddressApplyConfiguration) WithType(value v1alpha1.MachinePoolAddressType) *MachinePoolAddressApplyConfiguration { + b.Type = &value + return b +} + +// WithAddress sets the Address field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Address field is set to the value of the last call. +func (b *MachinePoolAddressApplyConfiguration) WithAddress(value string) *MachinePoolAddressApplyConfiguration { + b.Address = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinepoolcondition.go b/client-go/applyconfigurations/compute/v1alpha1/machinepoolcondition.go new file mode 100644 index 000000000..7ef0c6032 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machinepoolcondition.go @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// MachinePoolConditionApplyConfiguration represents an declarative configuration of the MachinePoolCondition type for use +// with apply. +type MachinePoolConditionApplyConfiguration struct { + Type *v1alpha1.MachinePoolConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// MachinePoolConditionApplyConfiguration constructs an declarative configuration of the MachinePoolCondition type for use with +// apply. +func MachinePoolCondition() *MachinePoolConditionApplyConfiguration { + return &MachinePoolConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *MachinePoolConditionApplyConfiguration) WithType(value v1alpha1.MachinePoolConditionType) *MachinePoolConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *MachinePoolConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *MachinePoolConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *MachinePoolConditionApplyConfiguration) WithReason(value string) *MachinePoolConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *MachinePoolConditionApplyConfiguration) WithMessage(value string) *MachinePoolConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *MachinePoolConditionApplyConfiguration) WithObservedGeneration(value int64) *MachinePoolConditionApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *MachinePoolConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *MachinePoolConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinepooldaemonendpoints.go b/client-go/applyconfigurations/compute/v1alpha1/machinepooldaemonendpoints.go new file mode 100644 index 000000000..c736b1e0f --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machinepooldaemonendpoints.go @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// MachinePoolDaemonEndpointsApplyConfiguration represents an declarative configuration of the MachinePoolDaemonEndpoints type for use +// with apply. +type MachinePoolDaemonEndpointsApplyConfiguration struct { + MachinepoolletEndpoint *DaemonEndpointApplyConfiguration `json:"machinepoolletEndpoint,omitempty"` +} + +// MachinePoolDaemonEndpointsApplyConfiguration constructs an declarative configuration of the MachinePoolDaemonEndpoints type for use with +// apply. +func MachinePoolDaemonEndpoints() *MachinePoolDaemonEndpointsApplyConfiguration { + return &MachinePoolDaemonEndpointsApplyConfiguration{} +} + +// WithMachinepoolletEndpoint sets the MachinepoolletEndpoint field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachinepoolletEndpoint field is set to the value of the last call. +func (b *MachinePoolDaemonEndpointsApplyConfiguration) WithMachinepoolletEndpoint(value *DaemonEndpointApplyConfiguration) *MachinePoolDaemonEndpointsApplyConfiguration { + b.MachinepoolletEndpoint = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinepoolspec.go b/client-go/applyconfigurations/compute/v1alpha1/machinepoolspec.go new file mode 100644 index 000000000..eff79da52 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machinepoolspec.go @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" +) + +// MachinePoolSpecApplyConfiguration represents an declarative configuration of the MachinePoolSpec type for use +// with apply. +type MachinePoolSpecApplyConfiguration struct { + ProviderID *string `json:"providerID,omitempty"` + Taints []v1alpha1.TaintApplyConfiguration `json:"taints,omitempty"` +} + +// MachinePoolSpecApplyConfiguration constructs an declarative configuration of the MachinePoolSpec type for use with +// apply. +func MachinePoolSpec() *MachinePoolSpecApplyConfiguration { + return &MachinePoolSpecApplyConfiguration{} +} + +// WithProviderID sets the ProviderID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProviderID field is set to the value of the last call. +func (b *MachinePoolSpecApplyConfiguration) WithProviderID(value string) *MachinePoolSpecApplyConfiguration { + b.ProviderID = &value + return b +} + +// WithTaints adds the given value to the Taints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Taints field. +func (b *MachinePoolSpecApplyConfiguration) WithTaints(values ...*v1alpha1.TaintApplyConfiguration) *MachinePoolSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTaints") + } + b.Taints = append(b.Taints, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinepoolstatus.go b/client-go/applyconfigurations/compute/v1alpha1/machinepoolstatus.go new file mode 100644 index 000000000..bcc79ed06 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machinepoolstatus.go @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + v1 "k8s.io/api/core/v1" +) + +// MachinePoolStatusApplyConfiguration represents an declarative configuration of the MachinePoolStatus type for use +// with apply. +type MachinePoolStatusApplyConfiguration struct { + State *v1alpha1.MachinePoolState `json:"state,omitempty"` + Conditions []MachinePoolConditionApplyConfiguration `json:"conditions,omitempty"` + AvailableMachineClasses []v1.LocalObjectReference `json:"availableMachineClasses,omitempty"` + Addresses []MachinePoolAddressApplyConfiguration `json:"addresses,omitempty"` + DaemonEndpoints *MachinePoolDaemonEndpointsApplyConfiguration `json:"daemonEndpoints,omitempty"` +} + +// MachinePoolStatusApplyConfiguration constructs an declarative configuration of the MachinePoolStatus type for use with +// apply. +func MachinePoolStatus() *MachinePoolStatusApplyConfiguration { + return &MachinePoolStatusApplyConfiguration{} +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithState(value v1alpha1.MachinePoolState) *MachinePoolStatusApplyConfiguration { + b.State = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *MachinePoolStatusApplyConfiguration) WithConditions(values ...*MachinePoolConditionApplyConfiguration) *MachinePoolStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAvailableMachineClasses adds the given value to the AvailableMachineClasses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AvailableMachineClasses field. +func (b *MachinePoolStatusApplyConfiguration) WithAvailableMachineClasses(values ...v1.LocalObjectReference) *MachinePoolStatusApplyConfiguration { + for i := range values { + b.AvailableMachineClasses = append(b.AvailableMachineClasses, values[i]) + } + return b +} + +// WithAddresses adds the given value to the Addresses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Addresses field. +func (b *MachinePoolStatusApplyConfiguration) WithAddresses(values ...*MachinePoolAddressApplyConfiguration) *MachinePoolStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithAddresses") + } + b.Addresses = append(b.Addresses, *values[i]) + } + return b +} + +// WithDaemonEndpoints sets the DaemonEndpoints field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DaemonEndpoints field is set to the value of the last call. +func (b *MachinePoolStatusApplyConfiguration) WithDaemonEndpoints(value *MachinePoolDaemonEndpointsApplyConfiguration) *MachinePoolStatusApplyConfiguration { + b.DaemonEndpoints = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinespec.go b/client-go/applyconfigurations/compute/v1alpha1/machinespec.go new file mode 100644 index 000000000..57b2c908c --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machinespec.go @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + commonv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" + v1 "k8s.io/api/core/v1" +) + +// MachineSpecApplyConfiguration represents an declarative configuration of the MachineSpec type for use +// with apply. +type MachineSpecApplyConfiguration struct { + MachineClassRef *v1.LocalObjectReference `json:"machineClassRef,omitempty"` + MachinePoolSelector map[string]string `json:"machinePoolSelector,omitempty"` + MachinePoolRef *v1.LocalObjectReference `json:"machinePoolRef,omitempty"` + Image *string `json:"image,omitempty"` + ImagePullSecretRef *v1.LocalObjectReference `json:"imagePullSecret,omitempty"` + NetworkInterfaces []NetworkInterfaceApplyConfiguration `json:"networkInterfaces,omitempty"` + Volumes []VolumeApplyConfiguration `json:"volumes,omitempty"` + IgnitionRef *commonv1alpha1.SecretKeySelectorApplyConfiguration `json:"ignitionRef,omitempty"` + EFIVars []EFIVarApplyConfiguration `json:"efiVars,omitempty"` + Tolerations []commonv1alpha1.TolerationApplyConfiguration `json:"tolerations,omitempty"` +} + +// MachineSpecApplyConfiguration constructs an declarative configuration of the MachineSpec type for use with +// apply. +func MachineSpec() *MachineSpecApplyConfiguration { + return &MachineSpecApplyConfiguration{} +} + +// WithMachineClassRef sets the MachineClassRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineClassRef field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithMachineClassRef(value v1.LocalObjectReference) *MachineSpecApplyConfiguration { + b.MachineClassRef = &value + return b +} + +// WithMachinePoolSelector puts the entries into the MachinePoolSelector field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the MachinePoolSelector field, +// overwriting an existing map entries in MachinePoolSelector field with the same key. +func (b *MachineSpecApplyConfiguration) WithMachinePoolSelector(entries map[string]string) *MachineSpecApplyConfiguration { + if b.MachinePoolSelector == nil && len(entries) > 0 { + b.MachinePoolSelector = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.MachinePoolSelector[k] = v + } + return b +} + +// WithMachinePoolRef sets the MachinePoolRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachinePoolRef field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithMachinePoolRef(value v1.LocalObjectReference) *MachineSpecApplyConfiguration { + b.MachinePoolRef = &value + return b +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithImage(value string) *MachineSpecApplyConfiguration { + b.Image = &value + return b +} + +// WithImagePullSecretRef sets the ImagePullSecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImagePullSecretRef field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithImagePullSecretRef(value v1.LocalObjectReference) *MachineSpecApplyConfiguration { + b.ImagePullSecretRef = &value + return b +} + +// WithNetworkInterfaces adds the given value to the NetworkInterfaces field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the NetworkInterfaces field. +func (b *MachineSpecApplyConfiguration) WithNetworkInterfaces(values ...*NetworkInterfaceApplyConfiguration) *MachineSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithNetworkInterfaces") + } + b.NetworkInterfaces = append(b.NetworkInterfaces, *values[i]) + } + return b +} + +// WithVolumes adds the given value to the Volumes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Volumes field. +func (b *MachineSpecApplyConfiguration) WithVolumes(values ...*VolumeApplyConfiguration) *MachineSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumes") + } + b.Volumes = append(b.Volumes, *values[i]) + } + return b +} + +// WithIgnitionRef sets the IgnitionRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IgnitionRef field is set to the value of the last call. +func (b *MachineSpecApplyConfiguration) WithIgnitionRef(value *commonv1alpha1.SecretKeySelectorApplyConfiguration) *MachineSpecApplyConfiguration { + b.IgnitionRef = value + return b +} + +// WithEFIVars adds the given value to the EFIVars field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the EFIVars field. +func (b *MachineSpecApplyConfiguration) WithEFIVars(values ...*EFIVarApplyConfiguration) *MachineSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithEFIVars") + } + b.EFIVars = append(b.EFIVars, *values[i]) + } + return b +} + +// WithTolerations adds the given value to the Tolerations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Tolerations field. +func (b *MachineSpecApplyConfiguration) WithTolerations(values ...*commonv1alpha1.TolerationApplyConfiguration) *MachineSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTolerations") + } + b.Tolerations = append(b.Tolerations, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/machinestatus.go b/client-go/applyconfigurations/compute/v1alpha1/machinestatus.go new file mode 100644 index 000000000..522148aa6 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/machinestatus.go @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" +) + +// MachineStatusApplyConfiguration represents an declarative configuration of the MachineStatus type for use +// with apply. +type MachineStatusApplyConfiguration struct { + State *v1alpha1.MachineState `json:"state,omitempty"` + Conditions []MachineConditionApplyConfiguration `json:"conditions,omitempty"` + NetworkInterfaces []NetworkInterfaceStatusApplyConfiguration `json:"networkInterfaces,omitempty"` + Volumes []VolumeStatusApplyConfiguration `json:"volumes,omitempty"` +} + +// MachineStatusApplyConfiguration constructs an declarative configuration of the MachineStatus type for use with +// apply. +func MachineStatus() *MachineStatusApplyConfiguration { + return &MachineStatusApplyConfiguration{} +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *MachineStatusApplyConfiguration) WithState(value v1alpha1.MachineState) *MachineStatusApplyConfiguration { + b.State = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *MachineStatusApplyConfiguration) WithConditions(values ...*MachineConditionApplyConfiguration) *MachineStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithNetworkInterfaces adds the given value to the NetworkInterfaces field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the NetworkInterfaces field. +func (b *MachineStatusApplyConfiguration) WithNetworkInterfaces(values ...*NetworkInterfaceStatusApplyConfiguration) *MachineStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithNetworkInterfaces") + } + b.NetworkInterfaces = append(b.NetworkInterfaces, *values[i]) + } + return b +} + +// WithVolumes adds the given value to the Volumes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Volumes field. +func (b *MachineStatusApplyConfiguration) WithVolumes(values ...*VolumeStatusApplyConfiguration) *MachineStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithVolumes") + } + b.Volumes = append(b.Volumes, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/networkinterface.go b/client-go/applyconfigurations/compute/v1alpha1/networkinterface.go new file mode 100644 index 000000000..ddd8cb0a3 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/networkinterface.go @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// NetworkInterfaceApplyConfiguration represents an declarative configuration of the NetworkInterface type for use +// with apply. +type NetworkInterfaceApplyConfiguration struct { + Name *string `json:"name,omitempty"` + NetworkInterfaceSourceApplyConfiguration `json:",inline"` +} + +// NetworkInterfaceApplyConfiguration constructs an declarative configuration of the NetworkInterface type for use with +// apply. +func NetworkInterface() *NetworkInterfaceApplyConfiguration { + return &NetworkInterfaceApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithName(value string) *NetworkInterfaceApplyConfiguration { + b.Name = &value + return b +} + +// WithNetworkInterfaceRef sets the NetworkInterfaceRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkInterfaceRef field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithNetworkInterfaceRef(value v1.LocalObjectReference) *NetworkInterfaceApplyConfiguration { + b.NetworkInterfaceRef = &value + return b +} + +// WithEphemeral sets the Ephemeral field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ephemeral field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithEphemeral(value *EphemeralNetworkInterfaceSourceApplyConfiguration) *NetworkInterfaceApplyConfiguration { + b.Ephemeral = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/networkinterfacesource.go b/client-go/applyconfigurations/compute/v1alpha1/networkinterfacesource.go new file mode 100644 index 000000000..412b7bb18 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/networkinterfacesource.go @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// NetworkInterfaceSourceApplyConfiguration represents an declarative configuration of the NetworkInterfaceSource type for use +// with apply. +type NetworkInterfaceSourceApplyConfiguration struct { + NetworkInterfaceRef *v1.LocalObjectReference `json:"networkInterfaceRef,omitempty"` + Ephemeral *EphemeralNetworkInterfaceSourceApplyConfiguration `json:"ephemeral,omitempty"` +} + +// NetworkInterfaceSourceApplyConfiguration constructs an declarative configuration of the NetworkInterfaceSource type for use with +// apply. +func NetworkInterfaceSource() *NetworkInterfaceSourceApplyConfiguration { + return &NetworkInterfaceSourceApplyConfiguration{} +} + +// WithNetworkInterfaceRef sets the NetworkInterfaceRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkInterfaceRef field is set to the value of the last call. +func (b *NetworkInterfaceSourceApplyConfiguration) WithNetworkInterfaceRef(value v1.LocalObjectReference) *NetworkInterfaceSourceApplyConfiguration { + b.NetworkInterfaceRef = &value + return b +} + +// WithEphemeral sets the Ephemeral field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ephemeral field is set to the value of the last call. +func (b *NetworkInterfaceSourceApplyConfiguration) WithEphemeral(value *EphemeralNetworkInterfaceSourceApplyConfiguration) *NetworkInterfaceSourceApplyConfiguration { + b.Ephemeral = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/networkinterfacestatus.go b/client-go/applyconfigurations/compute/v1alpha1/networkinterfacestatus.go new file mode 100644 index 000000000..5cfa78964 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/networkinterfacestatus.go @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" + computev1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NetworkInterfaceStatusApplyConfiguration represents an declarative configuration of the NetworkInterfaceStatus type for use +// with apply. +type NetworkInterfaceStatusApplyConfiguration struct { + Name *string `json:"name,omitempty"` + NetworkHandle *string `json:"networkHandle,omitempty"` + IPs []v1alpha1.IP `json:"ips,omitempty"` + VirtualIP *v1alpha1.IP `json:"virtualIP,omitempty"` + State *computev1alpha1.NetworkInterfaceState `json:"state,omitempty"` + LastStateTransitionTime *v1.Time `json:"lastStateTransitionTime,omitempty"` + Phase *computev1alpha1.NetworkInterfacePhase `json:"phase,omitempty"` + LastPhaseTransitionTime *v1.Time `json:"lastPhaseTransitionTime,omitempty"` +} + +// NetworkInterfaceStatusApplyConfiguration constructs an declarative configuration of the NetworkInterfaceStatus type for use with +// apply. +func NetworkInterfaceStatus() *NetworkInterfaceStatusApplyConfiguration { + return &NetworkInterfaceStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithName(value string) *NetworkInterfaceStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithNetworkHandle sets the NetworkHandle field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkHandle field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithNetworkHandle(value string) *NetworkInterfaceStatusApplyConfiguration { + b.NetworkHandle = &value + return b +} + +// WithIPs adds the given value to the IPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPs field. +func (b *NetworkInterfaceStatusApplyConfiguration) WithIPs(values ...v1alpha1.IP) *NetworkInterfaceStatusApplyConfiguration { + for i := range values { + b.IPs = append(b.IPs, values[i]) + } + return b +} + +// WithVirtualIP sets the VirtualIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VirtualIP field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithVirtualIP(value v1alpha1.IP) *NetworkInterfaceStatusApplyConfiguration { + b.VirtualIP = &value + return b +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithState(value computev1alpha1.NetworkInterfaceState) *NetworkInterfaceStatusApplyConfiguration { + b.State = &value + return b +} + +// WithLastStateTransitionTime sets the LastStateTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastStateTransitionTime field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithLastStateTransitionTime(value v1.Time) *NetworkInterfaceStatusApplyConfiguration { + b.LastStateTransitionTime = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithPhase(value computev1alpha1.NetworkInterfacePhase) *NetworkInterfaceStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithLastPhaseTransitionTime sets the LastPhaseTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastPhaseTransitionTime field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithLastPhaseTransitionTime(value v1.Time) *NetworkInterfaceStatusApplyConfiguration { + b.LastPhaseTransitionTime = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/referencedvolumestatus.go b/client-go/applyconfigurations/compute/v1alpha1/referencedvolumestatus.go new file mode 100644 index 000000000..ce730f401 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/referencedvolumestatus.go @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// ReferencedVolumeStatusApplyConfiguration represents an declarative configuration of the ReferencedVolumeStatus type for use +// with apply. +type ReferencedVolumeStatusApplyConfiguration struct { + Driver *string `json:"driver,omitempty"` + Handle *string `json:"handle,omitempty"` +} + +// ReferencedVolumeStatusApplyConfiguration constructs an declarative configuration of the ReferencedVolumeStatus type for use with +// apply. +func ReferencedVolumeStatus() *ReferencedVolumeStatusApplyConfiguration { + return &ReferencedVolumeStatusApplyConfiguration{} +} + +// WithDriver sets the Driver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Driver field is set to the value of the last call. +func (b *ReferencedVolumeStatusApplyConfiguration) WithDriver(value string) *ReferencedVolumeStatusApplyConfiguration { + b.Driver = &value + return b +} + +// WithHandle sets the Handle field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Handle field is set to the value of the last call. +func (b *ReferencedVolumeStatusApplyConfiguration) WithHandle(value string) *ReferencedVolumeStatusApplyConfiguration { + b.Handle = &value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/volume.go b/client-go/applyconfigurations/compute/v1alpha1/volume.go new file mode 100644 index 000000000..0da84ce98 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/volume.go @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// VolumeApplyConfiguration represents an declarative configuration of the Volume type for use +// with apply. +type VolumeApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Device *string `json:"device,omitempty"` + VolumeSourceApplyConfiguration `json:",inline"` +} + +// VolumeApplyConfiguration constructs an declarative configuration of the Volume type for use with +// apply. +func Volume() *VolumeApplyConfiguration { + return &VolumeApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithName(value string) *VolumeApplyConfiguration { + b.Name = &value + return b +} + +// WithDevice sets the Device field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Device field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithDevice(value string) *VolumeApplyConfiguration { + b.Device = &value + return b +} + +// WithVolumeRef sets the VolumeRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeRef field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithVolumeRef(value v1.LocalObjectReference) *VolumeApplyConfiguration { + b.VolumeRef = &value + return b +} + +// WithEmptyDisk sets the EmptyDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EmptyDisk field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithEmptyDisk(value *EmptyDiskVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.EmptyDisk = value + return b +} + +// WithEphemeral sets the Ephemeral field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ephemeral field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithEphemeral(value *EphemeralVolumeSourceApplyConfiguration) *VolumeApplyConfiguration { + b.Ephemeral = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/volumesource.go b/client-go/applyconfigurations/compute/v1alpha1/volumesource.go new file mode 100644 index 000000000..f47153e8e --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/volumesource.go @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// VolumeSourceApplyConfiguration represents an declarative configuration of the VolumeSource type for use +// with apply. +type VolumeSourceApplyConfiguration struct { + VolumeRef *v1.LocalObjectReference `json:"volumeRef,omitempty"` + EmptyDisk *EmptyDiskVolumeSourceApplyConfiguration `json:"emptyDisk,omitempty"` + Ephemeral *EphemeralVolumeSourceApplyConfiguration `json:"ephemeral,omitempty"` +} + +// VolumeSourceApplyConfiguration constructs an declarative configuration of the VolumeSource type for use with +// apply. +func VolumeSource() *VolumeSourceApplyConfiguration { + return &VolumeSourceApplyConfiguration{} +} + +// WithVolumeRef sets the VolumeRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeRef field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithVolumeRef(value v1.LocalObjectReference) *VolumeSourceApplyConfiguration { + b.VolumeRef = &value + return b +} + +// WithEmptyDisk sets the EmptyDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EmptyDisk field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithEmptyDisk(value *EmptyDiskVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.EmptyDisk = value + return b +} + +// WithEphemeral sets the Ephemeral field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ephemeral field is set to the value of the last call. +func (b *VolumeSourceApplyConfiguration) WithEphemeral(value *EphemeralVolumeSourceApplyConfiguration) *VolumeSourceApplyConfiguration { + b.Ephemeral = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/volumesourcestatus.go b/client-go/applyconfigurations/compute/v1alpha1/volumesourcestatus.go new file mode 100644 index 000000000..be4d424a8 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/volumesourcestatus.go @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// VolumeSourceStatusApplyConfiguration represents an declarative configuration of the VolumeSourceStatus type for use +// with apply. +type VolumeSourceStatusApplyConfiguration struct { + EmptyDisk *EmptyDiskVolumeStatusApplyConfiguration `json:"emptyDisk,omitempty"` + Referenced *ReferencedVolumeStatusApplyConfiguration `json:"referenced,omitempty"` +} + +// VolumeSourceStatusApplyConfiguration constructs an declarative configuration of the VolumeSourceStatus type for use with +// apply. +func VolumeSourceStatus() *VolumeSourceStatusApplyConfiguration { + return &VolumeSourceStatusApplyConfiguration{} +} + +// WithEmptyDisk sets the EmptyDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EmptyDisk field is set to the value of the last call. +func (b *VolumeSourceStatusApplyConfiguration) WithEmptyDisk(value *EmptyDiskVolumeStatusApplyConfiguration) *VolumeSourceStatusApplyConfiguration { + b.EmptyDisk = value + return b +} + +// WithReferenced sets the Referenced field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Referenced field is set to the value of the last call. +func (b *VolumeSourceStatusApplyConfiguration) WithReferenced(value *ReferencedVolumeStatusApplyConfiguration) *VolumeSourceStatusApplyConfiguration { + b.Referenced = value + return b +} diff --git a/client-go/applyconfigurations/compute/v1alpha1/volumestatus.go b/client-go/applyconfigurations/compute/v1alpha1/volumestatus.go new file mode 100644 index 000000000..ad58dc940 --- /dev/null +++ b/client-go/applyconfigurations/compute/v1alpha1/volumestatus.go @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + computev1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VolumeStatusApplyConfiguration represents an declarative configuration of the VolumeStatus type for use +// with apply. +type VolumeStatusApplyConfiguration struct { + Name *string `json:"name,omitempty"` + Device *string `json:"device,omitempty"` + VolumeSourceStatusApplyConfiguration `json:",omitempty,inline"` + State *computev1alpha1.VolumeState `json:"state,omitempty"` + LastStateTransitionTime *v1.Time `json:"lastStateTransitionTime,omitempty"` + Phase *computev1alpha1.VolumePhase `json:"phase,omitempty"` + LastPhaseTransitionTime *v1.Time `json:"lastPhaseTransitionTime,omitempty"` +} + +// VolumeStatusApplyConfiguration constructs an declarative configuration of the VolumeStatus type for use with +// apply. +func VolumeStatus() *VolumeStatusApplyConfiguration { + return &VolumeStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithName(value string) *VolumeStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithDevice sets the Device field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Device field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithDevice(value string) *VolumeStatusApplyConfiguration { + b.Device = &value + return b +} + +// WithEmptyDisk sets the EmptyDisk field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EmptyDisk field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithEmptyDisk(value *EmptyDiskVolumeStatusApplyConfiguration) *VolumeStatusApplyConfiguration { + b.EmptyDisk = value + return b +} + +// WithReferenced sets the Referenced field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Referenced field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithReferenced(value *ReferencedVolumeStatusApplyConfiguration) *VolumeStatusApplyConfiguration { + b.Referenced = value + return b +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithState(value computev1alpha1.VolumeState) *VolumeStatusApplyConfiguration { + b.State = &value + return b +} + +// WithLastStateTransitionTime sets the LastStateTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastStateTransitionTime field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithLastStateTransitionTime(value v1.Time) *VolumeStatusApplyConfiguration { + b.LastStateTransitionTime = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithPhase(value computev1alpha1.VolumePhase) *VolumeStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithLastPhaseTransitionTime sets the LastPhaseTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastPhaseTransitionTime field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithLastPhaseTransitionTime(value v1.Time) *VolumeStatusApplyConfiguration { + b.LastPhaseTransitionTime = &value + return b +} diff --git a/client-go/applyconfigurations/internal/internal.go b/client-go/applyconfigurations/internal/internal.go new file mode 100644 index 000000000..f68b64ef7 --- /dev/null +++ b/client-go/applyconfigurations/internal/internal.go @@ -0,0 +1,1537 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package internal + +import ( + "fmt" + "sync" + + typed "sigs.k8s.io/structured-merge-diff/v4/typed" +) + +func Parser() *typed.Parser { + parserOnce.Do(func() { + var err error + parser, err = typed.NewParser(schemaYAML) + if err != nil { + panic(fmt.Sprintf("Failed to parse schema: %v", err)) + } + }) + return parser +} + +var parserOnce sync.Once +var parser *typed.Parser +var schemaYAML = typed.YAMLObject(`types: +- name: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP + scalar: untyped +- name: com.github.onmetal.onmetal-api.api.common.v1alpha1.IPPrefix + scalar: untyped +- name: com.github.onmetal.onmetal-api.api.common.v1alpha1.LocalUIDReference + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: uid + type: + scalar: string + default: "" + elementRelationship: atomic +- name: com.github.onmetal.onmetal-api.api.common.v1alpha1.SecretKeySelector + map: + fields: + - name: key + type: + scalar: string + - name: name + type: + scalar: string + elementRelationship: atomic +- name: com.github.onmetal.onmetal-api.api.common.v1alpha1.Taint + map: + fields: + - name: effect + type: + scalar: string + default: "" + - name: key + type: + scalar: string + default: "" + - name: value + type: + scalar: string +- name: com.github.onmetal.onmetal-api.api.common.v1alpha1.Toleration + map: + fields: + - name: effect + type: + scalar: string + - name: key + type: + scalar: string + - name: operator + type: + scalar: string + - name: value + type: + scalar: string +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.DaemonEndpoint + map: + fields: + - name: port + type: + scalar: numeric + default: 0 +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EFIVar + map: + fields: + - name: name + type: + scalar: string + default: "" + - name: uuid + type: + scalar: string + default: "" + - name: value + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EmptyDiskVolumeSource + map: + fields: + - name: sizeLimit + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EmptyDiskVolumeStatus + map: + fields: + - name: size + type: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EphemeralNetworkInterfaceSource + map: + fields: + - name: networkInterfaceTemplate + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkInterfaceTemplateSpec +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EphemeralVolumeSource + map: + fields: + - name: volumeTemplate + type: + namedType: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeTemplateSpec +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.Machine + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachineSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachineStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachineClass + map: + fields: + - name: apiVersion + type: + scalar: string + - name: capabilities + type: + map: + elementType: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachineCondition + map: + fields: + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + default: {} + - name: message + type: + scalar: string + - name: observedGeneration + type: + scalar: numeric + - name: reason + type: + scalar: string + - name: status + type: + scalar: string + default: "" + - name: type + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePool + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolAddress + map: + fields: + - name: address + type: + scalar: string + default: "" + - name: type + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolCondition + map: + fields: + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + default: {} + - name: message + type: + scalar: string + default: "" + - name: observedGeneration + type: + scalar: numeric + - name: reason + type: + scalar: string + default: "" + - name: status + type: + scalar: string + default: "" + - name: type + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolDaemonEndpoints + map: + fields: + - name: machinepoolletEndpoint + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.DaemonEndpoint + default: {} +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolSpec + map: + fields: + - name: providerID + type: + scalar: string + default: "" + - name: taints + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.Taint + elementRelationship: atomic +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolStatus + map: + fields: + - name: addresses + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolAddress + elementRelationship: atomic + - name: availableMachineClasses + type: + list: + elementType: + namedType: io.k8s.api.core.v1.LocalObjectReference + elementRelationship: atomic + - name: conditions + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolCondition + elementRelationship: atomic + - name: daemonEndpoints + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachinePoolDaemonEndpoints + default: {} + - name: state + type: + scalar: string +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachineSpec + map: + fields: + - name: efiVars + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EFIVar + elementRelationship: associative + keys: + - name + - name: ignitionRef + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.SecretKeySelector + - name: image + type: + scalar: string + - name: imagePullSecret + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + - name: machineClassRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + default: {} + - name: machinePoolRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + - name: machinePoolSelector + type: + map: + elementType: + scalar: string + - name: networkInterfaces + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.NetworkInterface + elementRelationship: associative + keys: + - name + - name: tolerations + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.Toleration + elementRelationship: atomic + - name: volumes + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.Volume + elementRelationship: associative + keys: + - name +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachineStatus + map: + fields: + - name: conditions + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.MachineCondition + elementRelationship: atomic + - name: networkInterfaces + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.NetworkInterfaceStatus + elementRelationship: atomic + - name: state + type: + scalar: string + - name: volumes + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.VolumeStatus + elementRelationship: atomic +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.NetworkInterface + map: + fields: + - name: ephemeral + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EphemeralNetworkInterfaceSource + - name: name + type: + scalar: string + default: "" + - name: networkInterfaceRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.NetworkInterfaceStatus + map: + fields: + - name: ips + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP + elementRelationship: atomic + - name: lastPhaseTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: lastStateTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: name + type: + scalar: string + default: "" + - name: networkHandle + type: + scalar: string + - name: phase + type: + scalar: string + - name: state + type: + scalar: string + - name: virtualIP + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.ReferencedVolumeStatus + map: + fields: + - name: driver + type: + scalar: string + - name: handle + type: + scalar: string +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.Volume + map: + fields: + - name: device + type: + scalar: string + - name: emptyDisk + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EmptyDiskVolumeSource + - name: ephemeral + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EphemeralVolumeSource + - name: name + type: + scalar: string + default: "" + - name: volumeRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference +- name: com.github.onmetal.onmetal-api.api.compute.v1alpha1.VolumeStatus + map: + fields: + - name: device + type: + scalar: string + - name: emptyDisk + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.EmptyDiskVolumeStatus + - name: lastPhaseTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: lastStateTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: name + type: + scalar: string + default: "" + - name: phase + type: + scalar: string + - name: referenced + type: + namedType: com.github.onmetal.onmetal-api.api.compute.v1alpha1.ReferencedVolumeStatus + - name: state + type: + scalar: string +- name: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.Prefix + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixAllocation + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixAllocationSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixAllocationStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixAllocationSpec + map: + fields: + - name: ipFamily + type: + scalar: string + - name: prefix + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IPPrefix + - name: prefixLength + type: + scalar: numeric + - name: prefixRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + - name: prefixSelector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector +- name: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixAllocationStatus + map: + fields: + - name: lastPhaseTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: phase + type: + scalar: string + - name: prefix + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IPPrefix +- name: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixSpec + map: + fields: + - name: ipFamily + type: + scalar: string + - name: parentRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + - name: parentSelector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: prefix + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IPPrefix + - name: prefixLength + type: + scalar: numeric +- name: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixStatus + map: + fields: + - name: lastPhaseTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: phase + type: + scalar: string + - name: used + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IPPrefix + elementRelationship: atomic +- name: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixTemplateSpec + map: + fields: + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixSpec + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.AliasPrefix + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.AliasPrefixSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.AliasPrefixStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.AliasPrefixRouting + map: + fields: + - name: apiVersion + type: + scalar: string + - name: destinations + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.LocalUIDReference + elementRelationship: atomic + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.AliasPrefixSpec + map: + fields: + - name: networkInterfaceSelector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: networkRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + default: {} + - name: prefix + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.PrefixSource + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.AliasPrefixStatus + map: + fields: + - name: prefix + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IPPrefix +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.EphemeralPrefixSource + map: + fields: + - name: prefixTemplate + type: + namedType: com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixTemplateSpec +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.EphemeralVirtualIPSource + map: + fields: + - name: virtualIPTemplate + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIPTemplateSpec +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.IPSource + map: + fields: + - name: ephemeral + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.EphemeralPrefixSource + - name: value + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancer + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancerSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancerStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancerPort + map: + fields: + - name: endPort + type: + scalar: numeric + - name: port + type: + scalar: numeric + default: 0 + - name: protocol + type: + scalar: string +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancerRouting + map: + fields: + - name: apiVersion + type: + scalar: string + - name: destinations + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.LocalUIDReference + elementRelationship: atomic + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: networkRef + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.LocalUIDReference + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancerSpec + map: + fields: + - name: ipFamilies + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: networkInterfaceSelector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: networkRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + default: {} + - name: ports + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancerPort + elementRelationship: atomic + - name: type + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancerStatus + map: + fields: + - name: ips + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP + elementRelationship: atomic +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGateway + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewaySpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayDestination + map: + fields: + - name: ips + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayDestinationIP + elementRelationship: atomic + - name: name + type: + scalar: string + default: "" + - name: uid + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayDestinationIP + map: + fields: + - name: endPort + type: + scalar: numeric + default: 0 + - name: ip + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP + default: {} + - name: port + type: + scalar: numeric + default: 0 +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayIP + map: + fields: + - name: name + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayIPStatus + map: + fields: + - name: ip + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP + default: {} + - name: name + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayRouting + map: + fields: + - name: apiVersion + type: + scalar: string + - name: destinations + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayDestination + elementRelationship: atomic + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: networkRef + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.LocalUIDReference + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewaySpec + map: + fields: + - name: ipFamilies + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: ips + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayIP + elementRelationship: associative + keys: + - name + - name: networkInterfaceSelector + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + - name: networkRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + default: {} + - name: portsPerNetworkInterface + type: + scalar: numeric + - name: type + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayStatus + map: + fields: + - name: ips + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayIPStatus + elementRelationship: atomic + - name: portsUsed + type: + scalar: numeric +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.Network + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkInterface + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkInterfaceSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkInterfaceStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkInterfaceSpec + map: + fields: + - name: ipFamilies + type: + list: + elementType: + scalar: string + elementRelationship: atomic + - name: ips + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.IPSource + elementRelationship: atomic + - name: machineRef + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.LocalUIDReference + - name: networkRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + default: {} + - name: virtualIP + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIPSource +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkInterfaceStatus + map: + fields: + - name: ips + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP + elementRelationship: atomic + - name: networkHandle + type: + scalar: string + - name: phase + type: + scalar: string + - name: phaseLastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: virtualIP + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkInterfaceTemplateSpec + map: + fields: + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkInterfaceSpec + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkSpec + map: + fields: + - name: providerID + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkStatus + map: + fields: + - name: state + type: + scalar: string +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.PrefixSource + map: + fields: + - name: ephemeral + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.EphemeralPrefixSource + - name: value + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IPPrefix +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIP + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIPSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIPStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIPSource + map: + fields: + - name: ephemeral + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.EphemeralVirtualIPSource + - name: virtualIPRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIPSpec + map: + fields: + - name: ipFamily + type: + scalar: string + default: "" + - name: targetRef + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.LocalUIDReference + - name: type + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIPStatus + map: + fields: + - name: ip + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.IP + - name: phase + type: + scalar: string + - name: phaseLastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time +- name: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIPTemplateSpec + map: + fields: + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIPSpec + default: {} +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.Volume + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeAccess + map: + fields: + - name: driver + type: + scalar: string + default: "" + - name: handle + type: + scalar: string + default: "" + - name: secretRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + - name: volumeAttributes + type: + map: + elementType: + scalar: string +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeClass + map: + fields: + - name: apiVersion + type: + scalar: string + - name: capabilities + type: + map: + elementType: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeCondition + map: + fields: + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + default: {} + - name: message + type: + scalar: string + - name: observedGeneration + type: + scalar: numeric + - name: reason + type: + scalar: string + - name: status + type: + scalar: string + default: "" + - name: type + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumePool + map: + fields: + - name: apiVersion + type: + scalar: string + - name: kind + type: + scalar: string + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumePoolSpec + default: {} + - name: status + type: + namedType: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumePoolStatus + default: {} +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumePoolCondition + map: + fields: + - name: lastTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + default: {} + - name: message + type: + scalar: string + default: "" + - name: observedGeneration + type: + scalar: numeric + - name: reason + type: + scalar: string + default: "" + - name: status + type: + scalar: string + default: "" + - name: type + type: + scalar: string + default: "" +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumePoolSpec + map: + fields: + - name: providerID + type: + scalar: string + default: "" + - name: taints + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.Taint + elementRelationship: atomic +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumePoolStatus + map: + fields: + - name: available + type: + map: + elementType: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: availableVolumeClasses + type: + list: + elementType: + namedType: io.k8s.api.core.v1.LocalObjectReference + elementRelationship: atomic + - name: conditions + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumePoolCondition + elementRelationship: atomic + - name: state + type: + scalar: string + - name: used + type: + map: + elementType: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeSpec + map: + fields: + - name: claimRef + type: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.LocalUIDReference + - name: image + type: + scalar: string + - name: imagePullSecretRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + - name: resources + type: + map: + elementType: + namedType: io.k8s.apimachinery.pkg.api.resource.Quantity + - name: tolerations + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.common.v1alpha1.Toleration + elementRelationship: atomic + - name: unclaimable + type: + scalar: boolean + - name: volumeClassRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + - name: volumePoolRef + type: + namedType: io.k8s.api.core.v1.LocalObjectReference + - name: volumePoolSelector + type: + map: + elementType: + scalar: string +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeStatus + map: + fields: + - name: access + type: + namedType: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeAccess + - name: conditions + type: + list: + elementType: + namedType: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeCondition + elementRelationship: atomic + - name: lastPhaseTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: lastStateTransitionTime + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: phase + type: + scalar: string + - name: state + type: + scalar: string +- name: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeTemplateSpec + map: + fields: + - name: metadata + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + default: {} + - name: spec + type: + namedType: com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeSpec + default: {} +- name: io.k8s.api.core.v1.LocalObjectReference + map: + fields: + - name: name + type: + scalar: string + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.api.resource.Quantity + scalar: untyped +- name: io.k8s.apimachinery.pkg.apis.meta.v1.FieldsV1 + map: + elementType: + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +- name: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelector + map: + fields: + - name: matchExpressions + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement + elementRelationship: atomic + - name: matchLabels + type: + map: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.LabelSelectorRequirement + map: + fields: + - name: key + type: + scalar: string + default: "" + - name: operator + type: + scalar: string + default: "" + - name: values + type: + list: + elementType: + scalar: string + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + map: + fields: + - name: apiVersion + type: + scalar: string + - name: fieldsType + type: + scalar: string + - name: fieldsV1 + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.FieldsV1 + - name: manager + type: + scalar: string + - name: operation + type: + scalar: string + - name: subresource + type: + scalar: string + - name: time + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time +- name: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta + map: + fields: + - name: annotations + type: + map: + elementType: + scalar: string + - name: clusterName + type: + scalar: string + - name: creationTimestamp + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + default: {} + - name: deletionGracePeriodSeconds + type: + scalar: numeric + - name: deletionTimestamp + type: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Time + - name: finalizers + type: + list: + elementType: + scalar: string + elementRelationship: associative + - name: generateName + type: + scalar: string + - name: generation + type: + scalar: numeric + - name: labels + type: + map: + elementType: + scalar: string + - name: managedFields + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ManagedFieldsEntry + elementRelationship: atomic + - name: name + type: + scalar: string + - name: namespace + type: + scalar: string + - name: ownerReferences + type: + list: + elementType: + namedType: io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference + elementRelationship: associative + keys: + - uid + - name: resourceVersion + type: + scalar: string + - name: selfLink + type: + scalar: string + - name: uid + type: + scalar: string +- name: io.k8s.apimachinery.pkg.apis.meta.v1.OwnerReference + map: + fields: + - name: apiVersion + type: + scalar: string + default: "" + - name: blockOwnerDeletion + type: + scalar: boolean + - name: controller + type: + scalar: boolean + - name: kind + type: + scalar: string + default: "" + - name: name + type: + scalar: string + default: "" + - name: uid + type: + scalar: string + default: "" + elementRelationship: atomic +- name: io.k8s.apimachinery.pkg.apis.meta.v1.Time + scalar: untyped +- name: __untyped_atomic_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic +- name: __untyped_deduced_ + scalar: untyped + list: + elementType: + namedType: __untyped_atomic_ + elementRelationship: atomic + map: + elementType: + namedType: __untyped_deduced_ + elementRelationship: separable +`) diff --git a/client-go/applyconfigurations/ipam/v1alpha1/prefix.go b/client-go/applyconfigurations/ipam/v1alpha1/prefix.go new file mode 100644 index 000000000..19cd638af --- /dev/null +++ b/client-go/applyconfigurations/ipam/v1alpha1/prefix.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + ipamv1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// PrefixApplyConfiguration represents an declarative configuration of the Prefix type for use +// with apply. +type PrefixApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PrefixSpecApplyConfiguration `json:"spec,omitempty"` + Status *PrefixStatusApplyConfiguration `json:"status,omitempty"` +} + +// Prefix constructs an declarative configuration of the Prefix type for use with +// apply. +func Prefix(name, namespace string) *PrefixApplyConfiguration { + b := &PrefixApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Prefix") + b.WithAPIVersion("ipam.api.onmetal.de/v1alpha1") + return b +} + +// ExtractPrefix extracts the applied configuration owned by fieldManager from +// prefix. If no managedFields are found in prefix for fieldManager, a +// PrefixApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// prefix must be a unmodified Prefix API object that was retrieved from the Kubernetes API. +// ExtractPrefix provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractPrefix(prefix *ipamv1alpha1.Prefix, fieldManager string) (*PrefixApplyConfiguration, error) { + return extractPrefix(prefix, fieldManager, "") +} + +// ExtractPrefixStatus is the same as ExtractPrefix except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPrefixStatus(prefix *ipamv1alpha1.Prefix, fieldManager string) (*PrefixApplyConfiguration, error) { + return extractPrefix(prefix, fieldManager, "status") +} + +func extractPrefix(prefix *ipamv1alpha1.Prefix, fieldManager string, subresource string) (*PrefixApplyConfiguration, error) { + b := &PrefixApplyConfiguration{} + err := managedfields.ExtractInto(prefix, internal.Parser().Type("com.github.onmetal.onmetal-api.api.ipam.v1alpha1.Prefix"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(prefix.Name) + b.WithNamespace(prefix.Namespace) + + b.WithKind("Prefix") + b.WithAPIVersion("ipam.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithKind(value string) *PrefixApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithAPIVersion(value string) *PrefixApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithName(value string) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithGenerateName(value string) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithNamespace(value string) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithUID(value types.UID) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithResourceVersion(value string) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithGeneration(value int64) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PrefixApplyConfiguration) WithLabels(entries map[string]string) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PrefixApplyConfiguration) WithAnnotations(entries map[string]string) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PrefixApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PrefixApplyConfiguration) WithFinalizers(values ...string) *PrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PrefixApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithSpec(value *PrefixSpecApplyConfiguration) *PrefixApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PrefixApplyConfiguration) WithStatus(value *PrefixStatusApplyConfiguration) *PrefixApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/ipam/v1alpha1/prefixallocation.go b/client-go/applyconfigurations/ipam/v1alpha1/prefixallocation.go new file mode 100644 index 000000000..97c334dec --- /dev/null +++ b/client-go/applyconfigurations/ipam/v1alpha1/prefixallocation.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + ipamv1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// PrefixAllocationApplyConfiguration represents an declarative configuration of the PrefixAllocation type for use +// with apply. +type PrefixAllocationApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PrefixAllocationSpecApplyConfiguration `json:"spec,omitempty"` + Status *PrefixAllocationStatusApplyConfiguration `json:"status,omitempty"` +} + +// PrefixAllocation constructs an declarative configuration of the PrefixAllocation type for use with +// apply. +func PrefixAllocation(name, namespace string) *PrefixAllocationApplyConfiguration { + b := &PrefixAllocationApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("PrefixAllocation") + b.WithAPIVersion("ipam.api.onmetal.de/v1alpha1") + return b +} + +// ExtractPrefixAllocation extracts the applied configuration owned by fieldManager from +// prefixAllocation. If no managedFields are found in prefixAllocation for fieldManager, a +// PrefixAllocationApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// prefixAllocation must be a unmodified PrefixAllocation API object that was retrieved from the Kubernetes API. +// ExtractPrefixAllocation provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractPrefixAllocation(prefixAllocation *ipamv1alpha1.PrefixAllocation, fieldManager string) (*PrefixAllocationApplyConfiguration, error) { + return extractPrefixAllocation(prefixAllocation, fieldManager, "") +} + +// ExtractPrefixAllocationStatus is the same as ExtractPrefixAllocation except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractPrefixAllocationStatus(prefixAllocation *ipamv1alpha1.PrefixAllocation, fieldManager string) (*PrefixAllocationApplyConfiguration, error) { + return extractPrefixAllocation(prefixAllocation, fieldManager, "status") +} + +func extractPrefixAllocation(prefixAllocation *ipamv1alpha1.PrefixAllocation, fieldManager string, subresource string) (*PrefixAllocationApplyConfiguration, error) { + b := &PrefixAllocationApplyConfiguration{} + err := managedfields.ExtractInto(prefixAllocation, internal.Parser().Type("com.github.onmetal.onmetal-api.api.ipam.v1alpha1.PrefixAllocation"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(prefixAllocation.Name) + b.WithNamespace(prefixAllocation.Namespace) + + b.WithKind("PrefixAllocation") + b.WithAPIVersion("ipam.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithKind(value string) *PrefixAllocationApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithAPIVersion(value string) *PrefixAllocationApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithName(value string) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithGenerateName(value string) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithNamespace(value string) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithUID(value types.UID) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithResourceVersion(value string) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithGeneration(value int64) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PrefixAllocationApplyConfiguration) WithLabels(entries map[string]string) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PrefixAllocationApplyConfiguration) WithAnnotations(entries map[string]string) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PrefixAllocationApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PrefixAllocationApplyConfiguration) WithFinalizers(values ...string) *PrefixAllocationApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PrefixAllocationApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithSpec(value *PrefixAllocationSpecApplyConfiguration) *PrefixAllocationApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *PrefixAllocationApplyConfiguration) WithStatus(value *PrefixAllocationStatusApplyConfiguration) *PrefixAllocationApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/ipam/v1alpha1/prefixallocationspec.go b/client-go/applyconfigurations/ipam/v1alpha1/prefixallocationspec.go new file mode 100644 index 000000000..893fa30b6 --- /dev/null +++ b/client-go/applyconfigurations/ipam/v1alpha1/prefixallocationspec.go @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" + metav1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + v1 "k8s.io/api/core/v1" +) + +// PrefixAllocationSpecApplyConfiguration represents an declarative configuration of the PrefixAllocationSpec type for use +// with apply. +type PrefixAllocationSpecApplyConfiguration struct { + IPFamily *v1.IPFamily `json:"ipFamily,omitempty"` + Prefix *v1alpha1.IPPrefix `json:"prefix,omitempty"` + PrefixLength *int32 `json:"prefixLength,omitempty"` + PrefixRef *v1.LocalObjectReference `json:"prefixRef,omitempty"` + PrefixSelector *metav1.LabelSelectorApplyConfiguration `json:"prefixSelector,omitempty"` +} + +// PrefixAllocationSpecApplyConfiguration constructs an declarative configuration of the PrefixAllocationSpec type for use with +// apply. +func PrefixAllocationSpec() *PrefixAllocationSpecApplyConfiguration { + return &PrefixAllocationSpecApplyConfiguration{} +} + +// WithIPFamily sets the IPFamily field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPFamily field is set to the value of the last call. +func (b *PrefixAllocationSpecApplyConfiguration) WithIPFamily(value v1.IPFamily) *PrefixAllocationSpecApplyConfiguration { + b.IPFamily = &value + return b +} + +// WithPrefix sets the Prefix field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Prefix field is set to the value of the last call. +func (b *PrefixAllocationSpecApplyConfiguration) WithPrefix(value v1alpha1.IPPrefix) *PrefixAllocationSpecApplyConfiguration { + b.Prefix = &value + return b +} + +// WithPrefixLength sets the PrefixLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PrefixLength field is set to the value of the last call. +func (b *PrefixAllocationSpecApplyConfiguration) WithPrefixLength(value int32) *PrefixAllocationSpecApplyConfiguration { + b.PrefixLength = &value + return b +} + +// WithPrefixRef sets the PrefixRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PrefixRef field is set to the value of the last call. +func (b *PrefixAllocationSpecApplyConfiguration) WithPrefixRef(value v1.LocalObjectReference) *PrefixAllocationSpecApplyConfiguration { + b.PrefixRef = &value + return b +} + +// WithPrefixSelector sets the PrefixSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PrefixSelector field is set to the value of the last call. +func (b *PrefixAllocationSpecApplyConfiguration) WithPrefixSelector(value *metav1.LabelSelectorApplyConfiguration) *PrefixAllocationSpecApplyConfiguration { + b.PrefixSelector = value + return b +} diff --git a/client-go/applyconfigurations/ipam/v1alpha1/prefixallocationstatus.go b/client-go/applyconfigurations/ipam/v1alpha1/prefixallocationstatus.go new file mode 100644 index 000000000..43dda7066 --- /dev/null +++ b/client-go/applyconfigurations/ipam/v1alpha1/prefixallocationstatus.go @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" + ipamv1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PrefixAllocationStatusApplyConfiguration represents an declarative configuration of the PrefixAllocationStatus type for use +// with apply. +type PrefixAllocationStatusApplyConfiguration struct { + Prefix *v1alpha1.IPPrefix `json:"prefix,omitempty"` + Phase *ipamv1alpha1.PrefixAllocationPhase `json:"phase,omitempty"` + LastPhaseTransitionTime *v1.Time `json:"lastPhaseTransitionTime,omitempty"` +} + +// PrefixAllocationStatusApplyConfiguration constructs an declarative configuration of the PrefixAllocationStatus type for use with +// apply. +func PrefixAllocationStatus() *PrefixAllocationStatusApplyConfiguration { + return &PrefixAllocationStatusApplyConfiguration{} +} + +// WithPrefix sets the Prefix field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Prefix field is set to the value of the last call. +func (b *PrefixAllocationStatusApplyConfiguration) WithPrefix(value v1alpha1.IPPrefix) *PrefixAllocationStatusApplyConfiguration { + b.Prefix = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *PrefixAllocationStatusApplyConfiguration) WithPhase(value ipamv1alpha1.PrefixAllocationPhase) *PrefixAllocationStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithLastPhaseTransitionTime sets the LastPhaseTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastPhaseTransitionTime field is set to the value of the last call. +func (b *PrefixAllocationStatusApplyConfiguration) WithLastPhaseTransitionTime(value v1.Time) *PrefixAllocationStatusApplyConfiguration { + b.LastPhaseTransitionTime = &value + return b +} diff --git a/client-go/applyconfigurations/ipam/v1alpha1/prefixspec.go b/client-go/applyconfigurations/ipam/v1alpha1/prefixspec.go new file mode 100644 index 000000000..87d03ab92 --- /dev/null +++ b/client-go/applyconfigurations/ipam/v1alpha1/prefixspec.go @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" + metav1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + v1 "k8s.io/api/core/v1" +) + +// PrefixSpecApplyConfiguration represents an declarative configuration of the PrefixSpec type for use +// with apply. +type PrefixSpecApplyConfiguration struct { + IPFamily *v1.IPFamily `json:"ipFamily,omitempty"` + Prefix *v1alpha1.IPPrefix `json:"prefix,omitempty"` + PrefixLength *int32 `json:"prefixLength,omitempty"` + ParentRef *v1.LocalObjectReference `json:"parentRef,omitempty"` + ParentSelector *metav1.LabelSelectorApplyConfiguration `json:"parentSelector,omitempty"` +} + +// PrefixSpecApplyConfiguration constructs an declarative configuration of the PrefixSpec type for use with +// apply. +func PrefixSpec() *PrefixSpecApplyConfiguration { + return &PrefixSpecApplyConfiguration{} +} + +// WithIPFamily sets the IPFamily field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPFamily field is set to the value of the last call. +func (b *PrefixSpecApplyConfiguration) WithIPFamily(value v1.IPFamily) *PrefixSpecApplyConfiguration { + b.IPFamily = &value + return b +} + +// WithPrefix sets the Prefix field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Prefix field is set to the value of the last call. +func (b *PrefixSpecApplyConfiguration) WithPrefix(value v1alpha1.IPPrefix) *PrefixSpecApplyConfiguration { + b.Prefix = &value + return b +} + +// WithPrefixLength sets the PrefixLength field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PrefixLength field is set to the value of the last call. +func (b *PrefixSpecApplyConfiguration) WithPrefixLength(value int32) *PrefixSpecApplyConfiguration { + b.PrefixLength = &value + return b +} + +// WithParentRef sets the ParentRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ParentRef field is set to the value of the last call. +func (b *PrefixSpecApplyConfiguration) WithParentRef(value v1.LocalObjectReference) *PrefixSpecApplyConfiguration { + b.ParentRef = &value + return b +} + +// WithParentSelector sets the ParentSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ParentSelector field is set to the value of the last call. +func (b *PrefixSpecApplyConfiguration) WithParentSelector(value *metav1.LabelSelectorApplyConfiguration) *PrefixSpecApplyConfiguration { + b.ParentSelector = value + return b +} diff --git a/client-go/applyconfigurations/ipam/v1alpha1/prefixstatus.go b/client-go/applyconfigurations/ipam/v1alpha1/prefixstatus.go new file mode 100644 index 000000000..dbb190cdd --- /dev/null +++ b/client-go/applyconfigurations/ipam/v1alpha1/prefixstatus.go @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + commonv1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" + v1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// PrefixStatusApplyConfiguration represents an declarative configuration of the PrefixStatus type for use +// with apply. +type PrefixStatusApplyConfiguration struct { + Phase *v1alpha1.PrefixPhase `json:"phase,omitempty"` + LastPhaseTransitionTime *v1.Time `json:"lastPhaseTransitionTime,omitempty"` + Used []commonv1alpha1.IPPrefix `json:"used,omitempty"` +} + +// PrefixStatusApplyConfiguration constructs an declarative configuration of the PrefixStatus type for use with +// apply. +func PrefixStatus() *PrefixStatusApplyConfiguration { + return &PrefixStatusApplyConfiguration{} +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *PrefixStatusApplyConfiguration) WithPhase(value v1alpha1.PrefixPhase) *PrefixStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithLastPhaseTransitionTime sets the LastPhaseTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastPhaseTransitionTime field is set to the value of the last call. +func (b *PrefixStatusApplyConfiguration) WithLastPhaseTransitionTime(value v1.Time) *PrefixStatusApplyConfiguration { + b.LastPhaseTransitionTime = &value + return b +} + +// WithUsed adds the given value to the Used field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Used field. +func (b *PrefixStatusApplyConfiguration) WithUsed(values ...commonv1alpha1.IPPrefix) *PrefixStatusApplyConfiguration { + for i := range values { + b.Used = append(b.Used, values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/ipam/v1alpha1/prefixtemplatespec.go b/client-go/applyconfigurations/ipam/v1alpha1/prefixtemplatespec.go new file mode 100644 index 000000000..e106a2a08 --- /dev/null +++ b/client-go/applyconfigurations/ipam/v1alpha1/prefixtemplatespec.go @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" +) + +// PrefixTemplateSpecApplyConfiguration represents an declarative configuration of the PrefixTemplateSpec type for use +// with apply. +type PrefixTemplateSpecApplyConfiguration struct { + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *PrefixSpecApplyConfiguration `json:"spec,omitempty"` +} + +// PrefixTemplateSpecApplyConfiguration constructs an declarative configuration of the PrefixTemplateSpec type for use with +// apply. +func PrefixTemplateSpec() *PrefixTemplateSpecApplyConfiguration { + return &PrefixTemplateSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithName(value string) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithGenerateName(value string) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithNamespace(value string) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithUID(value types.UID) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithResourceVersion(value string) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithGeneration(value int64) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *PrefixTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *PrefixTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *PrefixTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *PrefixTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *PrefixTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *PrefixTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *PrefixTemplateSpecApplyConfiguration) WithSpec(value *PrefixSpecApplyConfiguration) *PrefixTemplateSpecApplyConfiguration { + b.Spec = value + return b +} diff --git a/client-go/applyconfigurations/meta/v1/labelselector.go b/client-go/applyconfigurations/meta/v1/labelselector.go new file mode 100644 index 000000000..d430cd162 --- /dev/null +++ b/client-go/applyconfigurations/meta/v1/labelselector.go @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// LabelSelectorApplyConfiguration represents an declarative configuration of the LabelSelector type for use +// with apply. +type LabelSelectorApplyConfiguration struct { + MatchLabels map[string]string `json:"matchLabels,omitempty"` + MatchExpressions []LabelSelectorRequirementApplyConfiguration `json:"matchExpressions,omitempty"` +} + +// LabelSelectorApplyConfiguration constructs an declarative configuration of the LabelSelector type for use with +// apply. +func LabelSelector() *LabelSelectorApplyConfiguration { + return &LabelSelectorApplyConfiguration{} +} + +// WithMatchLabels puts the entries into the MatchLabels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the MatchLabels field, +// overwriting an existing map entries in MatchLabels field with the same key. +func (b *LabelSelectorApplyConfiguration) WithMatchLabels(entries map[string]string) *LabelSelectorApplyConfiguration { + if b.MatchLabels == nil && len(entries) > 0 { + b.MatchLabels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.MatchLabels[k] = v + } + return b +} + +// WithMatchExpressions adds the given value to the MatchExpressions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the MatchExpressions field. +func (b *LabelSelectorApplyConfiguration) WithMatchExpressions(values ...*LabelSelectorRequirementApplyConfiguration) *LabelSelectorApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithMatchExpressions") + } + b.MatchExpressions = append(b.MatchExpressions, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/meta/v1/labelselectorrequirement.go b/client-go/applyconfigurations/meta/v1/labelselectorrequirement.go new file mode 100644 index 000000000..84f303942 --- /dev/null +++ b/client-go/applyconfigurations/meta/v1/labelselectorrequirement.go @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// LabelSelectorRequirementApplyConfiguration represents an declarative configuration of the LabelSelectorRequirement type for use +// with apply. +type LabelSelectorRequirementApplyConfiguration struct { + Key *string `json:"key,omitempty"` + Operator *v1.LabelSelectorOperator `json:"operator,omitempty"` + Values []string `json:"values,omitempty"` +} + +// LabelSelectorRequirementApplyConfiguration constructs an declarative configuration of the LabelSelectorRequirement type for use with +// apply. +func LabelSelectorRequirement() *LabelSelectorRequirementApplyConfiguration { + return &LabelSelectorRequirementApplyConfiguration{} +} + +// WithKey sets the Key field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Key field is set to the value of the last call. +func (b *LabelSelectorRequirementApplyConfiguration) WithKey(value string) *LabelSelectorRequirementApplyConfiguration { + b.Key = &value + return b +} + +// WithOperator sets the Operator field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Operator field is set to the value of the last call. +func (b *LabelSelectorRequirementApplyConfiguration) WithOperator(value v1.LabelSelectorOperator) *LabelSelectorRequirementApplyConfiguration { + b.Operator = &value + return b +} + +// WithValues adds the given value to the Values field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Values field. +func (b *LabelSelectorRequirementApplyConfiguration) WithValues(values ...string) *LabelSelectorRequirementApplyConfiguration { + for i := range values { + b.Values = append(b.Values, values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/meta/v1/managedfieldsentry.go b/client-go/applyconfigurations/meta/v1/managedfieldsentry.go new file mode 100644 index 000000000..0255581a8 --- /dev/null +++ b/client-go/applyconfigurations/meta/v1/managedfieldsentry.go @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// ManagedFieldsEntryApplyConfiguration represents an declarative configuration of the ManagedFieldsEntry type for use +// with apply. +type ManagedFieldsEntryApplyConfiguration struct { + Manager *string `json:"manager,omitempty"` + Operation *v1.ManagedFieldsOperationType `json:"operation,omitempty"` + APIVersion *string `json:"apiVersion,omitempty"` + Time *v1.Time `json:"time,omitempty"` + FieldsType *string `json:"fieldsType,omitempty"` + FieldsV1 *v1.FieldsV1 `json:"fieldsV1,omitempty"` + Subresource *string `json:"subresource,omitempty"` +} + +// ManagedFieldsEntryApplyConfiguration constructs an declarative configuration of the ManagedFieldsEntry type for use with +// apply. +func ManagedFieldsEntry() *ManagedFieldsEntryApplyConfiguration { + return &ManagedFieldsEntryApplyConfiguration{} +} + +// WithManager sets the Manager field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Manager field is set to the value of the last call. +func (b *ManagedFieldsEntryApplyConfiguration) WithManager(value string) *ManagedFieldsEntryApplyConfiguration { + b.Manager = &value + return b +} + +// WithOperation sets the Operation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Operation field is set to the value of the last call. +func (b *ManagedFieldsEntryApplyConfiguration) WithOperation(value v1.ManagedFieldsOperationType) *ManagedFieldsEntryApplyConfiguration { + b.Operation = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *ManagedFieldsEntryApplyConfiguration) WithAPIVersion(value string) *ManagedFieldsEntryApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithTime sets the Time field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Time field is set to the value of the last call. +func (b *ManagedFieldsEntryApplyConfiguration) WithTime(value v1.Time) *ManagedFieldsEntryApplyConfiguration { + b.Time = &value + return b +} + +// WithFieldsType sets the FieldsType field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldsType field is set to the value of the last call. +func (b *ManagedFieldsEntryApplyConfiguration) WithFieldsType(value string) *ManagedFieldsEntryApplyConfiguration { + b.FieldsType = &value + return b +} + +// WithFieldsV1 sets the FieldsV1 field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the FieldsV1 field is set to the value of the last call. +func (b *ManagedFieldsEntryApplyConfiguration) WithFieldsV1(value v1.FieldsV1) *ManagedFieldsEntryApplyConfiguration { + b.FieldsV1 = &value + return b +} + +// WithSubresource sets the Subresource field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Subresource field is set to the value of the last call. +func (b *ManagedFieldsEntryApplyConfiguration) WithSubresource(value string) *ManagedFieldsEntryApplyConfiguration { + b.Subresource = &value + return b +} diff --git a/client-go/applyconfigurations/meta/v1/objectmeta.go b/client-go/applyconfigurations/meta/v1/objectmeta.go new file mode 100644 index 000000000..774e5d7b0 --- /dev/null +++ b/client-go/applyconfigurations/meta/v1/objectmeta.go @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" +) + +// ObjectMetaApplyConfiguration represents an declarative configuration of the ObjectMeta type for use +// with apply. +type ObjectMetaApplyConfiguration struct { + Name *string `json:"name,omitempty"` + GenerateName *string `json:"generateName,omitempty"` + Namespace *string `json:"namespace,omitempty"` + UID *types.UID `json:"uid,omitempty"` + ResourceVersion *string `json:"resourceVersion,omitempty"` + Generation *int64 `json:"generation,omitempty"` + CreationTimestamp *v1.Time `json:"creationTimestamp,omitempty"` + DeletionTimestamp *v1.Time `json:"deletionTimestamp,omitempty"` + DeletionGracePeriodSeconds *int64 `json:"deletionGracePeriodSeconds,omitempty"` + Labels map[string]string `json:"labels,omitempty"` + Annotations map[string]string `json:"annotations,omitempty"` + OwnerReferences []OwnerReferenceApplyConfiguration `json:"ownerReferences,omitempty"` + Finalizers []string `json:"finalizers,omitempty"` +} + +// ObjectMetaApplyConfiguration constructs an declarative configuration of the ObjectMeta type for use with +// apply. +func ObjectMeta() *ObjectMetaApplyConfiguration { + return &ObjectMetaApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *ObjectMetaApplyConfiguration) WithName(value string) *ObjectMetaApplyConfiguration { + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *ObjectMetaApplyConfiguration) WithGenerateName(value string) *ObjectMetaApplyConfiguration { + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *ObjectMetaApplyConfiguration) WithNamespace(value string) *ObjectMetaApplyConfiguration { + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *ObjectMetaApplyConfiguration) WithUID(value types.UID) *ObjectMetaApplyConfiguration { + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *ObjectMetaApplyConfiguration) WithResourceVersion(value string) *ObjectMetaApplyConfiguration { + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *ObjectMetaApplyConfiguration) WithGeneration(value int64) *ObjectMetaApplyConfiguration { + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *ObjectMetaApplyConfiguration) WithCreationTimestamp(value v1.Time) *ObjectMetaApplyConfiguration { + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *ObjectMetaApplyConfiguration) WithDeletionTimestamp(value v1.Time) *ObjectMetaApplyConfiguration { + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *ObjectMetaApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *ObjectMetaApplyConfiguration { + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *ObjectMetaApplyConfiguration) WithLabels(entries map[string]string) *ObjectMetaApplyConfiguration { + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *ObjectMetaApplyConfiguration) WithAnnotations(entries map[string]string) *ObjectMetaApplyConfiguration { + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *ObjectMetaApplyConfiguration) WithOwnerReferences(values ...*OwnerReferenceApplyConfiguration) *ObjectMetaApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *ObjectMetaApplyConfiguration) WithFinalizers(values ...string) *ObjectMetaApplyConfiguration { + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/meta/v1/ownerreference.go b/client-go/applyconfigurations/meta/v1/ownerreference.go new file mode 100644 index 000000000..0059b5551 --- /dev/null +++ b/client-go/applyconfigurations/meta/v1/ownerreference.go @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +import ( + types "k8s.io/apimachinery/pkg/types" +) + +// OwnerReferenceApplyConfiguration represents an declarative configuration of the OwnerReference type for use +// with apply. +type OwnerReferenceApplyConfiguration struct { + APIVersion *string `json:"apiVersion,omitempty"` + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + UID *types.UID `json:"uid,omitempty"` + Controller *bool `json:"controller,omitempty"` + BlockOwnerDeletion *bool `json:"blockOwnerDeletion,omitempty"` +} + +// OwnerReferenceApplyConfiguration constructs an declarative configuration of the OwnerReference type for use with +// apply. +func OwnerReference() *OwnerReferenceApplyConfiguration { + return &OwnerReferenceApplyConfiguration{} +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *OwnerReferenceApplyConfiguration) WithAPIVersion(value string) *OwnerReferenceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *OwnerReferenceApplyConfiguration) WithKind(value string) *OwnerReferenceApplyConfiguration { + b.Kind = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *OwnerReferenceApplyConfiguration) WithName(value string) *OwnerReferenceApplyConfiguration { + b.Name = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *OwnerReferenceApplyConfiguration) WithUID(value types.UID) *OwnerReferenceApplyConfiguration { + b.UID = &value + return b +} + +// WithController sets the Controller field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Controller field is set to the value of the last call. +func (b *OwnerReferenceApplyConfiguration) WithController(value bool) *OwnerReferenceApplyConfiguration { + b.Controller = &value + return b +} + +// WithBlockOwnerDeletion sets the BlockOwnerDeletion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the BlockOwnerDeletion field is set to the value of the last call. +func (b *OwnerReferenceApplyConfiguration) WithBlockOwnerDeletion(value bool) *OwnerReferenceApplyConfiguration { + b.BlockOwnerDeletion = &value + return b +} diff --git a/client-go/applyconfigurations/meta/v1/typemeta.go b/client-go/applyconfigurations/meta/v1/typemeta.go new file mode 100644 index 000000000..63743763b --- /dev/null +++ b/client-go/applyconfigurations/meta/v1/typemeta.go @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1 + +// TypeMetaApplyConfiguration represents an declarative configuration of the TypeMeta type for use +// with apply. +type TypeMetaApplyConfiguration struct { + Kind *string `json:"kind,omitempty"` + APIVersion *string `json:"apiVersion,omitempty"` +} + +// TypeMetaApplyConfiguration constructs an declarative configuration of the TypeMeta type for use with +// apply. +func TypeMeta() *TypeMetaApplyConfiguration { + return &TypeMetaApplyConfiguration{} +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *TypeMetaApplyConfiguration) WithKind(value string) *TypeMetaApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *TypeMetaApplyConfiguration) WithAPIVersion(value string) *TypeMetaApplyConfiguration { + b.APIVersion = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/aliasprefix.go b/client-go/applyconfigurations/networking/v1alpha1/aliasprefix.go new file mode 100644 index 000000000..c6595e7fe --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/aliasprefix.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// AliasPrefixApplyConfiguration represents an declarative configuration of the AliasPrefix type for use +// with apply. +type AliasPrefixApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *AliasPrefixSpecApplyConfiguration `json:"spec,omitempty"` + Status *AliasPrefixStatusApplyConfiguration `json:"status,omitempty"` +} + +// AliasPrefix constructs an declarative configuration of the AliasPrefix type for use with +// apply. +func AliasPrefix(name, namespace string) *AliasPrefixApplyConfiguration { + b := &AliasPrefixApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("AliasPrefix") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b +} + +// ExtractAliasPrefix extracts the applied configuration owned by fieldManager from +// aliasPrefix. If no managedFields are found in aliasPrefix for fieldManager, a +// AliasPrefixApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// aliasPrefix must be a unmodified AliasPrefix API object that was retrieved from the Kubernetes API. +// ExtractAliasPrefix provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractAliasPrefix(aliasPrefix *networkingv1alpha1.AliasPrefix, fieldManager string) (*AliasPrefixApplyConfiguration, error) { + return extractAliasPrefix(aliasPrefix, fieldManager, "") +} + +// ExtractAliasPrefixStatus is the same as ExtractAliasPrefix except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractAliasPrefixStatus(aliasPrefix *networkingv1alpha1.AliasPrefix, fieldManager string) (*AliasPrefixApplyConfiguration, error) { + return extractAliasPrefix(aliasPrefix, fieldManager, "status") +} + +func extractAliasPrefix(aliasPrefix *networkingv1alpha1.AliasPrefix, fieldManager string, subresource string) (*AliasPrefixApplyConfiguration, error) { + b := &AliasPrefixApplyConfiguration{} + err := managedfields.ExtractInto(aliasPrefix, internal.Parser().Type("com.github.onmetal.onmetal-api.api.networking.v1alpha1.AliasPrefix"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(aliasPrefix.Name) + b.WithNamespace(aliasPrefix.Namespace) + + b.WithKind("AliasPrefix") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithKind(value string) *AliasPrefixApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithAPIVersion(value string) *AliasPrefixApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithName(value string) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithGenerateName(value string) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithNamespace(value string) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithUID(value types.UID) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithResourceVersion(value string) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithGeneration(value int64) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithCreationTimestamp(value metav1.Time) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *AliasPrefixApplyConfiguration) WithLabels(entries map[string]string) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *AliasPrefixApplyConfiguration) WithAnnotations(entries map[string]string) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *AliasPrefixApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *AliasPrefixApplyConfiguration) WithFinalizers(values ...string) *AliasPrefixApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *AliasPrefixApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithSpec(value *AliasPrefixSpecApplyConfiguration) *AliasPrefixApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *AliasPrefixApplyConfiguration) WithStatus(value *AliasPrefixStatusApplyConfiguration) *AliasPrefixApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/aliasprefixrouting.go b/client-go/applyconfigurations/networking/v1alpha1/aliasprefixrouting.go new file mode 100644 index 000000000..743d2f7de --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/aliasprefixrouting.go @@ -0,0 +1,254 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// AliasPrefixRoutingApplyConfiguration represents an declarative configuration of the AliasPrefixRouting type for use +// with apply. +type AliasPrefixRoutingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Destinations []v1alpha1.LocalUIDReferenceApplyConfiguration `json:"destinations,omitempty"` +} + +// AliasPrefixRouting constructs an declarative configuration of the AliasPrefixRouting type for use with +// apply. +func AliasPrefixRouting(name, namespace string) *AliasPrefixRoutingApplyConfiguration { + b := &AliasPrefixRoutingApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("AliasPrefixRouting") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b +} + +// ExtractAliasPrefixRouting extracts the applied configuration owned by fieldManager from +// aliasPrefixRouting. If no managedFields are found in aliasPrefixRouting for fieldManager, a +// AliasPrefixRoutingApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// aliasPrefixRouting must be a unmodified AliasPrefixRouting API object that was retrieved from the Kubernetes API. +// ExtractAliasPrefixRouting provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractAliasPrefixRouting(aliasPrefixRouting *networkingv1alpha1.AliasPrefixRouting, fieldManager string) (*AliasPrefixRoutingApplyConfiguration, error) { + return extractAliasPrefixRouting(aliasPrefixRouting, fieldManager, "") +} + +// ExtractAliasPrefixRoutingStatus is the same as ExtractAliasPrefixRouting except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractAliasPrefixRoutingStatus(aliasPrefixRouting *networkingv1alpha1.AliasPrefixRouting, fieldManager string) (*AliasPrefixRoutingApplyConfiguration, error) { + return extractAliasPrefixRouting(aliasPrefixRouting, fieldManager, "status") +} + +func extractAliasPrefixRouting(aliasPrefixRouting *networkingv1alpha1.AliasPrefixRouting, fieldManager string, subresource string) (*AliasPrefixRoutingApplyConfiguration, error) { + b := &AliasPrefixRoutingApplyConfiguration{} + err := managedfields.ExtractInto(aliasPrefixRouting, internal.Parser().Type("com.github.onmetal.onmetal-api.api.networking.v1alpha1.AliasPrefixRouting"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(aliasPrefixRouting.Name) + b.WithNamespace(aliasPrefixRouting.Namespace) + + b.WithKind("AliasPrefixRouting") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithKind(value string) *AliasPrefixRoutingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithAPIVersion(value string) *AliasPrefixRoutingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithName(value string) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithGenerateName(value string) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithNamespace(value string) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithUID(value types.UID) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithResourceVersion(value string) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithGeneration(value int64) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *AliasPrefixRoutingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *AliasPrefixRoutingApplyConfiguration) WithLabels(entries map[string]string) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *AliasPrefixRoutingApplyConfiguration) WithAnnotations(entries map[string]string) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *AliasPrefixRoutingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *AliasPrefixRoutingApplyConfiguration) WithFinalizers(values ...string) *AliasPrefixRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *AliasPrefixRoutingApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithDestinations adds the given value to the Destinations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Destinations field. +func (b *AliasPrefixRoutingApplyConfiguration) WithDestinations(values ...*v1alpha1.LocalUIDReferenceApplyConfiguration) *AliasPrefixRoutingApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDestinations") + } + b.Destinations = append(b.Destinations, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/aliasprefixspec.go b/client-go/applyconfigurations/networking/v1alpha1/aliasprefixspec.go new file mode 100644 index 000000000..d3dbb3109 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/aliasprefixspec.go @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + v1 "k8s.io/api/core/v1" +) + +// AliasPrefixSpecApplyConfiguration represents an declarative configuration of the AliasPrefixSpec type for use +// with apply. +type AliasPrefixSpecApplyConfiguration struct { + NetworkRef *v1.LocalObjectReference `json:"networkRef,omitempty"` + NetworkInterfaceSelector *metav1.LabelSelectorApplyConfiguration `json:"networkInterfaceSelector,omitempty"` + Prefix *PrefixSourceApplyConfiguration `json:"prefix,omitempty"` +} + +// AliasPrefixSpecApplyConfiguration constructs an declarative configuration of the AliasPrefixSpec type for use with +// apply. +func AliasPrefixSpec() *AliasPrefixSpecApplyConfiguration { + return &AliasPrefixSpecApplyConfiguration{} +} + +// WithNetworkRef sets the NetworkRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkRef field is set to the value of the last call. +func (b *AliasPrefixSpecApplyConfiguration) WithNetworkRef(value v1.LocalObjectReference) *AliasPrefixSpecApplyConfiguration { + b.NetworkRef = &value + return b +} + +// WithNetworkInterfaceSelector sets the NetworkInterfaceSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkInterfaceSelector field is set to the value of the last call. +func (b *AliasPrefixSpecApplyConfiguration) WithNetworkInterfaceSelector(value *metav1.LabelSelectorApplyConfiguration) *AliasPrefixSpecApplyConfiguration { + b.NetworkInterfaceSelector = value + return b +} + +// WithPrefix sets the Prefix field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Prefix field is set to the value of the last call. +func (b *AliasPrefixSpecApplyConfiguration) WithPrefix(value *PrefixSourceApplyConfiguration) *AliasPrefixSpecApplyConfiguration { + b.Prefix = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/aliasprefixstatus.go b/client-go/applyconfigurations/networking/v1alpha1/aliasprefixstatus.go new file mode 100644 index 000000000..72980c318 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/aliasprefixstatus.go @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" +) + +// AliasPrefixStatusApplyConfiguration represents an declarative configuration of the AliasPrefixStatus type for use +// with apply. +type AliasPrefixStatusApplyConfiguration struct { + Prefix *v1alpha1.IPPrefix `json:"prefix,omitempty"` +} + +// AliasPrefixStatusApplyConfiguration constructs an declarative configuration of the AliasPrefixStatus type for use with +// apply. +func AliasPrefixStatus() *AliasPrefixStatusApplyConfiguration { + return &AliasPrefixStatusApplyConfiguration{} +} + +// WithPrefix sets the Prefix field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Prefix field is set to the value of the last call. +func (b *AliasPrefixStatusApplyConfiguration) WithPrefix(value v1alpha1.IPPrefix) *AliasPrefixStatusApplyConfiguration { + b.Prefix = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/ephemeralprefixsource.go b/client-go/applyconfigurations/networking/v1alpha1/ephemeralprefixsource.go new file mode 100644 index 000000000..35b4578c3 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/ephemeralprefixsource.go @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/ipam/v1alpha1" +) + +// EphemeralPrefixSourceApplyConfiguration represents an declarative configuration of the EphemeralPrefixSource type for use +// with apply. +type EphemeralPrefixSourceApplyConfiguration struct { + PrefixTemplate *v1alpha1.PrefixTemplateSpecApplyConfiguration `json:"prefixTemplate,omitempty"` +} + +// EphemeralPrefixSourceApplyConfiguration constructs an declarative configuration of the EphemeralPrefixSource type for use with +// apply. +func EphemeralPrefixSource() *EphemeralPrefixSourceApplyConfiguration { + return &EphemeralPrefixSourceApplyConfiguration{} +} + +// WithPrefixTemplate sets the PrefixTemplate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PrefixTemplate field is set to the value of the last call. +func (b *EphemeralPrefixSourceApplyConfiguration) WithPrefixTemplate(value *v1alpha1.PrefixTemplateSpecApplyConfiguration) *EphemeralPrefixSourceApplyConfiguration { + b.PrefixTemplate = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/ephemeralvirtualipsource.go b/client-go/applyconfigurations/networking/v1alpha1/ephemeralvirtualipsource.go new file mode 100644 index 000000000..eb8701e0b --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/ephemeralvirtualipsource.go @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// EphemeralVirtualIPSourceApplyConfiguration represents an declarative configuration of the EphemeralVirtualIPSource type for use +// with apply. +type EphemeralVirtualIPSourceApplyConfiguration struct { + VirtualIPTemplate *VirtualIPTemplateSpecApplyConfiguration `json:"virtualIPTemplate,omitempty"` +} + +// EphemeralVirtualIPSourceApplyConfiguration constructs an declarative configuration of the EphemeralVirtualIPSource type for use with +// apply. +func EphemeralVirtualIPSource() *EphemeralVirtualIPSourceApplyConfiguration { + return &EphemeralVirtualIPSourceApplyConfiguration{} +} + +// WithVirtualIPTemplate sets the VirtualIPTemplate field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VirtualIPTemplate field is set to the value of the last call. +func (b *EphemeralVirtualIPSourceApplyConfiguration) WithVirtualIPTemplate(value *VirtualIPTemplateSpecApplyConfiguration) *EphemeralVirtualIPSourceApplyConfiguration { + b.VirtualIPTemplate = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/ipsource.go b/client-go/applyconfigurations/networking/v1alpha1/ipsource.go new file mode 100644 index 000000000..9131d21de --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/ipsource.go @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" +) + +// IPSourceApplyConfiguration represents an declarative configuration of the IPSource type for use +// with apply. +type IPSourceApplyConfiguration struct { + Value *v1alpha1.IP `json:"value,omitempty"` + Ephemeral *EphemeralPrefixSourceApplyConfiguration `json:"ephemeral,omitempty"` +} + +// IPSourceApplyConfiguration constructs an declarative configuration of the IPSource type for use with +// apply. +func IPSource() *IPSourceApplyConfiguration { + return &IPSourceApplyConfiguration{} +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *IPSourceApplyConfiguration) WithValue(value v1alpha1.IP) *IPSourceApplyConfiguration { + b.Value = &value + return b +} + +// WithEphemeral sets the Ephemeral field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ephemeral field is set to the value of the last call. +func (b *IPSourceApplyConfiguration) WithEphemeral(value *EphemeralPrefixSourceApplyConfiguration) *IPSourceApplyConfiguration { + b.Ephemeral = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/loadbalancer.go b/client-go/applyconfigurations/networking/v1alpha1/loadbalancer.go new file mode 100644 index 000000000..df46dce86 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/loadbalancer.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// LoadBalancerApplyConfiguration represents an declarative configuration of the LoadBalancer type for use +// with apply. +type LoadBalancerApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *LoadBalancerSpecApplyConfiguration `json:"spec,omitempty"` + Status *LoadBalancerStatusApplyConfiguration `json:"status,omitempty"` +} + +// LoadBalancer constructs an declarative configuration of the LoadBalancer type for use with +// apply. +func LoadBalancer(name, namespace string) *LoadBalancerApplyConfiguration { + b := &LoadBalancerApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("LoadBalancer") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b +} + +// ExtractLoadBalancer extracts the applied configuration owned by fieldManager from +// loadBalancer. If no managedFields are found in loadBalancer for fieldManager, a +// LoadBalancerApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// loadBalancer must be a unmodified LoadBalancer API object that was retrieved from the Kubernetes API. +// ExtractLoadBalancer provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractLoadBalancer(loadBalancer *networkingv1alpha1.LoadBalancer, fieldManager string) (*LoadBalancerApplyConfiguration, error) { + return extractLoadBalancer(loadBalancer, fieldManager, "") +} + +// ExtractLoadBalancerStatus is the same as ExtractLoadBalancer except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractLoadBalancerStatus(loadBalancer *networkingv1alpha1.LoadBalancer, fieldManager string) (*LoadBalancerApplyConfiguration, error) { + return extractLoadBalancer(loadBalancer, fieldManager, "status") +} + +func extractLoadBalancer(loadBalancer *networkingv1alpha1.LoadBalancer, fieldManager string, subresource string) (*LoadBalancerApplyConfiguration, error) { + b := &LoadBalancerApplyConfiguration{} + err := managedfields.ExtractInto(loadBalancer, internal.Parser().Type("com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancer"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(loadBalancer.Name) + b.WithNamespace(loadBalancer.Namespace) + + b.WithKind("LoadBalancer") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithKind(value string) *LoadBalancerApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithAPIVersion(value string) *LoadBalancerApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithName(value string) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithGenerateName(value string) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithNamespace(value string) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithUID(value types.UID) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithResourceVersion(value string) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithGeneration(value int64) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithCreationTimestamp(value metav1.Time) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *LoadBalancerApplyConfiguration) WithLabels(entries map[string]string) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *LoadBalancerApplyConfiguration) WithAnnotations(entries map[string]string) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *LoadBalancerApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *LoadBalancerApplyConfiguration) WithFinalizers(values ...string) *LoadBalancerApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *LoadBalancerApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithSpec(value *LoadBalancerSpecApplyConfiguration) *LoadBalancerApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *LoadBalancerApplyConfiguration) WithStatus(value *LoadBalancerStatusApplyConfiguration) *LoadBalancerApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/loadbalancerport.go b/client-go/applyconfigurations/networking/v1alpha1/loadbalancerport.go new file mode 100644 index 000000000..d0b4922db --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/loadbalancerport.go @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// LoadBalancerPortApplyConfiguration represents an declarative configuration of the LoadBalancerPort type for use +// with apply. +type LoadBalancerPortApplyConfiguration struct { + Protocol *v1.Protocol `json:"protocol,omitempty"` + Port *int32 `json:"port,omitempty"` + EndPort *int32 `json:"endPort,omitempty"` +} + +// LoadBalancerPortApplyConfiguration constructs an declarative configuration of the LoadBalancerPort type for use with +// apply. +func LoadBalancerPort() *LoadBalancerPortApplyConfiguration { + return &LoadBalancerPortApplyConfiguration{} +} + +// WithProtocol sets the Protocol field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Protocol field is set to the value of the last call. +func (b *LoadBalancerPortApplyConfiguration) WithProtocol(value v1.Protocol) *LoadBalancerPortApplyConfiguration { + b.Protocol = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *LoadBalancerPortApplyConfiguration) WithPort(value int32) *LoadBalancerPortApplyConfiguration { + b.Port = &value + return b +} + +// WithEndPort sets the EndPort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EndPort field is set to the value of the last call. +func (b *LoadBalancerPortApplyConfiguration) WithEndPort(value int32) *LoadBalancerPortApplyConfiguration { + b.EndPort = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/loadbalancerrouting.go b/client-go/applyconfigurations/networking/v1alpha1/loadbalancerrouting.go new file mode 100644 index 000000000..7f7d51444 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/loadbalancerrouting.go @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// LoadBalancerRoutingApplyConfiguration represents an declarative configuration of the LoadBalancerRouting type for use +// with apply. +type LoadBalancerRoutingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + NetworkRef *v1alpha1.LocalUIDReferenceApplyConfiguration `json:"networkRef,omitempty"` + Destinations []v1alpha1.LocalUIDReferenceApplyConfiguration `json:"destinations,omitempty"` +} + +// LoadBalancerRouting constructs an declarative configuration of the LoadBalancerRouting type for use with +// apply. +func LoadBalancerRouting(name, namespace string) *LoadBalancerRoutingApplyConfiguration { + b := &LoadBalancerRoutingApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("LoadBalancerRouting") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b +} + +// ExtractLoadBalancerRouting extracts the applied configuration owned by fieldManager from +// loadBalancerRouting. If no managedFields are found in loadBalancerRouting for fieldManager, a +// LoadBalancerRoutingApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// loadBalancerRouting must be a unmodified LoadBalancerRouting API object that was retrieved from the Kubernetes API. +// ExtractLoadBalancerRouting provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractLoadBalancerRouting(loadBalancerRouting *networkingv1alpha1.LoadBalancerRouting, fieldManager string) (*LoadBalancerRoutingApplyConfiguration, error) { + return extractLoadBalancerRouting(loadBalancerRouting, fieldManager, "") +} + +// ExtractLoadBalancerRoutingStatus is the same as ExtractLoadBalancerRouting except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractLoadBalancerRoutingStatus(loadBalancerRouting *networkingv1alpha1.LoadBalancerRouting, fieldManager string) (*LoadBalancerRoutingApplyConfiguration, error) { + return extractLoadBalancerRouting(loadBalancerRouting, fieldManager, "status") +} + +func extractLoadBalancerRouting(loadBalancerRouting *networkingv1alpha1.LoadBalancerRouting, fieldManager string, subresource string) (*LoadBalancerRoutingApplyConfiguration, error) { + b := &LoadBalancerRoutingApplyConfiguration{} + err := managedfields.ExtractInto(loadBalancerRouting, internal.Parser().Type("com.github.onmetal.onmetal-api.api.networking.v1alpha1.LoadBalancerRouting"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(loadBalancerRouting.Name) + b.WithNamespace(loadBalancerRouting.Namespace) + + b.WithKind("LoadBalancerRouting") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithKind(value string) *LoadBalancerRoutingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithAPIVersion(value string) *LoadBalancerRoutingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithName(value string) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithGenerateName(value string) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithNamespace(value string) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithUID(value types.UID) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithResourceVersion(value string) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithGeneration(value int64) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *LoadBalancerRoutingApplyConfiguration) WithLabels(entries map[string]string) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *LoadBalancerRoutingApplyConfiguration) WithAnnotations(entries map[string]string) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *LoadBalancerRoutingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *LoadBalancerRoutingApplyConfiguration) WithFinalizers(values ...string) *LoadBalancerRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *LoadBalancerRoutingApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithNetworkRef sets the NetworkRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkRef field is set to the value of the last call. +func (b *LoadBalancerRoutingApplyConfiguration) WithNetworkRef(value *v1alpha1.LocalUIDReferenceApplyConfiguration) *LoadBalancerRoutingApplyConfiguration { + b.NetworkRef = value + return b +} + +// WithDestinations adds the given value to the Destinations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Destinations field. +func (b *LoadBalancerRoutingApplyConfiguration) WithDestinations(values ...*v1alpha1.LocalUIDReferenceApplyConfiguration) *LoadBalancerRoutingApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDestinations") + } + b.Destinations = append(b.Destinations, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/loadbalancerspec.go b/client-go/applyconfigurations/networking/v1alpha1/loadbalancerspec.go new file mode 100644 index 000000000..bed327eb9 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/loadbalancerspec.go @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + metav1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + v1 "k8s.io/api/core/v1" +) + +// LoadBalancerSpecApplyConfiguration represents an declarative configuration of the LoadBalancerSpec type for use +// with apply. +type LoadBalancerSpecApplyConfiguration struct { + Type *v1alpha1.LoadBalancerType `json:"type,omitempty"` + IPFamilies []v1.IPFamily `json:"ipFamilies,omitempty"` + NetworkRef *v1.LocalObjectReference `json:"networkRef,omitempty"` + NetworkInterfaceSelector *metav1.LabelSelectorApplyConfiguration `json:"networkInterfaceSelector,omitempty"` + Ports []LoadBalancerPortApplyConfiguration `json:"ports,omitempty"` +} + +// LoadBalancerSpecApplyConfiguration constructs an declarative configuration of the LoadBalancerSpec type for use with +// apply. +func LoadBalancerSpec() *LoadBalancerSpecApplyConfiguration { + return &LoadBalancerSpecApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithType(value v1alpha1.LoadBalancerType) *LoadBalancerSpecApplyConfiguration { + b.Type = &value + return b +} + +// WithIPFamilies adds the given value to the IPFamilies field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPFamilies field. +func (b *LoadBalancerSpecApplyConfiguration) WithIPFamilies(values ...v1.IPFamily) *LoadBalancerSpecApplyConfiguration { + for i := range values { + b.IPFamilies = append(b.IPFamilies, values[i]) + } + return b +} + +// WithNetworkRef sets the NetworkRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkRef field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithNetworkRef(value v1.LocalObjectReference) *LoadBalancerSpecApplyConfiguration { + b.NetworkRef = &value + return b +} + +// WithNetworkInterfaceSelector sets the NetworkInterfaceSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkInterfaceSelector field is set to the value of the last call. +func (b *LoadBalancerSpecApplyConfiguration) WithNetworkInterfaceSelector(value *metav1.LabelSelectorApplyConfiguration) *LoadBalancerSpecApplyConfiguration { + b.NetworkInterfaceSelector = value + return b +} + +// WithPorts adds the given value to the Ports field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Ports field. +func (b *LoadBalancerSpecApplyConfiguration) WithPorts(values ...*LoadBalancerPortApplyConfiguration) *LoadBalancerSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithPorts") + } + b.Ports = append(b.Ports, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/loadbalancerstatus.go b/client-go/applyconfigurations/networking/v1alpha1/loadbalancerstatus.go new file mode 100644 index 000000000..f6c44e832 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/loadbalancerstatus.go @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" +) + +// LoadBalancerStatusApplyConfiguration represents an declarative configuration of the LoadBalancerStatus type for use +// with apply. +type LoadBalancerStatusApplyConfiguration struct { + IPs []v1alpha1.IP `json:"ips,omitempty"` +} + +// LoadBalancerStatusApplyConfiguration constructs an declarative configuration of the LoadBalancerStatus type for use with +// apply. +func LoadBalancerStatus() *LoadBalancerStatusApplyConfiguration { + return &LoadBalancerStatusApplyConfiguration{} +} + +// WithIPs adds the given value to the IPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPs field. +func (b *LoadBalancerStatusApplyConfiguration) WithIPs(values ...v1alpha1.IP) *LoadBalancerStatusApplyConfiguration { + for i := range values { + b.IPs = append(b.IPs, values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/natgateway.go b/client-go/applyconfigurations/networking/v1alpha1/natgateway.go new file mode 100644 index 000000000..fc98e66cd --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/natgateway.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// NATGatewayApplyConfiguration represents an declarative configuration of the NATGateway type for use +// with apply. +type NATGatewayApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *NATGatewaySpecApplyConfiguration `json:"spec,omitempty"` + Status *NATGatewayStatusApplyConfiguration `json:"status,omitempty"` +} + +// NATGateway constructs an declarative configuration of the NATGateway type for use with +// apply. +func NATGateway(name, namespace string) *NATGatewayApplyConfiguration { + b := &NATGatewayApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("NATGateway") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b +} + +// ExtractNATGateway extracts the applied configuration owned by fieldManager from +// nATGateway. If no managedFields are found in nATGateway for fieldManager, a +// NATGatewayApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// nATGateway must be a unmodified NATGateway API object that was retrieved from the Kubernetes API. +// ExtractNATGateway provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractNATGateway(nATGateway *networkingv1alpha1.NATGateway, fieldManager string) (*NATGatewayApplyConfiguration, error) { + return extractNATGateway(nATGateway, fieldManager, "") +} + +// ExtractNATGatewayStatus is the same as ExtractNATGateway except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractNATGatewayStatus(nATGateway *networkingv1alpha1.NATGateway, fieldManager string) (*NATGatewayApplyConfiguration, error) { + return extractNATGateway(nATGateway, fieldManager, "status") +} + +func extractNATGateway(nATGateway *networkingv1alpha1.NATGateway, fieldManager string, subresource string) (*NATGatewayApplyConfiguration, error) { + b := &NATGatewayApplyConfiguration{} + err := managedfields.ExtractInto(nATGateway, internal.Parser().Type("com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGateway"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(nATGateway.Name) + b.WithNamespace(nATGateway.Namespace) + + b.WithKind("NATGateway") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithKind(value string) *NATGatewayApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithAPIVersion(value string) *NATGatewayApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithName(value string) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithGenerateName(value string) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithNamespace(value string) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithUID(value types.UID) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithResourceVersion(value string) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithGeneration(value int64) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithCreationTimestamp(value metav1.Time) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *NATGatewayApplyConfiguration) WithLabels(entries map[string]string) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *NATGatewayApplyConfiguration) WithAnnotations(entries map[string]string) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *NATGatewayApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *NATGatewayApplyConfiguration) WithFinalizers(values ...string) *NATGatewayApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *NATGatewayApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithSpec(value *NATGatewaySpecApplyConfiguration) *NATGatewayApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *NATGatewayApplyConfiguration) WithStatus(value *NATGatewayStatusApplyConfiguration) *NATGatewayApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/natgatewaydestination.go b/client-go/applyconfigurations/networking/v1alpha1/natgatewaydestination.go new file mode 100644 index 000000000..a37f428a8 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/natgatewaydestination.go @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + types "k8s.io/apimachinery/pkg/types" +) + +// NATGatewayDestinationApplyConfiguration represents an declarative configuration of the NATGatewayDestination type for use +// with apply. +type NATGatewayDestinationApplyConfiguration struct { + Name *string `json:"name,omitempty"` + UID *types.UID `json:"uid,omitempty"` + IPs []NATGatewayDestinationIPApplyConfiguration `json:"ips,omitempty"` +} + +// NATGatewayDestinationApplyConfiguration constructs an declarative configuration of the NATGatewayDestination type for use with +// apply. +func NATGatewayDestination() *NATGatewayDestinationApplyConfiguration { + return &NATGatewayDestinationApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NATGatewayDestinationApplyConfiguration) WithName(value string) *NATGatewayDestinationApplyConfiguration { + b.Name = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *NATGatewayDestinationApplyConfiguration) WithUID(value types.UID) *NATGatewayDestinationApplyConfiguration { + b.UID = &value + return b +} + +// WithIPs adds the given value to the IPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPs field. +func (b *NATGatewayDestinationApplyConfiguration) WithIPs(values ...*NATGatewayDestinationIPApplyConfiguration) *NATGatewayDestinationApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithIPs") + } + b.IPs = append(b.IPs, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/natgatewaydestinationip.go b/client-go/applyconfigurations/networking/v1alpha1/natgatewaydestinationip.go new file mode 100644 index 000000000..88caa3f52 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/natgatewaydestinationip.go @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" +) + +// NATGatewayDestinationIPApplyConfiguration represents an declarative configuration of the NATGatewayDestinationIP type for use +// with apply. +type NATGatewayDestinationIPApplyConfiguration struct { + IP *v1alpha1.IP `json:"ip,omitempty"` + Port *int32 `json:"port,omitempty"` + EndPort *int32 `json:"endPort,omitempty"` +} + +// NATGatewayDestinationIPApplyConfiguration constructs an declarative configuration of the NATGatewayDestinationIP type for use with +// apply. +func NATGatewayDestinationIP() *NATGatewayDestinationIPApplyConfiguration { + return &NATGatewayDestinationIPApplyConfiguration{} +} + +// WithIP sets the IP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IP field is set to the value of the last call. +func (b *NATGatewayDestinationIPApplyConfiguration) WithIP(value v1alpha1.IP) *NATGatewayDestinationIPApplyConfiguration { + b.IP = &value + return b +} + +// WithPort sets the Port field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Port field is set to the value of the last call. +func (b *NATGatewayDestinationIPApplyConfiguration) WithPort(value int32) *NATGatewayDestinationIPApplyConfiguration { + b.Port = &value + return b +} + +// WithEndPort sets the EndPort field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the EndPort field is set to the value of the last call. +func (b *NATGatewayDestinationIPApplyConfiguration) WithEndPort(value int32) *NATGatewayDestinationIPApplyConfiguration { + b.EndPort = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/natgatewayip.go b/client-go/applyconfigurations/networking/v1alpha1/natgatewayip.go new file mode 100644 index 000000000..5f56a8e34 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/natgatewayip.go @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// NATGatewayIPApplyConfiguration represents an declarative configuration of the NATGatewayIP type for use +// with apply. +type NATGatewayIPApplyConfiguration struct { + Name *string `json:"name,omitempty"` +} + +// NATGatewayIPApplyConfiguration constructs an declarative configuration of the NATGatewayIP type for use with +// apply. +func NATGatewayIP() *NATGatewayIPApplyConfiguration { + return &NATGatewayIPApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NATGatewayIPApplyConfiguration) WithName(value string) *NATGatewayIPApplyConfiguration { + b.Name = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/natgatewayipstatus.go b/client-go/applyconfigurations/networking/v1alpha1/natgatewayipstatus.go new file mode 100644 index 000000000..98676cd65 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/natgatewayipstatus.go @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" +) + +// NATGatewayIPStatusApplyConfiguration represents an declarative configuration of the NATGatewayIPStatus type for use +// with apply. +type NATGatewayIPStatusApplyConfiguration struct { + Name *string `json:"name,omitempty"` + IP *v1alpha1.IP `json:"ip,omitempty"` +} + +// NATGatewayIPStatusApplyConfiguration constructs an declarative configuration of the NATGatewayIPStatus type for use with +// apply. +func NATGatewayIPStatus() *NATGatewayIPStatusApplyConfiguration { + return &NATGatewayIPStatusApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NATGatewayIPStatusApplyConfiguration) WithName(value string) *NATGatewayIPStatusApplyConfiguration { + b.Name = &value + return b +} + +// WithIP sets the IP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IP field is set to the value of the last call. +func (b *NATGatewayIPStatusApplyConfiguration) WithIP(value v1alpha1.IP) *NATGatewayIPStatusApplyConfiguration { + b.IP = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/natgatewayrouting.go b/client-go/applyconfigurations/networking/v1alpha1/natgatewayrouting.go new file mode 100644 index 000000000..b938b97e4 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/natgatewayrouting.go @@ -0,0 +1,263 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + apinetworkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// NATGatewayRoutingApplyConfiguration represents an declarative configuration of the NATGatewayRouting type for use +// with apply. +type NATGatewayRoutingApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + NetworkRef *v1alpha1.LocalUIDReferenceApplyConfiguration `json:"networkRef,omitempty"` + Destinations []NATGatewayDestinationApplyConfiguration `json:"destinations,omitempty"` +} + +// NATGatewayRouting constructs an declarative configuration of the NATGatewayRouting type for use with +// apply. +func NATGatewayRouting(name, namespace string) *NATGatewayRoutingApplyConfiguration { + b := &NATGatewayRoutingApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("NATGatewayRouting") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b +} + +// ExtractNATGatewayRouting extracts the applied configuration owned by fieldManager from +// nATGatewayRouting. If no managedFields are found in nATGatewayRouting for fieldManager, a +// NATGatewayRoutingApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// nATGatewayRouting must be a unmodified NATGatewayRouting API object that was retrieved from the Kubernetes API. +// ExtractNATGatewayRouting provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractNATGatewayRouting(nATGatewayRouting *apinetworkingv1alpha1.NATGatewayRouting, fieldManager string) (*NATGatewayRoutingApplyConfiguration, error) { + return extractNATGatewayRouting(nATGatewayRouting, fieldManager, "") +} + +// ExtractNATGatewayRoutingStatus is the same as ExtractNATGatewayRouting except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractNATGatewayRoutingStatus(nATGatewayRouting *apinetworkingv1alpha1.NATGatewayRouting, fieldManager string) (*NATGatewayRoutingApplyConfiguration, error) { + return extractNATGatewayRouting(nATGatewayRouting, fieldManager, "status") +} + +func extractNATGatewayRouting(nATGatewayRouting *apinetworkingv1alpha1.NATGatewayRouting, fieldManager string, subresource string) (*NATGatewayRoutingApplyConfiguration, error) { + b := &NATGatewayRoutingApplyConfiguration{} + err := managedfields.ExtractInto(nATGatewayRouting, internal.Parser().Type("com.github.onmetal.onmetal-api.api.networking.v1alpha1.NATGatewayRouting"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(nATGatewayRouting.Name) + b.WithNamespace(nATGatewayRouting.Namespace) + + b.WithKind("NATGatewayRouting") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithKind(value string) *NATGatewayRoutingApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithAPIVersion(value string) *NATGatewayRoutingApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithName(value string) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithGenerateName(value string) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithNamespace(value string) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithUID(value types.UID) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithResourceVersion(value string) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithGeneration(value int64) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithCreationTimestamp(value metav1.Time) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *NATGatewayRoutingApplyConfiguration) WithLabels(entries map[string]string) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *NATGatewayRoutingApplyConfiguration) WithAnnotations(entries map[string]string) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *NATGatewayRoutingApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *NATGatewayRoutingApplyConfiguration) WithFinalizers(values ...string) *NATGatewayRoutingApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *NATGatewayRoutingApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithNetworkRef sets the NetworkRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkRef field is set to the value of the last call. +func (b *NATGatewayRoutingApplyConfiguration) WithNetworkRef(value *v1alpha1.LocalUIDReferenceApplyConfiguration) *NATGatewayRoutingApplyConfiguration { + b.NetworkRef = value + return b +} + +// WithDestinations adds the given value to the Destinations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Destinations field. +func (b *NATGatewayRoutingApplyConfiguration) WithDestinations(values ...*NATGatewayDestinationApplyConfiguration) *NATGatewayRoutingApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithDestinations") + } + b.Destinations = append(b.Destinations, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/natgatewayspec.go b/client-go/applyconfigurations/networking/v1alpha1/natgatewayspec.go new file mode 100644 index 000000000..ad2074c5b --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/natgatewayspec.go @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + metav1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + v1 "k8s.io/api/core/v1" +) + +// NATGatewaySpecApplyConfiguration represents an declarative configuration of the NATGatewaySpec type for use +// with apply. +type NATGatewaySpecApplyConfiguration struct { + Type *v1alpha1.NATGatewayType `json:"type,omitempty"` + IPFamilies []v1.IPFamily `json:"ipFamilies,omitempty"` + IPs []NATGatewayIPApplyConfiguration `json:"ips,omitempty"` + NetworkRef *v1.LocalObjectReference `json:"networkRef,omitempty"` + NetworkInterfaceSelector *metav1.LabelSelectorApplyConfiguration `json:"networkInterfaceSelector,omitempty"` + PortsPerNetworkInterface *int32 `json:"portsPerNetworkInterface,omitempty"` +} + +// NATGatewaySpecApplyConfiguration constructs an declarative configuration of the NATGatewaySpec type for use with +// apply. +func NATGatewaySpec() *NATGatewaySpecApplyConfiguration { + return &NATGatewaySpecApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *NATGatewaySpecApplyConfiguration) WithType(value v1alpha1.NATGatewayType) *NATGatewaySpecApplyConfiguration { + b.Type = &value + return b +} + +// WithIPFamilies adds the given value to the IPFamilies field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPFamilies field. +func (b *NATGatewaySpecApplyConfiguration) WithIPFamilies(values ...v1.IPFamily) *NATGatewaySpecApplyConfiguration { + for i := range values { + b.IPFamilies = append(b.IPFamilies, values[i]) + } + return b +} + +// WithIPs adds the given value to the IPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPs field. +func (b *NATGatewaySpecApplyConfiguration) WithIPs(values ...*NATGatewayIPApplyConfiguration) *NATGatewaySpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithIPs") + } + b.IPs = append(b.IPs, *values[i]) + } + return b +} + +// WithNetworkRef sets the NetworkRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkRef field is set to the value of the last call. +func (b *NATGatewaySpecApplyConfiguration) WithNetworkRef(value v1.LocalObjectReference) *NATGatewaySpecApplyConfiguration { + b.NetworkRef = &value + return b +} + +// WithNetworkInterfaceSelector sets the NetworkInterfaceSelector field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkInterfaceSelector field is set to the value of the last call. +func (b *NATGatewaySpecApplyConfiguration) WithNetworkInterfaceSelector(value *metav1.LabelSelectorApplyConfiguration) *NATGatewaySpecApplyConfiguration { + b.NetworkInterfaceSelector = value + return b +} + +// WithPortsPerNetworkInterface sets the PortsPerNetworkInterface field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PortsPerNetworkInterface field is set to the value of the last call. +func (b *NATGatewaySpecApplyConfiguration) WithPortsPerNetworkInterface(value int32) *NATGatewaySpecApplyConfiguration { + b.PortsPerNetworkInterface = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/natgatewaystatus.go b/client-go/applyconfigurations/networking/v1alpha1/natgatewaystatus.go new file mode 100644 index 000000000..12512a71d --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/natgatewaystatus.go @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// NATGatewayStatusApplyConfiguration represents an declarative configuration of the NATGatewayStatus type for use +// with apply. +type NATGatewayStatusApplyConfiguration struct { + IPs []NATGatewayIPStatusApplyConfiguration `json:"ips,omitempty"` + PortsUsed *int32 `json:"portsUsed,omitempty"` +} + +// NATGatewayStatusApplyConfiguration constructs an declarative configuration of the NATGatewayStatus type for use with +// apply. +func NATGatewayStatus() *NATGatewayStatusApplyConfiguration { + return &NATGatewayStatusApplyConfiguration{} +} + +// WithIPs adds the given value to the IPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPs field. +func (b *NATGatewayStatusApplyConfiguration) WithIPs(values ...*NATGatewayIPStatusApplyConfiguration) *NATGatewayStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithIPs") + } + b.IPs = append(b.IPs, *values[i]) + } + return b +} + +// WithPortsUsed sets the PortsUsed field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the PortsUsed field is set to the value of the last call. +func (b *NATGatewayStatusApplyConfiguration) WithPortsUsed(value int32) *NATGatewayStatusApplyConfiguration { + b.PortsUsed = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/network.go b/client-go/applyconfigurations/networking/v1alpha1/network.go new file mode 100644 index 000000000..37800bad2 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/network.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// NetworkApplyConfiguration represents an declarative configuration of the Network type for use +// with apply. +type NetworkApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *NetworkSpecApplyConfiguration `json:"spec,omitempty"` + Status *NetworkStatusApplyConfiguration `json:"status,omitempty"` +} + +// Network constructs an declarative configuration of the Network type for use with +// apply. +func Network(name, namespace string) *NetworkApplyConfiguration { + b := &NetworkApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Network") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b +} + +// ExtractNetwork extracts the applied configuration owned by fieldManager from +// network. If no managedFields are found in network for fieldManager, a +// NetworkApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// network must be a unmodified Network API object that was retrieved from the Kubernetes API. +// ExtractNetwork provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractNetwork(network *networkingv1alpha1.Network, fieldManager string) (*NetworkApplyConfiguration, error) { + return extractNetwork(network, fieldManager, "") +} + +// ExtractNetworkStatus is the same as ExtractNetwork except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractNetworkStatus(network *networkingv1alpha1.Network, fieldManager string) (*NetworkApplyConfiguration, error) { + return extractNetwork(network, fieldManager, "status") +} + +func extractNetwork(network *networkingv1alpha1.Network, fieldManager string, subresource string) (*NetworkApplyConfiguration, error) { + b := &NetworkApplyConfiguration{} + err := managedfields.ExtractInto(network, internal.Parser().Type("com.github.onmetal.onmetal-api.api.networking.v1alpha1.Network"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(network.Name) + b.WithNamespace(network.Namespace) + + b.WithKind("Network") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithKind(value string) *NetworkApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithAPIVersion(value string) *NetworkApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithName(value string) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithGenerateName(value string) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithNamespace(value string) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithUID(value types.UID) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithResourceVersion(value string) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithGeneration(value int64) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithCreationTimestamp(value metav1.Time) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *NetworkApplyConfiguration) WithLabels(entries map[string]string) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *NetworkApplyConfiguration) WithAnnotations(entries map[string]string) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *NetworkApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *NetworkApplyConfiguration) WithFinalizers(values ...string) *NetworkApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *NetworkApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithSpec(value *NetworkSpecApplyConfiguration) *NetworkApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *NetworkApplyConfiguration) WithStatus(value *NetworkStatusApplyConfiguration) *NetworkApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/networkinterface.go b/client-go/applyconfigurations/networking/v1alpha1/networkinterface.go new file mode 100644 index 000000000..82ecc0207 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/networkinterface.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// NetworkInterfaceApplyConfiguration represents an declarative configuration of the NetworkInterface type for use +// with apply. +type NetworkInterfaceApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *NetworkInterfaceSpecApplyConfiguration `json:"spec,omitempty"` + Status *NetworkInterfaceStatusApplyConfiguration `json:"status,omitempty"` +} + +// NetworkInterface constructs an declarative configuration of the NetworkInterface type for use with +// apply. +func NetworkInterface(name, namespace string) *NetworkInterfaceApplyConfiguration { + b := &NetworkInterfaceApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("NetworkInterface") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b +} + +// ExtractNetworkInterface extracts the applied configuration owned by fieldManager from +// networkInterface. If no managedFields are found in networkInterface for fieldManager, a +// NetworkInterfaceApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// networkInterface must be a unmodified NetworkInterface API object that was retrieved from the Kubernetes API. +// ExtractNetworkInterface provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractNetworkInterface(networkInterface *networkingv1alpha1.NetworkInterface, fieldManager string) (*NetworkInterfaceApplyConfiguration, error) { + return extractNetworkInterface(networkInterface, fieldManager, "") +} + +// ExtractNetworkInterfaceStatus is the same as ExtractNetworkInterface except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractNetworkInterfaceStatus(networkInterface *networkingv1alpha1.NetworkInterface, fieldManager string) (*NetworkInterfaceApplyConfiguration, error) { + return extractNetworkInterface(networkInterface, fieldManager, "status") +} + +func extractNetworkInterface(networkInterface *networkingv1alpha1.NetworkInterface, fieldManager string, subresource string) (*NetworkInterfaceApplyConfiguration, error) { + b := &NetworkInterfaceApplyConfiguration{} + err := managedfields.ExtractInto(networkInterface, internal.Parser().Type("com.github.onmetal.onmetal-api.api.networking.v1alpha1.NetworkInterface"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(networkInterface.Name) + b.WithNamespace(networkInterface.Namespace) + + b.WithKind("NetworkInterface") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithKind(value string) *NetworkInterfaceApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithAPIVersion(value string) *NetworkInterfaceApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithName(value string) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithGenerateName(value string) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithNamespace(value string) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithUID(value types.UID) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithResourceVersion(value string) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithGeneration(value int64) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithCreationTimestamp(value metav1.Time) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *NetworkInterfaceApplyConfiguration) WithLabels(entries map[string]string) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *NetworkInterfaceApplyConfiguration) WithAnnotations(entries map[string]string) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *NetworkInterfaceApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *NetworkInterfaceApplyConfiguration) WithFinalizers(values ...string) *NetworkInterfaceApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *NetworkInterfaceApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithSpec(value *NetworkInterfaceSpecApplyConfiguration) *NetworkInterfaceApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *NetworkInterfaceApplyConfiguration) WithStatus(value *NetworkInterfaceStatusApplyConfiguration) *NetworkInterfaceApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/networkinterfacespec.go b/client-go/applyconfigurations/networking/v1alpha1/networkinterfacespec.go new file mode 100644 index 000000000..f4dd4bf2c --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/networkinterfacespec.go @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" + v1 "k8s.io/api/core/v1" +) + +// NetworkInterfaceSpecApplyConfiguration represents an declarative configuration of the NetworkInterfaceSpec type for use +// with apply. +type NetworkInterfaceSpecApplyConfiguration struct { + NetworkRef *v1.LocalObjectReference `json:"networkRef,omitempty"` + MachineRef *v1alpha1.LocalUIDReferenceApplyConfiguration `json:"machineRef,omitempty"` + IPFamilies []v1.IPFamily `json:"ipFamilies,omitempty"` + IPs []IPSourceApplyConfiguration `json:"ips,omitempty"` + VirtualIP *VirtualIPSourceApplyConfiguration `json:"virtualIP,omitempty"` +} + +// NetworkInterfaceSpecApplyConfiguration constructs an declarative configuration of the NetworkInterfaceSpec type for use with +// apply. +func NetworkInterfaceSpec() *NetworkInterfaceSpecApplyConfiguration { + return &NetworkInterfaceSpecApplyConfiguration{} +} + +// WithNetworkRef sets the NetworkRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkRef field is set to the value of the last call. +func (b *NetworkInterfaceSpecApplyConfiguration) WithNetworkRef(value v1.LocalObjectReference) *NetworkInterfaceSpecApplyConfiguration { + b.NetworkRef = &value + return b +} + +// WithMachineRef sets the MachineRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the MachineRef field is set to the value of the last call. +func (b *NetworkInterfaceSpecApplyConfiguration) WithMachineRef(value *v1alpha1.LocalUIDReferenceApplyConfiguration) *NetworkInterfaceSpecApplyConfiguration { + b.MachineRef = value + return b +} + +// WithIPFamilies adds the given value to the IPFamilies field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPFamilies field. +func (b *NetworkInterfaceSpecApplyConfiguration) WithIPFamilies(values ...v1.IPFamily) *NetworkInterfaceSpecApplyConfiguration { + for i := range values { + b.IPFamilies = append(b.IPFamilies, values[i]) + } + return b +} + +// WithIPs adds the given value to the IPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPs field. +func (b *NetworkInterfaceSpecApplyConfiguration) WithIPs(values ...*IPSourceApplyConfiguration) *NetworkInterfaceSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithIPs") + } + b.IPs = append(b.IPs, *values[i]) + } + return b +} + +// WithVirtualIP sets the VirtualIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VirtualIP field is set to the value of the last call. +func (b *NetworkInterfaceSpecApplyConfiguration) WithVirtualIP(value *VirtualIPSourceApplyConfiguration) *NetworkInterfaceSpecApplyConfiguration { + b.VirtualIP = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/networkinterfacestatus.go b/client-go/applyconfigurations/networking/v1alpha1/networkinterfacestatus.go new file mode 100644 index 000000000..a56353e4a --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/networkinterfacestatus.go @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// NetworkInterfaceStatusApplyConfiguration represents an declarative configuration of the NetworkInterfaceStatus type for use +// with apply. +type NetworkInterfaceStatusApplyConfiguration struct { + NetworkHandle *string `json:"networkHandle,omitempty"` + IPs []v1alpha1.IP `json:"ips,omitempty"` + VirtualIP *v1alpha1.IP `json:"virtualIP,omitempty"` + Phase *networkingv1alpha1.NetworkInterfacePhase `json:"phase,omitempty"` + LastPhaseTransitionTime *v1.Time `json:"phaseLastTransitionTime,omitempty"` +} + +// NetworkInterfaceStatusApplyConfiguration constructs an declarative configuration of the NetworkInterfaceStatus type for use with +// apply. +func NetworkInterfaceStatus() *NetworkInterfaceStatusApplyConfiguration { + return &NetworkInterfaceStatusApplyConfiguration{} +} + +// WithNetworkHandle sets the NetworkHandle field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the NetworkHandle field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithNetworkHandle(value string) *NetworkInterfaceStatusApplyConfiguration { + b.NetworkHandle = &value + return b +} + +// WithIPs adds the given value to the IPs field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the IPs field. +func (b *NetworkInterfaceStatusApplyConfiguration) WithIPs(values ...v1alpha1.IP) *NetworkInterfaceStatusApplyConfiguration { + for i := range values { + b.IPs = append(b.IPs, values[i]) + } + return b +} + +// WithVirtualIP sets the VirtualIP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VirtualIP field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithVirtualIP(value v1alpha1.IP) *NetworkInterfaceStatusApplyConfiguration { + b.VirtualIP = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithPhase(value networkingv1alpha1.NetworkInterfacePhase) *NetworkInterfaceStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithLastPhaseTransitionTime sets the LastPhaseTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastPhaseTransitionTime field is set to the value of the last call. +func (b *NetworkInterfaceStatusApplyConfiguration) WithLastPhaseTransitionTime(value v1.Time) *NetworkInterfaceStatusApplyConfiguration { + b.LastPhaseTransitionTime = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/networkinterfacetemplatespec.go b/client-go/applyconfigurations/networking/v1alpha1/networkinterfacetemplatespec.go new file mode 100644 index 000000000..3f021a0cf --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/networkinterfacetemplatespec.go @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" +) + +// NetworkInterfaceTemplateSpecApplyConfiguration represents an declarative configuration of the NetworkInterfaceTemplateSpec type for use +// with apply. +type NetworkInterfaceTemplateSpecApplyConfiguration struct { + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *NetworkInterfaceSpecApplyConfiguration `json:"spec,omitempty"` +} + +// NetworkInterfaceTemplateSpecApplyConfiguration constructs an declarative configuration of the NetworkInterfaceTemplateSpec type for use with +// apply. +func NetworkInterfaceTemplateSpec() *NetworkInterfaceTemplateSpecApplyConfiguration { + return &NetworkInterfaceTemplateSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithName(value string) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithGenerateName(value string) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithNamespace(value string) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithUID(value types.UID) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithResourceVersion(value string) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithGeneration(value int64) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *NetworkInterfaceTemplateSpecApplyConfiguration) WithSpec(value *NetworkInterfaceSpecApplyConfiguration) *NetworkInterfaceTemplateSpecApplyConfiguration { + b.Spec = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/networkspec.go b/client-go/applyconfigurations/networking/v1alpha1/networkspec.go new file mode 100644 index 000000000..53cd6a1bb --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/networkspec.go @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +// NetworkSpecApplyConfiguration represents an declarative configuration of the NetworkSpec type for use +// with apply. +type NetworkSpecApplyConfiguration struct { + ProviderID *string `json:"providerID,omitempty"` +} + +// NetworkSpecApplyConfiguration constructs an declarative configuration of the NetworkSpec type for use with +// apply. +func NetworkSpec() *NetworkSpecApplyConfiguration { + return &NetworkSpecApplyConfiguration{} +} + +// WithProviderID sets the ProviderID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProviderID field is set to the value of the last call. +func (b *NetworkSpecApplyConfiguration) WithProviderID(value string) *NetworkSpecApplyConfiguration { + b.ProviderID = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/networkstatus.go b/client-go/applyconfigurations/networking/v1alpha1/networkstatus.go new file mode 100644 index 000000000..9261d4235 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/networkstatus.go @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" +) + +// NetworkStatusApplyConfiguration represents an declarative configuration of the NetworkStatus type for use +// with apply. +type NetworkStatusApplyConfiguration struct { + State *v1alpha1.NetworkState `json:"state,omitempty"` +} + +// NetworkStatusApplyConfiguration constructs an declarative configuration of the NetworkStatus type for use with +// apply. +func NetworkStatus() *NetworkStatusApplyConfiguration { + return &NetworkStatusApplyConfiguration{} +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *NetworkStatusApplyConfiguration) WithState(value v1alpha1.NetworkState) *NetworkStatusApplyConfiguration { + b.State = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/prefixsource.go b/client-go/applyconfigurations/networking/v1alpha1/prefixsource.go new file mode 100644 index 000000000..fa54a8423 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/prefixsource.go @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" +) + +// PrefixSourceApplyConfiguration represents an declarative configuration of the PrefixSource type for use +// with apply. +type PrefixSourceApplyConfiguration struct { + Value *v1alpha1.IPPrefix `json:"value,omitempty"` + Ephemeral *EphemeralPrefixSourceApplyConfiguration `json:"ephemeral,omitempty"` +} + +// PrefixSourceApplyConfiguration constructs an declarative configuration of the PrefixSource type for use with +// apply. +func PrefixSource() *PrefixSourceApplyConfiguration { + return &PrefixSourceApplyConfiguration{} +} + +// WithValue sets the Value field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Value field is set to the value of the last call. +func (b *PrefixSourceApplyConfiguration) WithValue(value v1alpha1.IPPrefix) *PrefixSourceApplyConfiguration { + b.Value = &value + return b +} + +// WithEphemeral sets the Ephemeral field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ephemeral field is set to the value of the last call. +func (b *PrefixSourceApplyConfiguration) WithEphemeral(value *EphemeralPrefixSourceApplyConfiguration) *PrefixSourceApplyConfiguration { + b.Ephemeral = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/virtualip.go b/client-go/applyconfigurations/networking/v1alpha1/virtualip.go new file mode 100644 index 000000000..505167346 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/virtualip.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// VirtualIPApplyConfiguration represents an declarative configuration of the VirtualIP type for use +// with apply. +type VirtualIPApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VirtualIPSpecApplyConfiguration `json:"spec,omitempty"` + Status *VirtualIPStatusApplyConfiguration `json:"status,omitempty"` +} + +// VirtualIP constructs an declarative configuration of the VirtualIP type for use with +// apply. +func VirtualIP(name, namespace string) *VirtualIPApplyConfiguration { + b := &VirtualIPApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("VirtualIP") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b +} + +// ExtractVirtualIP extracts the applied configuration owned by fieldManager from +// virtualIP. If no managedFields are found in virtualIP for fieldManager, a +// VirtualIPApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// virtualIP must be a unmodified VirtualIP API object that was retrieved from the Kubernetes API. +// ExtractVirtualIP provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractVirtualIP(virtualIP *networkingv1alpha1.VirtualIP, fieldManager string) (*VirtualIPApplyConfiguration, error) { + return extractVirtualIP(virtualIP, fieldManager, "") +} + +// ExtractVirtualIPStatus is the same as ExtractVirtualIP except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractVirtualIPStatus(virtualIP *networkingv1alpha1.VirtualIP, fieldManager string) (*VirtualIPApplyConfiguration, error) { + return extractVirtualIP(virtualIP, fieldManager, "status") +} + +func extractVirtualIP(virtualIP *networkingv1alpha1.VirtualIP, fieldManager string, subresource string) (*VirtualIPApplyConfiguration, error) { + b := &VirtualIPApplyConfiguration{} + err := managedfields.ExtractInto(virtualIP, internal.Parser().Type("com.github.onmetal.onmetal-api.api.networking.v1alpha1.VirtualIP"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(virtualIP.Name) + b.WithNamespace(virtualIP.Namespace) + + b.WithKind("VirtualIP") + b.WithAPIVersion("networking.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithKind(value string) *VirtualIPApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithAPIVersion(value string) *VirtualIPApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithName(value string) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithGenerateName(value string) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithNamespace(value string) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithUID(value types.UID) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithResourceVersion(value string) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithGeneration(value int64) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VirtualIPApplyConfiguration) WithLabels(entries map[string]string) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VirtualIPApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VirtualIPApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VirtualIPApplyConfiguration) WithFinalizers(values ...string) *VirtualIPApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VirtualIPApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithSpec(value *VirtualIPSpecApplyConfiguration) *VirtualIPApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VirtualIPApplyConfiguration) WithStatus(value *VirtualIPStatusApplyConfiguration) *VirtualIPApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/virtualipsource.go b/client-go/applyconfigurations/networking/v1alpha1/virtualipsource.go new file mode 100644 index 000000000..6d9a6f095 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/virtualipsource.go @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// VirtualIPSourceApplyConfiguration represents an declarative configuration of the VirtualIPSource type for use +// with apply. +type VirtualIPSourceApplyConfiguration struct { + VirtualIPRef *v1.LocalObjectReference `json:"virtualIPRef,omitempty"` + Ephemeral *EphemeralVirtualIPSourceApplyConfiguration `json:"ephemeral,omitempty"` +} + +// VirtualIPSourceApplyConfiguration constructs an declarative configuration of the VirtualIPSource type for use with +// apply. +func VirtualIPSource() *VirtualIPSourceApplyConfiguration { + return &VirtualIPSourceApplyConfiguration{} +} + +// WithVirtualIPRef sets the VirtualIPRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VirtualIPRef field is set to the value of the last call. +func (b *VirtualIPSourceApplyConfiguration) WithVirtualIPRef(value v1.LocalObjectReference) *VirtualIPSourceApplyConfiguration { + b.VirtualIPRef = &value + return b +} + +// WithEphemeral sets the Ephemeral field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Ephemeral field is set to the value of the last call. +func (b *VirtualIPSourceApplyConfiguration) WithEphemeral(value *EphemeralVirtualIPSourceApplyConfiguration) *VirtualIPSourceApplyConfiguration { + b.Ephemeral = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/virtualipspec.go b/client-go/applyconfigurations/networking/v1alpha1/virtualipspec.go new file mode 100644 index 000000000..285b04985 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/virtualipspec.go @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + commonv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" + v1 "k8s.io/api/core/v1" +) + +// VirtualIPSpecApplyConfiguration represents an declarative configuration of the VirtualIPSpec type for use +// with apply. +type VirtualIPSpecApplyConfiguration struct { + Type *v1alpha1.VirtualIPType `json:"type,omitempty"` + IPFamily *v1.IPFamily `json:"ipFamily,omitempty"` + TargetRef *commonv1alpha1.LocalUIDReferenceApplyConfiguration `json:"targetRef,omitempty"` +} + +// VirtualIPSpecApplyConfiguration constructs an declarative configuration of the VirtualIPSpec type for use with +// apply. +func VirtualIPSpec() *VirtualIPSpecApplyConfiguration { + return &VirtualIPSpecApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *VirtualIPSpecApplyConfiguration) WithType(value v1alpha1.VirtualIPType) *VirtualIPSpecApplyConfiguration { + b.Type = &value + return b +} + +// WithIPFamily sets the IPFamily field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IPFamily field is set to the value of the last call. +func (b *VirtualIPSpecApplyConfiguration) WithIPFamily(value v1.IPFamily) *VirtualIPSpecApplyConfiguration { + b.IPFamily = &value + return b +} + +// WithTargetRef sets the TargetRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the TargetRef field is set to the value of the last call. +func (b *VirtualIPSpecApplyConfiguration) WithTargetRef(value *commonv1alpha1.LocalUIDReferenceApplyConfiguration) *VirtualIPSpecApplyConfiguration { + b.TargetRef = value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/virtualipstatus.go b/client-go/applyconfigurations/networking/v1alpha1/virtualipstatus.go new file mode 100644 index 000000000..561bf6a9f --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/virtualipstatus.go @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VirtualIPStatusApplyConfiguration represents an declarative configuration of the VirtualIPStatus type for use +// with apply. +type VirtualIPStatusApplyConfiguration struct { + IP *v1alpha1.IP `json:"ip,omitempty"` + Phase *networkingv1alpha1.VirtualIPPhase `json:"phase,omitempty"` + LastPhaseTransitionTime *v1.Time `json:"phaseLastTransitionTime,omitempty"` +} + +// VirtualIPStatusApplyConfiguration constructs an declarative configuration of the VirtualIPStatus type for use with +// apply. +func VirtualIPStatus() *VirtualIPStatusApplyConfiguration { + return &VirtualIPStatusApplyConfiguration{} +} + +// WithIP sets the IP field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the IP field is set to the value of the last call. +func (b *VirtualIPStatusApplyConfiguration) WithIP(value v1alpha1.IP) *VirtualIPStatusApplyConfiguration { + b.IP = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *VirtualIPStatusApplyConfiguration) WithPhase(value networkingv1alpha1.VirtualIPPhase) *VirtualIPStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithLastPhaseTransitionTime sets the LastPhaseTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastPhaseTransitionTime field is set to the value of the last call. +func (b *VirtualIPStatusApplyConfiguration) WithLastPhaseTransitionTime(value v1.Time) *VirtualIPStatusApplyConfiguration { + b.LastPhaseTransitionTime = &value + return b +} diff --git a/client-go/applyconfigurations/networking/v1alpha1/virtualiptemplatespec.go b/client-go/applyconfigurations/networking/v1alpha1/virtualiptemplatespec.go new file mode 100644 index 000000000..c0a45e596 --- /dev/null +++ b/client-go/applyconfigurations/networking/v1alpha1/virtualiptemplatespec.go @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" +) + +// VirtualIPTemplateSpecApplyConfiguration represents an declarative configuration of the VirtualIPTemplateSpec type for use +// with apply. +type VirtualIPTemplateSpecApplyConfiguration struct { + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VirtualIPSpecApplyConfiguration `json:"spec,omitempty"` +} + +// VirtualIPTemplateSpecApplyConfiguration constructs an declarative configuration of the VirtualIPTemplateSpec type for use with +// apply. +func VirtualIPTemplateSpec() *VirtualIPTemplateSpecApplyConfiguration { + return &VirtualIPTemplateSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithName(value string) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithGenerateName(value string) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithNamespace(value string) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithUID(value types.UID) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithResourceVersion(value string) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithGeneration(value int64) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *VirtualIPTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VirtualIPTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VirtualIPTemplateSpecApplyConfiguration) WithSpec(value *VirtualIPSpecApplyConfiguration) *VirtualIPTemplateSpecApplyConfiguration { + b.Spec = value + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volume.go b/client-go/applyconfigurations/storage/v1alpha1/volume.go new file mode 100644 index 000000000..fbdb0a1ad --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volume.go @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + storagev1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// VolumeApplyConfiguration represents an declarative configuration of the Volume type for use +// with apply. +type VolumeApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VolumeSpecApplyConfiguration `json:"spec,omitempty"` + Status *VolumeStatusApplyConfiguration `json:"status,omitempty"` +} + +// Volume constructs an declarative configuration of the Volume type for use with +// apply. +func Volume(name, namespace string) *VolumeApplyConfiguration { + b := &VolumeApplyConfiguration{} + b.WithName(name) + b.WithNamespace(namespace) + b.WithKind("Volume") + b.WithAPIVersion("storage.api.onmetal.de/v1alpha1") + return b +} + +// ExtractVolume extracts the applied configuration owned by fieldManager from +// volume. If no managedFields are found in volume for fieldManager, a +// VolumeApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// volume must be a unmodified Volume API object that was retrieved from the Kubernetes API. +// ExtractVolume provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractVolume(volume *storagev1alpha1.Volume, fieldManager string) (*VolumeApplyConfiguration, error) { + return extractVolume(volume, fieldManager, "") +} + +// ExtractVolumeStatus is the same as ExtractVolume except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractVolumeStatus(volume *storagev1alpha1.Volume, fieldManager string) (*VolumeApplyConfiguration, error) { + return extractVolume(volume, fieldManager, "status") +} + +func extractVolume(volume *storagev1alpha1.Volume, fieldManager string, subresource string) (*VolumeApplyConfiguration, error) { + b := &VolumeApplyConfiguration{} + err := managedfields.ExtractInto(volume, internal.Parser().Type("com.github.onmetal.onmetal-api.api.storage.v1alpha1.Volume"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(volume.Name) + b.WithNamespace(volume.Namespace) + + b.WithKind("Volume") + b.WithAPIVersion("storage.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithKind(value string) *VolumeApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithAPIVersion(value string) *VolumeApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithName(value string) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithGenerateName(value string) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithNamespace(value string) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithUID(value types.UID) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithResourceVersion(value string) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithGeneration(value int64) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VolumeApplyConfiguration) WithLabels(entries map[string]string) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VolumeApplyConfiguration) WithAnnotations(entries map[string]string) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VolumeApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VolumeApplyConfiguration) WithFinalizers(values ...string) *VolumeApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VolumeApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithSpec(value *VolumeSpecApplyConfiguration) *VolumeApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VolumeApplyConfiguration) WithStatus(value *VolumeStatusApplyConfiguration) *VolumeApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumeaccess.go b/client-go/applyconfigurations/storage/v1alpha1/volumeaccess.go new file mode 100644 index 000000000..18ebed492 --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumeaccess.go @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "k8s.io/api/core/v1" +) + +// VolumeAccessApplyConfiguration represents an declarative configuration of the VolumeAccess type for use +// with apply. +type VolumeAccessApplyConfiguration struct { + SecretRef *v1.LocalObjectReference `json:"secretRef,omitempty"` + Driver *string `json:"driver,omitempty"` + Handle *string `json:"handle,omitempty"` + VolumeAttributes map[string]string `json:"volumeAttributes,omitempty"` +} + +// VolumeAccessApplyConfiguration constructs an declarative configuration of the VolumeAccess type for use with +// apply. +func VolumeAccess() *VolumeAccessApplyConfiguration { + return &VolumeAccessApplyConfiguration{} +} + +// WithSecretRef sets the SecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the SecretRef field is set to the value of the last call. +func (b *VolumeAccessApplyConfiguration) WithSecretRef(value v1.LocalObjectReference) *VolumeAccessApplyConfiguration { + b.SecretRef = &value + return b +} + +// WithDriver sets the Driver field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Driver field is set to the value of the last call. +func (b *VolumeAccessApplyConfiguration) WithDriver(value string) *VolumeAccessApplyConfiguration { + b.Driver = &value + return b +} + +// WithHandle sets the Handle field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Handle field is set to the value of the last call. +func (b *VolumeAccessApplyConfiguration) WithHandle(value string) *VolumeAccessApplyConfiguration { + b.Handle = &value + return b +} + +// WithVolumeAttributes puts the entries into the VolumeAttributes field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the VolumeAttributes field, +// overwriting an existing map entries in VolumeAttributes field with the same key. +func (b *VolumeAccessApplyConfiguration) WithVolumeAttributes(entries map[string]string) *VolumeAccessApplyConfiguration { + if b.VolumeAttributes == nil && len(entries) > 0 { + b.VolumeAttributes = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.VolumeAttributes[k] = v + } + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumeclass.go b/client-go/applyconfigurations/storage/v1alpha1/volumeclass.go new file mode 100644 index 000000000..0aabd76f6 --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumeclass.go @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// VolumeClassApplyConfiguration represents an declarative configuration of the VolumeClass type for use +// with apply. +type VolumeClassApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Capabilities *corev1.ResourceList `json:"capabilities,omitempty"` +} + +// VolumeClass constructs an declarative configuration of the VolumeClass type for use with +// apply. +func VolumeClass(name string) *VolumeClassApplyConfiguration { + b := &VolumeClassApplyConfiguration{} + b.WithName(name) + b.WithKind("VolumeClass") + b.WithAPIVersion("storage.api.onmetal.de/v1alpha1") + return b +} + +// ExtractVolumeClass extracts the applied configuration owned by fieldManager from +// volumeClass. If no managedFields are found in volumeClass for fieldManager, a +// VolumeClassApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// volumeClass must be a unmodified VolumeClass API object that was retrieved from the Kubernetes API. +// ExtractVolumeClass provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractVolumeClass(volumeClass *v1alpha1.VolumeClass, fieldManager string) (*VolumeClassApplyConfiguration, error) { + return extractVolumeClass(volumeClass, fieldManager, "") +} + +// ExtractVolumeClassStatus is the same as ExtractVolumeClass except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractVolumeClassStatus(volumeClass *v1alpha1.VolumeClass, fieldManager string) (*VolumeClassApplyConfiguration, error) { + return extractVolumeClass(volumeClass, fieldManager, "status") +} + +func extractVolumeClass(volumeClass *v1alpha1.VolumeClass, fieldManager string, subresource string) (*VolumeClassApplyConfiguration, error) { + b := &VolumeClassApplyConfiguration{} + err := managedfields.ExtractInto(volumeClass, internal.Parser().Type("com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumeClass"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(volumeClass.Name) + + b.WithKind("VolumeClass") + b.WithAPIVersion("storage.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithKind(value string) *VolumeClassApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithAPIVersion(value string) *VolumeClassApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithName(value string) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithGenerateName(value string) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithNamespace(value string) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithUID(value types.UID) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithResourceVersion(value string) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithGeneration(value int64) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VolumeClassApplyConfiguration) WithLabels(entries map[string]string) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VolumeClassApplyConfiguration) WithAnnotations(entries map[string]string) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VolumeClassApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VolumeClassApplyConfiguration) WithFinalizers(values ...string) *VolumeClassApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VolumeClassApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithCapabilities sets the Capabilities field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Capabilities field is set to the value of the last call. +func (b *VolumeClassApplyConfiguration) WithCapabilities(value corev1.ResourceList) *VolumeClassApplyConfiguration { + b.Capabilities = &value + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumecondition.go b/client-go/applyconfigurations/storage/v1alpha1/volumecondition.go new file mode 100644 index 000000000..88c799f96 --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumecondition.go @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VolumeConditionApplyConfiguration represents an declarative configuration of the VolumeCondition type for use +// with apply. +type VolumeConditionApplyConfiguration struct { + Type *v1alpha1.VolumeConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// VolumeConditionApplyConfiguration constructs an declarative configuration of the VolumeCondition type for use with +// apply. +func VolumeCondition() *VolumeConditionApplyConfiguration { + return &VolumeConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *VolumeConditionApplyConfiguration) WithType(value v1alpha1.VolumeConditionType) *VolumeConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VolumeConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *VolumeConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *VolumeConditionApplyConfiguration) WithReason(value string) *VolumeConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *VolumeConditionApplyConfiguration) WithMessage(value string) *VolumeConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *VolumeConditionApplyConfiguration) WithObservedGeneration(value int64) *VolumeConditionApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *VolumeConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *VolumeConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumepool.go b/client-go/applyconfigurations/storage/v1alpha1/volumepool.go new file mode 100644 index 000000000..35d60a9ad --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumepool.go @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + storagev1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + internal "github.com/onmetal/onmetal-api/client-go/applyconfigurations/internal" + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + managedfields "k8s.io/apimachinery/pkg/util/managedfields" +) + +// VolumePoolApplyConfiguration represents an declarative configuration of the VolumePool type for use +// with apply. +type VolumePoolApplyConfiguration struct { + v1.TypeMetaApplyConfiguration `json:",inline"` + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VolumePoolSpecApplyConfiguration `json:"spec,omitempty"` + Status *VolumePoolStatusApplyConfiguration `json:"status,omitempty"` +} + +// VolumePool constructs an declarative configuration of the VolumePool type for use with +// apply. +func VolumePool(name string) *VolumePoolApplyConfiguration { + b := &VolumePoolApplyConfiguration{} + b.WithName(name) + b.WithKind("VolumePool") + b.WithAPIVersion("storage.api.onmetal.de/v1alpha1") + return b +} + +// ExtractVolumePool extracts the applied configuration owned by fieldManager from +// volumePool. If no managedFields are found in volumePool for fieldManager, a +// VolumePoolApplyConfiguration is returned with only the Name, Namespace (if applicable), +// APIVersion and Kind populated. It is possible that no managed fields were found for because other +// field managers have taken ownership of all the fields previously owned by fieldManager, or because +// the fieldManager never owned fields any fields. +// volumePool must be a unmodified VolumePool API object that was retrieved from the Kubernetes API. +// ExtractVolumePool provides a way to perform a extract/modify-in-place/apply workflow. +// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously +// applied if another fieldManager has updated or force applied any of the previously applied fields. +// Experimental! +func ExtractVolumePool(volumePool *storagev1alpha1.VolumePool, fieldManager string) (*VolumePoolApplyConfiguration, error) { + return extractVolumePool(volumePool, fieldManager, "") +} + +// ExtractVolumePoolStatus is the same as ExtractVolumePool except +// that it extracts the status subresource applied configuration. +// Experimental! +func ExtractVolumePoolStatus(volumePool *storagev1alpha1.VolumePool, fieldManager string) (*VolumePoolApplyConfiguration, error) { + return extractVolumePool(volumePool, fieldManager, "status") +} + +func extractVolumePool(volumePool *storagev1alpha1.VolumePool, fieldManager string, subresource string) (*VolumePoolApplyConfiguration, error) { + b := &VolumePoolApplyConfiguration{} + err := managedfields.ExtractInto(volumePool, internal.Parser().Type("com.github.onmetal.onmetal-api.api.storage.v1alpha1.VolumePool"), fieldManager, b, subresource) + if err != nil { + return nil, err + } + b.WithName(volumePool.Name) + + b.WithKind("VolumePool") + b.WithAPIVersion("storage.api.onmetal.de/v1alpha1") + return b, nil +} + +// WithKind sets the Kind field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Kind field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithKind(value string) *VolumePoolApplyConfiguration { + b.Kind = &value + return b +} + +// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the APIVersion field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithAPIVersion(value string) *VolumePoolApplyConfiguration { + b.APIVersion = &value + return b +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithName(value string) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithGenerateName(value string) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithNamespace(value string) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithUID(value types.UID) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithResourceVersion(value string) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithGeneration(value int64) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VolumePoolApplyConfiguration) WithLabels(entries map[string]string) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VolumePoolApplyConfiguration) WithAnnotations(entries map[string]string) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VolumePoolApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VolumePoolApplyConfiguration) WithFinalizers(values ...string) *VolumePoolApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VolumePoolApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithSpec(value *VolumePoolSpecApplyConfiguration) *VolumePoolApplyConfiguration { + b.Spec = value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VolumePoolApplyConfiguration) WithStatus(value *VolumePoolStatusApplyConfiguration) *VolumePoolApplyConfiguration { + b.Status = value + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumepoolcondition.go b/client-go/applyconfigurations/storage/v1alpha1/volumepoolcondition.go new file mode 100644 index 000000000..a4f6e7cb3 --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumepoolcondition.go @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VolumePoolConditionApplyConfiguration represents an declarative configuration of the VolumePoolCondition type for use +// with apply. +type VolumePoolConditionApplyConfiguration struct { + Type *v1alpha1.VolumePoolConditionType `json:"type,omitempty"` + Status *v1.ConditionStatus `json:"status,omitempty"` + Reason *string `json:"reason,omitempty"` + Message *string `json:"message,omitempty"` + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + LastTransitionTime *metav1.Time `json:"lastTransitionTime,omitempty"` +} + +// VolumePoolConditionApplyConfiguration constructs an declarative configuration of the VolumePoolCondition type for use with +// apply. +func VolumePoolCondition() *VolumePoolConditionApplyConfiguration { + return &VolumePoolConditionApplyConfiguration{} +} + +// WithType sets the Type field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Type field is set to the value of the last call. +func (b *VolumePoolConditionApplyConfiguration) WithType(value v1alpha1.VolumePoolConditionType) *VolumePoolConditionApplyConfiguration { + b.Type = &value + return b +} + +// WithStatus sets the Status field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Status field is set to the value of the last call. +func (b *VolumePoolConditionApplyConfiguration) WithStatus(value v1.ConditionStatus) *VolumePoolConditionApplyConfiguration { + b.Status = &value + return b +} + +// WithReason sets the Reason field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Reason field is set to the value of the last call. +func (b *VolumePoolConditionApplyConfiguration) WithReason(value string) *VolumePoolConditionApplyConfiguration { + b.Reason = &value + return b +} + +// WithMessage sets the Message field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Message field is set to the value of the last call. +func (b *VolumePoolConditionApplyConfiguration) WithMessage(value string) *VolumePoolConditionApplyConfiguration { + b.Message = &value + return b +} + +// WithObservedGeneration sets the ObservedGeneration field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ObservedGeneration field is set to the value of the last call. +func (b *VolumePoolConditionApplyConfiguration) WithObservedGeneration(value int64) *VolumePoolConditionApplyConfiguration { + b.ObservedGeneration = &value + return b +} + +// WithLastTransitionTime sets the LastTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastTransitionTime field is set to the value of the last call. +func (b *VolumePoolConditionApplyConfiguration) WithLastTransitionTime(value metav1.Time) *VolumePoolConditionApplyConfiguration { + b.LastTransitionTime = &value + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumepoolspec.go b/client-go/applyconfigurations/storage/v1alpha1/volumepoolspec.go new file mode 100644 index 000000000..4808c43af --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumepoolspec.go @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" +) + +// VolumePoolSpecApplyConfiguration represents an declarative configuration of the VolumePoolSpec type for use +// with apply. +type VolumePoolSpecApplyConfiguration struct { + ProviderID *string `json:"providerID,omitempty"` + Taints []v1alpha1.TaintApplyConfiguration `json:"taints,omitempty"` +} + +// VolumePoolSpecApplyConfiguration constructs an declarative configuration of the VolumePoolSpec type for use with +// apply. +func VolumePoolSpec() *VolumePoolSpecApplyConfiguration { + return &VolumePoolSpecApplyConfiguration{} +} + +// WithProviderID sets the ProviderID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ProviderID field is set to the value of the last call. +func (b *VolumePoolSpecApplyConfiguration) WithProviderID(value string) *VolumePoolSpecApplyConfiguration { + b.ProviderID = &value + return b +} + +// WithTaints adds the given value to the Taints field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Taints field. +func (b *VolumePoolSpecApplyConfiguration) WithTaints(values ...*v1alpha1.TaintApplyConfiguration) *VolumePoolSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTaints") + } + b.Taints = append(b.Taints, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumepoolstatus.go b/client-go/applyconfigurations/storage/v1alpha1/volumepoolstatus.go new file mode 100644 index 000000000..6a3ea06c0 --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumepoolstatus.go @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + v1 "k8s.io/api/core/v1" +) + +// VolumePoolStatusApplyConfiguration represents an declarative configuration of the VolumePoolStatus type for use +// with apply. +type VolumePoolStatusApplyConfiguration struct { + State *v1alpha1.VolumePoolState `json:"state,omitempty"` + Conditions []VolumePoolConditionApplyConfiguration `json:"conditions,omitempty"` + AvailableVolumeClasses []v1.LocalObjectReference `json:"availableVolumeClasses,omitempty"` + Available *v1.ResourceList `json:"available,omitempty"` + Used *v1.ResourceList `json:"used,omitempty"` +} + +// VolumePoolStatusApplyConfiguration constructs an declarative configuration of the VolumePoolStatus type for use with +// apply. +func VolumePoolStatus() *VolumePoolStatusApplyConfiguration { + return &VolumePoolStatusApplyConfiguration{} +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *VolumePoolStatusApplyConfiguration) WithState(value v1alpha1.VolumePoolState) *VolumePoolStatusApplyConfiguration { + b.State = &value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *VolumePoolStatusApplyConfiguration) WithConditions(values ...*VolumePoolConditionApplyConfiguration) *VolumePoolStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} + +// WithAvailableVolumeClasses adds the given value to the AvailableVolumeClasses field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the AvailableVolumeClasses field. +func (b *VolumePoolStatusApplyConfiguration) WithAvailableVolumeClasses(values ...v1.LocalObjectReference) *VolumePoolStatusApplyConfiguration { + for i := range values { + b.AvailableVolumeClasses = append(b.AvailableVolumeClasses, values[i]) + } + return b +} + +// WithAvailable sets the Available field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Available field is set to the value of the last call. +func (b *VolumePoolStatusApplyConfiguration) WithAvailable(value v1.ResourceList) *VolumePoolStatusApplyConfiguration { + b.Available = &value + return b +} + +// WithUsed sets the Used field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Used field is set to the value of the last call. +func (b *VolumePoolStatusApplyConfiguration) WithUsed(value v1.ResourceList) *VolumePoolStatusApplyConfiguration { + b.Used = &value + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumespec.go b/client-go/applyconfigurations/storage/v1alpha1/volumespec.go new file mode 100644 index 000000000..edce4ab09 --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumespec.go @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" + v1 "k8s.io/api/core/v1" +) + +// VolumeSpecApplyConfiguration represents an declarative configuration of the VolumeSpec type for use +// with apply. +type VolumeSpecApplyConfiguration struct { + VolumeClassRef *v1.LocalObjectReference `json:"volumeClassRef,omitempty"` + VolumePoolSelector map[string]string `json:"volumePoolSelector,omitempty"` + VolumePoolRef *v1.LocalObjectReference `json:"volumePoolRef,omitempty"` + ClaimRef *v1alpha1.LocalUIDReferenceApplyConfiguration `json:"claimRef,omitempty"` + Resources *v1.ResourceList `json:"resources,omitempty"` + Image *string `json:"image,omitempty"` + ImagePullSecretRef *v1.LocalObjectReference `json:"imagePullSecretRef,omitempty"` + Unclaimable *bool `json:"unclaimable,omitempty"` + Tolerations []v1alpha1.TolerationApplyConfiguration `json:"tolerations,omitempty"` +} + +// VolumeSpecApplyConfiguration constructs an declarative configuration of the VolumeSpec type for use with +// apply. +func VolumeSpec() *VolumeSpecApplyConfiguration { + return &VolumeSpecApplyConfiguration{} +} + +// WithVolumeClassRef sets the VolumeClassRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumeClassRef field is set to the value of the last call. +func (b *VolumeSpecApplyConfiguration) WithVolumeClassRef(value v1.LocalObjectReference) *VolumeSpecApplyConfiguration { + b.VolumeClassRef = &value + return b +} + +// WithVolumePoolSelector puts the entries into the VolumePoolSelector field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the VolumePoolSelector field, +// overwriting an existing map entries in VolumePoolSelector field with the same key. +func (b *VolumeSpecApplyConfiguration) WithVolumePoolSelector(entries map[string]string) *VolumeSpecApplyConfiguration { + if b.VolumePoolSelector == nil && len(entries) > 0 { + b.VolumePoolSelector = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.VolumePoolSelector[k] = v + } + return b +} + +// WithVolumePoolRef sets the VolumePoolRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the VolumePoolRef field is set to the value of the last call. +func (b *VolumeSpecApplyConfiguration) WithVolumePoolRef(value v1.LocalObjectReference) *VolumeSpecApplyConfiguration { + b.VolumePoolRef = &value + return b +} + +// WithClaimRef sets the ClaimRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ClaimRef field is set to the value of the last call. +func (b *VolumeSpecApplyConfiguration) WithClaimRef(value *v1alpha1.LocalUIDReferenceApplyConfiguration) *VolumeSpecApplyConfiguration { + b.ClaimRef = value + return b +} + +// WithResources sets the Resources field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Resources field is set to the value of the last call. +func (b *VolumeSpecApplyConfiguration) WithResources(value v1.ResourceList) *VolumeSpecApplyConfiguration { + b.Resources = &value + return b +} + +// WithImage sets the Image field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Image field is set to the value of the last call. +func (b *VolumeSpecApplyConfiguration) WithImage(value string) *VolumeSpecApplyConfiguration { + b.Image = &value + return b +} + +// WithImagePullSecretRef sets the ImagePullSecretRef field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ImagePullSecretRef field is set to the value of the last call. +func (b *VolumeSpecApplyConfiguration) WithImagePullSecretRef(value v1.LocalObjectReference) *VolumeSpecApplyConfiguration { + b.ImagePullSecretRef = &value + return b +} + +// WithUnclaimable sets the Unclaimable field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Unclaimable field is set to the value of the last call. +func (b *VolumeSpecApplyConfiguration) WithUnclaimable(value bool) *VolumeSpecApplyConfiguration { + b.Unclaimable = &value + return b +} + +// WithTolerations adds the given value to the Tolerations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Tolerations field. +func (b *VolumeSpecApplyConfiguration) WithTolerations(values ...*v1alpha1.TolerationApplyConfiguration) *VolumeSpecApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithTolerations") + } + b.Tolerations = append(b.Tolerations, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumestatus.go b/client-go/applyconfigurations/storage/v1alpha1/volumestatus.go new file mode 100644 index 000000000..6974b79ac --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumestatus.go @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// VolumeStatusApplyConfiguration represents an declarative configuration of the VolumeStatus type for use +// with apply. +type VolumeStatusApplyConfiguration struct { + State *v1alpha1.VolumeState `json:"state,omitempty"` + LastStateTransitionTime *v1.Time `json:"lastStateTransitionTime,omitempty"` + Phase *v1alpha1.VolumePhase `json:"phase,omitempty"` + LastPhaseTransitionTime *v1.Time `json:"lastPhaseTransitionTime,omitempty"` + Access *VolumeAccessApplyConfiguration `json:"access,omitempty"` + Conditions []VolumeConditionApplyConfiguration `json:"conditions,omitempty"` +} + +// VolumeStatusApplyConfiguration constructs an declarative configuration of the VolumeStatus type for use with +// apply. +func VolumeStatus() *VolumeStatusApplyConfiguration { + return &VolumeStatusApplyConfiguration{} +} + +// WithState sets the State field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the State field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithState(value v1alpha1.VolumeState) *VolumeStatusApplyConfiguration { + b.State = &value + return b +} + +// WithLastStateTransitionTime sets the LastStateTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastStateTransitionTime field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithLastStateTransitionTime(value v1.Time) *VolumeStatusApplyConfiguration { + b.LastStateTransitionTime = &value + return b +} + +// WithPhase sets the Phase field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Phase field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithPhase(value v1alpha1.VolumePhase) *VolumeStatusApplyConfiguration { + b.Phase = &value + return b +} + +// WithLastPhaseTransitionTime sets the LastPhaseTransitionTime field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the LastPhaseTransitionTime field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithLastPhaseTransitionTime(value v1.Time) *VolumeStatusApplyConfiguration { + b.LastPhaseTransitionTime = &value + return b +} + +// WithAccess sets the Access field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Access field is set to the value of the last call. +func (b *VolumeStatusApplyConfiguration) WithAccess(value *VolumeAccessApplyConfiguration) *VolumeStatusApplyConfiguration { + b.Access = value + return b +} + +// WithConditions adds the given value to the Conditions field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Conditions field. +func (b *VolumeStatusApplyConfiguration) WithConditions(values ...*VolumeConditionApplyConfiguration) *VolumeStatusApplyConfiguration { + for i := range values { + if values[i] == nil { + panic("nil value passed to WithConditions") + } + b.Conditions = append(b.Conditions, *values[i]) + } + return b +} diff --git a/client-go/applyconfigurations/storage/v1alpha1/volumetemplatespec.go b/client-go/applyconfigurations/storage/v1alpha1/volumetemplatespec.go new file mode 100644 index 000000000..a46834a53 --- /dev/null +++ b/client-go/applyconfigurations/storage/v1alpha1/volumetemplatespec.go @@ -0,0 +1,187 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" +) + +// VolumeTemplateSpecApplyConfiguration represents an declarative configuration of the VolumeTemplateSpec type for use +// with apply. +type VolumeTemplateSpecApplyConfiguration struct { + *v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"` + Spec *VolumeSpecApplyConfiguration `json:"spec,omitempty"` +} + +// VolumeTemplateSpecApplyConfiguration constructs an declarative configuration of the VolumeTemplateSpec type for use with +// apply. +func VolumeTemplateSpec() *VolumeTemplateSpecApplyConfiguration { + return &VolumeTemplateSpecApplyConfiguration{} +} + +// WithName sets the Name field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Name field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithName(value string) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Name = &value + return b +} + +// WithGenerateName sets the GenerateName field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the GenerateName field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithGenerateName(value string) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.GenerateName = &value + return b +} + +// WithNamespace sets the Namespace field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Namespace field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithNamespace(value string) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Namespace = &value + return b +} + +// WithUID sets the UID field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the UID field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithUID(value types.UID) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.UID = &value + return b +} + +// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the ResourceVersion field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithResourceVersion(value string) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.ResourceVersion = &value + return b +} + +// WithGeneration sets the Generation field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Generation field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithGeneration(value int64) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.Generation = &value + return b +} + +// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the CreationTimestamp field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithCreationTimestamp(value metav1.Time) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.CreationTimestamp = &value + return b +} + +// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionTimestamp field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionTimestamp = &value + return b +} + +// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + b.DeletionGracePeriodSeconds = &value + return b +} + +// WithLabels puts the entries into the Labels field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Labels field, +// overwriting an existing map entries in Labels field with the same key. +func (b *VolumeTemplateSpecApplyConfiguration) WithLabels(entries map[string]string) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Labels == nil && len(entries) > 0 { + b.Labels = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Labels[k] = v + } + return b +} + +// WithAnnotations puts the entries into the Annotations field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, the entries provided by each call will be put on the Annotations field, +// overwriting an existing map entries in Annotations field with the same key. +func (b *VolumeTemplateSpecApplyConfiguration) WithAnnotations(entries map[string]string) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + if b.Annotations == nil && len(entries) > 0 { + b.Annotations = make(map[string]string, len(entries)) + } + for k, v := range entries { + b.Annotations[k] = v + } + return b +} + +// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the OwnerReferences field. +func (b *VolumeTemplateSpecApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + if values[i] == nil { + panic("nil value passed to WithOwnerReferences") + } + b.OwnerReferences = append(b.OwnerReferences, *values[i]) + } + return b +} + +// WithFinalizers adds the given value to the Finalizers field in the declarative configuration +// and returns the receiver, so that objects can be build by chaining "With" function invocations. +// If called multiple times, values provided by each call will be appended to the Finalizers field. +func (b *VolumeTemplateSpecApplyConfiguration) WithFinalizers(values ...string) *VolumeTemplateSpecApplyConfiguration { + b.ensureObjectMetaApplyConfigurationExists() + for i := range values { + b.Finalizers = append(b.Finalizers, values[i]) + } + return b +} + +func (b *VolumeTemplateSpecApplyConfiguration) ensureObjectMetaApplyConfigurationExists() { + if b.ObjectMetaApplyConfiguration == nil { + b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{} + } +} + +// WithSpec sets the Spec field in the declarative configuration to the given value +// and returns the receiver, so that objects can be built by chaining "With" function invocations. +// If called multiple times, the Spec field is set to the value of the last call. +func (b *VolumeTemplateSpecApplyConfiguration) WithSpec(value *VolumeSpecApplyConfiguration) *VolumeTemplateSpecApplyConfiguration { + b.Spec = value + return b +} diff --git a/client-go/applyconfigurations/utils.go b/client-go/applyconfigurations/utils.go new file mode 100644 index 000000000..20c7af2fc --- /dev/null +++ b/client-go/applyconfigurations/utils.go @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2022 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. + */ +// Code generated by applyconfiguration-gen. DO NOT EDIT. + +package applyconfigurations + +import ( + v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" + computev1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + ipamv1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + storagev1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + commonv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/common/v1alpha1" + applyconfigurationscomputev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/compute/v1alpha1" + applyconfigurationsipamv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/ipam/v1alpha1" + metav1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/meta/v1" + applyconfigurationsnetworkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" + applyconfigurationsstoragev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/storage/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + schema "k8s.io/apimachinery/pkg/runtime/schema" +) + +// ForKind returns an apply configuration type for the given GroupVersionKind, or nil if no +// apply configuration type exists for the given GroupVersionKind. +func ForKind(kind schema.GroupVersionKind) interface{} { + switch kind { + // Group=common.api.onmetal.de, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithKind("LocalUIDReference"): + return &commonv1alpha1.LocalUIDReferenceApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("SecretKeySelector"): + return &commonv1alpha1.SecretKeySelectorApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Taint"): + return &commonv1alpha1.TaintApplyConfiguration{} + case v1alpha1.SchemeGroupVersion.WithKind("Toleration"): + return &commonv1alpha1.TolerationApplyConfiguration{} + + // Group=compute.api.onmetal.de, Version=v1alpha1 + case computev1alpha1.SchemeGroupVersion.WithKind("DaemonEndpoint"): + return &applyconfigurationscomputev1alpha1.DaemonEndpointApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("EFIVar"): + return &applyconfigurationscomputev1alpha1.EFIVarApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("EmptyDiskVolumeSource"): + return &applyconfigurationscomputev1alpha1.EmptyDiskVolumeSourceApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("EmptyDiskVolumeStatus"): + return &applyconfigurationscomputev1alpha1.EmptyDiskVolumeStatusApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("EphemeralNetworkInterfaceSource"): + return &applyconfigurationscomputev1alpha1.EphemeralNetworkInterfaceSourceApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("EphemeralVolumeSource"): + return &applyconfigurationscomputev1alpha1.EphemeralVolumeSourceApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("Machine"): + return &applyconfigurationscomputev1alpha1.MachineApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachineClass"): + return &applyconfigurationscomputev1alpha1.MachineClassApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachineCondition"): + return &applyconfigurationscomputev1alpha1.MachineConditionApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachinePool"): + return &applyconfigurationscomputev1alpha1.MachinePoolApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachinePoolAddress"): + return &applyconfigurationscomputev1alpha1.MachinePoolAddressApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachinePoolCondition"): + return &applyconfigurationscomputev1alpha1.MachinePoolConditionApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachinePoolDaemonEndpoints"): + return &applyconfigurationscomputev1alpha1.MachinePoolDaemonEndpointsApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachinePoolSpec"): + return &applyconfigurationscomputev1alpha1.MachinePoolSpecApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachinePoolStatus"): + return &applyconfigurationscomputev1alpha1.MachinePoolStatusApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachineSpec"): + return &applyconfigurationscomputev1alpha1.MachineSpecApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("MachineStatus"): + return &applyconfigurationscomputev1alpha1.MachineStatusApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("NetworkInterface"): + return &applyconfigurationscomputev1alpha1.NetworkInterfaceApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("NetworkInterfaceSource"): + return &applyconfigurationscomputev1alpha1.NetworkInterfaceSourceApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("NetworkInterfaceStatus"): + return &applyconfigurationscomputev1alpha1.NetworkInterfaceStatusApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("ReferencedVolumeStatus"): + return &applyconfigurationscomputev1alpha1.ReferencedVolumeStatusApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("Volume"): + return &applyconfigurationscomputev1alpha1.VolumeApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("VolumeSource"): + return &applyconfigurationscomputev1alpha1.VolumeSourceApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("VolumeSourceStatus"): + return &applyconfigurationscomputev1alpha1.VolumeSourceStatusApplyConfiguration{} + case computev1alpha1.SchemeGroupVersion.WithKind("VolumeStatus"): + return &applyconfigurationscomputev1alpha1.VolumeStatusApplyConfiguration{} + + // Group=ipam.api.onmetal.de, Version=v1alpha1 + case ipamv1alpha1.SchemeGroupVersion.WithKind("Prefix"): + return &applyconfigurationsipamv1alpha1.PrefixApplyConfiguration{} + case ipamv1alpha1.SchemeGroupVersion.WithKind("PrefixAllocation"): + return &applyconfigurationsipamv1alpha1.PrefixAllocationApplyConfiguration{} + case ipamv1alpha1.SchemeGroupVersion.WithKind("PrefixAllocationSpec"): + return &applyconfigurationsipamv1alpha1.PrefixAllocationSpecApplyConfiguration{} + case ipamv1alpha1.SchemeGroupVersion.WithKind("PrefixAllocationStatus"): + return &applyconfigurationsipamv1alpha1.PrefixAllocationStatusApplyConfiguration{} + case ipamv1alpha1.SchemeGroupVersion.WithKind("PrefixSpec"): + return &applyconfigurationsipamv1alpha1.PrefixSpecApplyConfiguration{} + case ipamv1alpha1.SchemeGroupVersion.WithKind("PrefixStatus"): + return &applyconfigurationsipamv1alpha1.PrefixStatusApplyConfiguration{} + case ipamv1alpha1.SchemeGroupVersion.WithKind("PrefixTemplateSpec"): + return &applyconfigurationsipamv1alpha1.PrefixTemplateSpecApplyConfiguration{} + + // Group=meta.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithKind("LabelSelector"): + return &metav1.LabelSelectorApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("LabelSelectorRequirement"): + return &metav1.LabelSelectorRequirementApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ManagedFieldsEntry"): + return &metav1.ManagedFieldsEntryApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("ObjectMeta"): + return &metav1.ObjectMetaApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("OwnerReference"): + return &metav1.OwnerReferenceApplyConfiguration{} + case v1.SchemeGroupVersion.WithKind("TypeMeta"): + return &metav1.TypeMetaApplyConfiguration{} + + // Group=networking.api.onmetal.de, Version=v1alpha1 + case networkingv1alpha1.SchemeGroupVersion.WithKind("AliasPrefix"): + return &applyconfigurationsnetworkingv1alpha1.AliasPrefixApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("AliasPrefixRouting"): + return &applyconfigurationsnetworkingv1alpha1.AliasPrefixRoutingApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("AliasPrefixSpec"): + return &applyconfigurationsnetworkingv1alpha1.AliasPrefixSpecApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("AliasPrefixStatus"): + return &applyconfigurationsnetworkingv1alpha1.AliasPrefixStatusApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("EphemeralPrefixSource"): + return &applyconfigurationsnetworkingv1alpha1.EphemeralPrefixSourceApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("EphemeralVirtualIPSource"): + return &applyconfigurationsnetworkingv1alpha1.EphemeralVirtualIPSourceApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("IPSource"): + return &applyconfigurationsnetworkingv1alpha1.IPSourceApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("LoadBalancer"): + return &applyconfigurationsnetworkingv1alpha1.LoadBalancerApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("LoadBalancerPort"): + return &applyconfigurationsnetworkingv1alpha1.LoadBalancerPortApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("LoadBalancerRouting"): + return &applyconfigurationsnetworkingv1alpha1.LoadBalancerRoutingApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("LoadBalancerSpec"): + return &applyconfigurationsnetworkingv1alpha1.LoadBalancerSpecApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("LoadBalancerStatus"): + return &applyconfigurationsnetworkingv1alpha1.LoadBalancerStatusApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NATGateway"): + return &applyconfigurationsnetworkingv1alpha1.NATGatewayApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NATGatewayDestination"): + return &applyconfigurationsnetworkingv1alpha1.NATGatewayDestinationApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NATGatewayDestinationIP"): + return &applyconfigurationsnetworkingv1alpha1.NATGatewayDestinationIPApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NATGatewayIP"): + return &applyconfigurationsnetworkingv1alpha1.NATGatewayIPApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NATGatewayIPStatus"): + return &applyconfigurationsnetworkingv1alpha1.NATGatewayIPStatusApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NATGatewayRouting"): + return &applyconfigurationsnetworkingv1alpha1.NATGatewayRoutingApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NATGatewaySpec"): + return &applyconfigurationsnetworkingv1alpha1.NATGatewaySpecApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NATGatewayStatus"): + return &applyconfigurationsnetworkingv1alpha1.NATGatewayStatusApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("Network"): + return &applyconfigurationsnetworkingv1alpha1.NetworkApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NetworkInterface"): + return &applyconfigurationsnetworkingv1alpha1.NetworkInterfaceApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NetworkInterfaceSpec"): + return &applyconfigurationsnetworkingv1alpha1.NetworkInterfaceSpecApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NetworkInterfaceStatus"): + return &applyconfigurationsnetworkingv1alpha1.NetworkInterfaceStatusApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NetworkInterfaceTemplateSpec"): + return &applyconfigurationsnetworkingv1alpha1.NetworkInterfaceTemplateSpecApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NetworkSpec"): + return &applyconfigurationsnetworkingv1alpha1.NetworkSpecApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("NetworkStatus"): + return &applyconfigurationsnetworkingv1alpha1.NetworkStatusApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("PrefixSource"): + return &applyconfigurationsnetworkingv1alpha1.PrefixSourceApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("VirtualIP"): + return &applyconfigurationsnetworkingv1alpha1.VirtualIPApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("VirtualIPSource"): + return &applyconfigurationsnetworkingv1alpha1.VirtualIPSourceApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("VirtualIPSpec"): + return &applyconfigurationsnetworkingv1alpha1.VirtualIPSpecApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("VirtualIPStatus"): + return &applyconfigurationsnetworkingv1alpha1.VirtualIPStatusApplyConfiguration{} + case networkingv1alpha1.SchemeGroupVersion.WithKind("VirtualIPTemplateSpec"): + return &applyconfigurationsnetworkingv1alpha1.VirtualIPTemplateSpecApplyConfiguration{} + + // Group=storage.api.onmetal.de, Version=v1alpha1 + case storagev1alpha1.SchemeGroupVersion.WithKind("Volume"): + return &applyconfigurationsstoragev1alpha1.VolumeApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumeAccess"): + return &applyconfigurationsstoragev1alpha1.VolumeAccessApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumeClass"): + return &applyconfigurationsstoragev1alpha1.VolumeClassApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumeCondition"): + return &applyconfigurationsstoragev1alpha1.VolumeConditionApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumePool"): + return &applyconfigurationsstoragev1alpha1.VolumePoolApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumePoolCondition"): + return &applyconfigurationsstoragev1alpha1.VolumePoolConditionApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumePoolSpec"): + return &applyconfigurationsstoragev1alpha1.VolumePoolSpecApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumePoolStatus"): + return &applyconfigurationsstoragev1alpha1.VolumePoolStatusApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumeSpec"): + return &applyconfigurationsstoragev1alpha1.VolumeSpecApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumeStatus"): + return &applyconfigurationsstoragev1alpha1.VolumeStatusApplyConfiguration{} + case storagev1alpha1.SchemeGroupVersion.WithKind("VolumeTemplateSpec"): + return &applyconfigurationsstoragev1alpha1.VolumeTemplateSpecApplyConfiguration{} + + } + return nil +} diff --git a/client-go/informers/compute/interface.go b/client-go/informers/compute/interface.go index 829f0946d..e0ca8f2e3 100644 --- a/client-go/informers/compute/interface.go +++ b/client-go/informers/compute/interface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/compute/v1alpha1/interface.go b/client-go/informers/compute/v1alpha1/interface.go index e56b61da0..2a80a0508 100644 --- a/client-go/informers/compute/v1alpha1/interface.go +++ b/client-go/informers/compute/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -49,10 +49,10 @@ func (v *version) Machines() MachineInformer { // MachineClasses returns a MachineClassInformer. func (v *version) MachineClasses() MachineClassInformer { - return &machineClassInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} + return &machineClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } // MachinePools returns a MachinePoolInformer. func (v *version) MachinePools() MachinePoolInformer { - return &machinePoolInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} + return &machinePoolInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } diff --git a/client-go/informers/compute/v1alpha1/machine.go b/client-go/informers/compute/v1alpha1/machine.go index bef8f1c5e..893e48fad 100644 --- a/client-go/informers/compute/v1alpha1/machine.go +++ b/client-go/informers/compute/v1alpha1/machine.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/compute/v1alpha1/machineclass.go b/client-go/informers/compute/v1alpha1/machineclass.go index d0092ee4e..b2b20f9c1 100644 --- a/client-go/informers/compute/v1alpha1/machineclass.go +++ b/client-go/informers/compute/v1alpha1/machineclass.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -41,33 +41,32 @@ type MachineClassInformer interface { type machineClassInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string } // NewMachineClassInformer constructs a new informer for MachineClass 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 NewMachineClassInformer(client onmetalapi.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMachineClassInformer(client, namespace, resyncPeriod, indexers, nil) +func NewMachineClassInformer(client onmetalapi.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachineClassInformer(client, resyncPeriod, indexers, nil) } // NewFilteredMachineClassInformer constructs a new informer for MachineClass 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 NewFilteredMachineClassInformer(client onmetalapi.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredMachineClassInformer(client onmetalapi.Interface, 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.ComputeV1alpha1().MachineClasses(namespace).List(context.TODO(), options) + return client.ComputeV1alpha1().MachineClasses().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ComputeV1alpha1().MachineClasses(namespace).Watch(context.TODO(), options) + return client.ComputeV1alpha1().MachineClasses().Watch(context.TODO(), options) }, }, &computev1alpha1.MachineClass{}, @@ -77,7 +76,7 @@ func NewFilteredMachineClassInformer(client onmetalapi.Interface, namespace stri } func (f *machineClassInformer) defaultInformer(client onmetalapi.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMachineClassInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewFilteredMachineClassInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *machineClassInformer) Informer() cache.SharedIndexInformer { diff --git a/client-go/informers/compute/v1alpha1/machinepool.go b/client-go/informers/compute/v1alpha1/machinepool.go index 1cae5677e..5d5ca6f13 100644 --- a/client-go/informers/compute/v1alpha1/machinepool.go +++ b/client-go/informers/compute/v1alpha1/machinepool.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -41,33 +41,32 @@ type MachinePoolInformer interface { type machinePoolInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc - namespace string } // NewMachinePoolInformer constructs a new informer for MachinePool 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 NewMachinePoolInformer(client onmetalapi.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredMachinePoolInformer(client, namespace, resyncPeriod, indexers, nil) +func NewMachinePoolInformer(client onmetalapi.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMachinePoolInformer(client, resyncPeriod, indexers, nil) } // NewFilteredMachinePoolInformer constructs a new informer for MachinePool 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 NewFilteredMachinePoolInformer(client onmetalapi.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredMachinePoolInformer(client onmetalapi.Interface, 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.ComputeV1alpha1().MachinePools(namespace).List(context.TODO(), options) + return client.ComputeV1alpha1().MachinePools().List(context.TODO(), options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ComputeV1alpha1().MachinePools(namespace).Watch(context.TODO(), options) + return client.ComputeV1alpha1().MachinePools().Watch(context.TODO(), options) }, }, &computev1alpha1.MachinePool{}, @@ -77,7 +76,7 @@ func NewFilteredMachinePoolInformer(client onmetalapi.Interface, namespace strin } func (f *machinePoolInformer) defaultInformer(client onmetalapi.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredMachinePoolInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) + return NewFilteredMachinePoolInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } func (f *machinePoolInformer) Informer() cache.SharedIndexInformer { diff --git a/client-go/informers/factory.go b/client-go/informers/factory.go index 2e0c97edf..5dd5a8b2d 100644 --- a/client-go/informers/factory.go +++ b/client-go/informers/factory.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/generic.go b/client-go/informers/generic.go index ece3a73c7..66571c18f 100644 --- a/client-go/informers/generic.go +++ b/client-go/informers/generic.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/internalinterfaces/factory_interfaces.go b/client-go/informers/internalinterfaces/factory_interfaces.go index 8204edcd2..6812443ce 100644 --- a/client-go/informers/internalinterfaces/factory_interfaces.go +++ b/client-go/informers/internalinterfaces/factory_interfaces.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/ipam/interface.go b/client-go/informers/ipam/interface.go index 5beea76ff..4e1370e8d 100644 --- a/client-go/informers/ipam/interface.go +++ b/client-go/informers/ipam/interface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/ipam/v1alpha1/interface.go b/client-go/informers/ipam/v1alpha1/interface.go index 20e669d3a..41d2a6e64 100644 --- a/client-go/informers/ipam/v1alpha1/interface.go +++ b/client-go/informers/ipam/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/ipam/v1alpha1/prefix.go b/client-go/informers/ipam/v1alpha1/prefix.go index 82fd5b604..103700b08 100644 --- a/client-go/informers/ipam/v1alpha1/prefix.go +++ b/client-go/informers/ipam/v1alpha1/prefix.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/ipam/v1alpha1/prefixallocation.go b/client-go/informers/ipam/v1alpha1/prefixallocation.go index 8f0d4157b..2b546eb7e 100644 --- a/client-go/informers/ipam/v1alpha1/prefixallocation.go +++ b/client-go/informers/ipam/v1alpha1/prefixallocation.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/interface.go b/client-go/informers/networking/interface.go index f179c47d6..9d6d60a9d 100644 --- a/client-go/informers/networking/interface.go +++ b/client-go/informers/networking/interface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/aliasprefix.go b/client-go/informers/networking/v1alpha1/aliasprefix.go index c7107ade5..52b569c0d 100644 --- a/client-go/informers/networking/v1alpha1/aliasprefix.go +++ b/client-go/informers/networking/v1alpha1/aliasprefix.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/aliasprefixrouting.go b/client-go/informers/networking/v1alpha1/aliasprefixrouting.go index 9034b68a2..20a6b8d27 100644 --- a/client-go/informers/networking/v1alpha1/aliasprefixrouting.go +++ b/client-go/informers/networking/v1alpha1/aliasprefixrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/interface.go b/client-go/informers/networking/v1alpha1/interface.go index 1f0a172c6..36286ee43 100644 --- a/client-go/informers/networking/v1alpha1/interface.go +++ b/client-go/informers/networking/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/loadbalancer.go b/client-go/informers/networking/v1alpha1/loadbalancer.go index f2fd2ab99..70b5d24c1 100644 --- a/client-go/informers/networking/v1alpha1/loadbalancer.go +++ b/client-go/informers/networking/v1alpha1/loadbalancer.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/loadbalancerrouting.go b/client-go/informers/networking/v1alpha1/loadbalancerrouting.go index c9dc591c5..0d74a3461 100644 --- a/client-go/informers/networking/v1alpha1/loadbalancerrouting.go +++ b/client-go/informers/networking/v1alpha1/loadbalancerrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/natgateway.go b/client-go/informers/networking/v1alpha1/natgateway.go index 29d767918..f1cf1d3a0 100644 --- a/client-go/informers/networking/v1alpha1/natgateway.go +++ b/client-go/informers/networking/v1alpha1/natgateway.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/natgatewayrouting.go b/client-go/informers/networking/v1alpha1/natgatewayrouting.go index aa1450dd4..0a40987c3 100644 --- a/client-go/informers/networking/v1alpha1/natgatewayrouting.go +++ b/client-go/informers/networking/v1alpha1/natgatewayrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/network.go b/client-go/informers/networking/v1alpha1/network.go index 133849e17..a54e0bedd 100644 --- a/client-go/informers/networking/v1alpha1/network.go +++ b/client-go/informers/networking/v1alpha1/network.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/networkinterface.go b/client-go/informers/networking/v1alpha1/networkinterface.go index a02f2b79e..1a57ac4d7 100644 --- a/client-go/informers/networking/v1alpha1/networkinterface.go +++ b/client-go/informers/networking/v1alpha1/networkinterface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/networking/v1alpha1/virtualip.go b/client-go/informers/networking/v1alpha1/virtualip.go index 01e4016f0..ab321d641 100644 --- a/client-go/informers/networking/v1alpha1/virtualip.go +++ b/client-go/informers/networking/v1alpha1/virtualip.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/storage/interface.go b/client-go/informers/storage/interface.go index 8f0b234ce..95d936b1d 100644 --- a/client-go/informers/storage/interface.go +++ b/client-go/informers/storage/interface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/storage/v1alpha1/interface.go b/client-go/informers/storage/v1alpha1/interface.go index 20f90f98a..20a0d5e85 100644 --- a/client-go/informers/storage/v1alpha1/interface.go +++ b/client-go/informers/storage/v1alpha1/interface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/storage/v1alpha1/volume.go b/client-go/informers/storage/v1alpha1/volume.go index 7d012b4fa..1b24810d0 100644 --- a/client-go/informers/storage/v1alpha1/volume.go +++ b/client-go/informers/storage/v1alpha1/volume.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/storage/v1alpha1/volumeclass.go b/client-go/informers/storage/v1alpha1/volumeclass.go index 03a9ed49b..28364b79c 100644 --- a/client-go/informers/storage/v1alpha1/volumeclass.go +++ b/client-go/informers/storage/v1alpha1/volumeclass.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/informers/storage/v1alpha1/volumepool.go b/client-go/informers/storage/v1alpha1/volumepool.go index b0ace050a..176e6fcd9 100644 --- a/client-go/informers/storage/v1alpha1/volumepool.go +++ b/client-go/informers/storage/v1alpha1/volumepool.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/compute/v1alpha1/expansion_generated.go b/client-go/listers/compute/v1alpha1/expansion_generated.go index 790180763..cb834bba5 100644 --- a/client-go/listers/compute/v1alpha1/expansion_generated.go +++ b/client-go/listers/compute/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -29,14 +29,6 @@ type MachineNamespaceListerExpansion interface{} // MachineClassLister. type MachineClassListerExpansion interface{} -// MachineClassNamespaceListerExpansion allows custom methods to be added to -// MachineClassNamespaceLister. -type MachineClassNamespaceListerExpansion interface{} - // MachinePoolListerExpansion allows custom methods to be added to // MachinePoolLister. type MachinePoolListerExpansion interface{} - -// MachinePoolNamespaceListerExpansion allows custom methods to be added to -// MachinePoolNamespaceLister. -type MachinePoolNamespaceListerExpansion interface{} diff --git a/client-go/listers/compute/v1alpha1/machine.go b/client-go/listers/compute/v1alpha1/machine.go index 4946f9df1..33181c330 100644 --- a/client-go/listers/compute/v1alpha1/machine.go +++ b/client-go/listers/compute/v1alpha1/machine.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/compute/v1alpha1/machineclass.go b/client-go/listers/compute/v1alpha1/machineclass.go index bb33bec51..d85f9b192 100644 --- a/client-go/listers/compute/v1alpha1/machineclass.go +++ b/client-go/listers/compute/v1alpha1/machineclass.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -30,8 +30,9 @@ type MachineClassLister interface { // List lists all MachineClasses in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.MachineClass, err error) - // MachineClasses returns an object that can list and get MachineClasses. - MachineClasses(namespace string) MachineClassNamespaceLister + // Get retrieves the MachineClass from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.MachineClass, error) MachineClassListerExpansion } @@ -53,41 +54,9 @@ func (s *machineClassLister) List(selector labels.Selector) (ret []*v1alpha1.Mac return ret, err } -// MachineClasses returns an object that can list and get MachineClasses. -func (s *machineClassLister) MachineClasses(namespace string) MachineClassNamespaceLister { - return machineClassNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// MachineClassNamespaceLister helps list and get MachineClasses. -// All objects returned here must be treated as read-only. -type MachineClassNamespaceLister interface { - // List lists all MachineClasses in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.MachineClass, err error) - // Get retrieves the MachineClass from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.MachineClass, error) - MachineClassNamespaceListerExpansion -} - -// machineClassNamespaceLister implements the MachineClassNamespaceLister -// interface. -type machineClassNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all MachineClasses in the indexer for a given namespace. -func (s machineClassNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MachineClass, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.MachineClass)) - }) - return ret, err -} - -// Get retrieves the MachineClass from the indexer for a given namespace and name. -func (s machineClassNamespaceLister) Get(name string) (*v1alpha1.MachineClass, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) +// Get retrieves the MachineClass from the index for a given name. +func (s *machineClassLister) Get(name string) (*v1alpha1.MachineClass, error) { + obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } diff --git a/client-go/listers/compute/v1alpha1/machinepool.go b/client-go/listers/compute/v1alpha1/machinepool.go index 8f3df8466..19ed1a286 100644 --- a/client-go/listers/compute/v1alpha1/machinepool.go +++ b/client-go/listers/compute/v1alpha1/machinepool.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -30,8 +30,9 @@ type MachinePoolLister interface { // List lists all MachinePools in the indexer. // Objects returned here must be treated as read-only. List(selector labels.Selector) (ret []*v1alpha1.MachinePool, err error) - // MachinePools returns an object that can list and get MachinePools. - MachinePools(namespace string) MachinePoolNamespaceLister + // Get retrieves the MachinePool from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.MachinePool, error) MachinePoolListerExpansion } @@ -53,41 +54,9 @@ func (s *machinePoolLister) List(selector labels.Selector) (ret []*v1alpha1.Mach return ret, err } -// MachinePools returns an object that can list and get MachinePools. -func (s *machinePoolLister) MachinePools(namespace string) MachinePoolNamespaceLister { - return machinePoolNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// MachinePoolNamespaceLister helps list and get MachinePools. -// All objects returned here must be treated as read-only. -type MachinePoolNamespaceLister interface { - // List lists all MachinePools in the indexer for a given namespace. - // Objects returned here must be treated as read-only. - List(selector labels.Selector) (ret []*v1alpha1.MachinePool, err error) - // Get retrieves the MachinePool from the indexer for a given namespace and name. - // Objects returned here must be treated as read-only. - Get(name string) (*v1alpha1.MachinePool, error) - MachinePoolNamespaceListerExpansion -} - -// machinePoolNamespaceLister implements the MachinePoolNamespaceLister -// interface. -type machinePoolNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all MachinePools in the indexer for a given namespace. -func (s machinePoolNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MachinePool, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha1.MachinePool)) - }) - return ret, err -} - -// Get retrieves the MachinePool from the indexer for a given namespace and name. -func (s machinePoolNamespaceLister) Get(name string) (*v1alpha1.MachinePool, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) +// Get retrieves the MachinePool from the index for a given name. +func (s *machinePoolLister) Get(name string) (*v1alpha1.MachinePool, error) { + obj, exists, err := s.indexer.GetByKey(name) if err != nil { return nil, err } diff --git a/client-go/listers/ipam/v1alpha1/expansion_generated.go b/client-go/listers/ipam/v1alpha1/expansion_generated.go index 3ad667b07..97a6624db 100644 --- a/client-go/listers/ipam/v1alpha1/expansion_generated.go +++ b/client-go/listers/ipam/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/ipam/v1alpha1/prefix.go b/client-go/listers/ipam/v1alpha1/prefix.go index f0bdb6ca8..4884590af 100644 --- a/client-go/listers/ipam/v1alpha1/prefix.go +++ b/client-go/listers/ipam/v1alpha1/prefix.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/ipam/v1alpha1/prefixallocation.go b/client-go/listers/ipam/v1alpha1/prefixallocation.go index 0198358ee..b0905ab49 100644 --- a/client-go/listers/ipam/v1alpha1/prefixallocation.go +++ b/client-go/listers/ipam/v1alpha1/prefixallocation.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/aliasprefix.go b/client-go/listers/networking/v1alpha1/aliasprefix.go index 077a62180..8c7252c08 100644 --- a/client-go/listers/networking/v1alpha1/aliasprefix.go +++ b/client-go/listers/networking/v1alpha1/aliasprefix.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/aliasprefixrouting.go b/client-go/listers/networking/v1alpha1/aliasprefixrouting.go index f0ac835a0..326d6d3f2 100644 --- a/client-go/listers/networking/v1alpha1/aliasprefixrouting.go +++ b/client-go/listers/networking/v1alpha1/aliasprefixrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/expansion_generated.go b/client-go/listers/networking/v1alpha1/expansion_generated.go index 9bb6391cd..b52b8a1ac 100644 --- a/client-go/listers/networking/v1alpha1/expansion_generated.go +++ b/client-go/listers/networking/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/loadbalancer.go b/client-go/listers/networking/v1alpha1/loadbalancer.go index ed8ae6590..0e7c8278b 100644 --- a/client-go/listers/networking/v1alpha1/loadbalancer.go +++ b/client-go/listers/networking/v1alpha1/loadbalancer.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/loadbalancerrouting.go b/client-go/listers/networking/v1alpha1/loadbalancerrouting.go index 78f3397fd..76d12ff06 100644 --- a/client-go/listers/networking/v1alpha1/loadbalancerrouting.go +++ b/client-go/listers/networking/v1alpha1/loadbalancerrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/natgateway.go b/client-go/listers/networking/v1alpha1/natgateway.go index afab62607..f57c9a226 100644 --- a/client-go/listers/networking/v1alpha1/natgateway.go +++ b/client-go/listers/networking/v1alpha1/natgateway.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/natgatewayrouting.go b/client-go/listers/networking/v1alpha1/natgatewayrouting.go index 105915a9d..0884e6248 100644 --- a/client-go/listers/networking/v1alpha1/natgatewayrouting.go +++ b/client-go/listers/networking/v1alpha1/natgatewayrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/network.go b/client-go/listers/networking/v1alpha1/network.go index 7de735c5f..af358b51b 100644 --- a/client-go/listers/networking/v1alpha1/network.go +++ b/client-go/listers/networking/v1alpha1/network.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/networkinterface.go b/client-go/listers/networking/v1alpha1/networkinterface.go index cee357fb3..42f9bd70f 100644 --- a/client-go/listers/networking/v1alpha1/networkinterface.go +++ b/client-go/listers/networking/v1alpha1/networkinterface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/networking/v1alpha1/virtualip.go b/client-go/listers/networking/v1alpha1/virtualip.go index 4eb5581ec..763ce204d 100644 --- a/client-go/listers/networking/v1alpha1/virtualip.go +++ b/client-go/listers/networking/v1alpha1/virtualip.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/storage/v1alpha1/expansion_generated.go b/client-go/listers/storage/v1alpha1/expansion_generated.go index 669094969..9e5f89bf5 100644 --- a/client-go/listers/storage/v1alpha1/expansion_generated.go +++ b/client-go/listers/storage/v1alpha1/expansion_generated.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/storage/v1alpha1/volume.go b/client-go/listers/storage/v1alpha1/volume.go index 94cb9fce5..d092a71cd 100644 --- a/client-go/listers/storage/v1alpha1/volume.go +++ b/client-go/listers/storage/v1alpha1/volume.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/storage/v1alpha1/volumeclass.go b/client-go/listers/storage/v1alpha1/volumeclass.go index 78cf3c30d..53e8626c7 100644 --- a/client-go/listers/storage/v1alpha1/volumeclass.go +++ b/client-go/listers/storage/v1alpha1/volumeclass.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/listers/storage/v1alpha1/volumepool.go b/client-go/listers/storage/v1alpha1/volumepool.go index 27dfd6b3f..aa1f52669 100644 --- a/client-go/listers/storage/v1alpha1/volumepool.go +++ b/client-go/listers/storage/v1alpha1/volumepool.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/clientset.go b/client-go/onmetalapi/clientset.go index 82b453c80..0f0395ba9 100644 --- a/client-go/onmetalapi/clientset.go +++ b/client-go/onmetalapi/clientset.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/doc.go b/client-go/onmetalapi/doc.go index 3cb466edd..dd644d2d1 100644 --- a/client-go/onmetalapi/doc.go +++ b/client-go/onmetalapi/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/fake/clientset_generated.go b/client-go/onmetalapi/fake/clientset_generated.go index 5bf70a998..87ad5579d 100644 --- a/client-go/onmetalapi/fake/clientset_generated.go +++ b/client-go/onmetalapi/fake/clientset_generated.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/fake/doc.go b/client-go/onmetalapi/fake/doc.go index 4f36e72c1..ee853b060 100644 --- a/client-go/onmetalapi/fake/doc.go +++ b/client-go/onmetalapi/fake/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/fake/register.go b/client-go/onmetalapi/fake/register.go index 3a47e254b..178074ade 100644 --- a/client-go/onmetalapi/fake/register.go +++ b/client-go/onmetalapi/fake/register.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/scheme/doc.go b/client-go/onmetalapi/scheme/doc.go index d2ec82246..740c73b58 100644 --- a/client-go/onmetalapi/scheme/doc.go +++ b/client-go/onmetalapi/scheme/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/scheme/register.go b/client-go/onmetalapi/scheme/register.go index 6675acd47..a1ab2a248 100644 --- a/client-go/onmetalapi/scheme/register.go +++ b/client-go/onmetalapi/scheme/register.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/compute_client.go b/client-go/onmetalapi/typed/compute/v1alpha1/compute_client.go index 52099d299..e650c332d 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/compute_client.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/compute_client.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -41,12 +41,12 @@ func (c *ComputeV1alpha1Client) Machines(namespace string) MachineInterface { return newMachines(c, namespace) } -func (c *ComputeV1alpha1Client) MachineClasses(namespace string) MachineClassInterface { - return newMachineClasses(c, namespace) +func (c *ComputeV1alpha1Client) MachineClasses() MachineClassInterface { + return newMachineClasses(c) } -func (c *ComputeV1alpha1Client) MachinePools(namespace string) MachinePoolInterface { - return newMachinePools(c, namespace) +func (c *ComputeV1alpha1Client) MachinePools() MachinePoolInterface { + return newMachinePools(c) } // NewForConfig creates a new ComputeV1alpha1Client for the given config. diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/doc.go b/client-go/onmetalapi/typed/compute/v1alpha1/doc.go index 99176264a..5f4c971ad 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/doc.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/fake/doc.go b/client-go/onmetalapi/typed/compute/v1alpha1/fake/doc.go index 51a90c3e1..82bfa735f 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/fake/doc.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_compute_client.go b/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_compute_client.go index 7a58d92a6..b20894533 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_compute_client.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_compute_client.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -31,12 +31,12 @@ func (c *FakeComputeV1alpha1) Machines(namespace string) v1alpha1.MachineInterfa return &FakeMachines{c, namespace} } -func (c *FakeComputeV1alpha1) MachineClasses(namespace string) v1alpha1.MachineClassInterface { - return &FakeMachineClasses{c, namespace} +func (c *FakeComputeV1alpha1) MachineClasses() v1alpha1.MachineClassInterface { + return &FakeMachineClasses{c} } -func (c *FakeComputeV1alpha1) MachinePools(namespace string) v1alpha1.MachinePoolInterface { - return &FakeMachinePools{c, namespace} +func (c *FakeComputeV1alpha1) MachinePools() v1alpha1.MachinePoolInterface { + return &FakeMachinePools{c} } // RESTClient returns a RESTClient that is used to communicate diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machine.go b/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machine.go index 286237802..e8f87c7a4 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machine.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machine.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + computev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/compute/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakeMachines) Patch(ctx context.Context, name string, pt types.PatchTyp } return obj.(*v1alpha1.Machine), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied machine. +func (c *FakeMachines) Apply(ctx context.Context, machine *computev1alpha1.MachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Machine, err error) { + if machine == nil { + return nil, fmt.Errorf("machine provided to Apply must not be nil") + } + data, err := json.Marshal(machine) + if err != nil { + return nil, err + } + name := machine.Name + if name == nil { + return nil, fmt.Errorf("machine.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Machine), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeMachines) ApplyStatus(ctx context.Context, machine *computev1alpha1.MachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Machine, err error) { + if machine == nil { + return nil, fmt.Errorf("machine provided to Apply must not be nil") + } + data, err := json.Marshal(machine) + if err != nil { + return nil, err + } + name := machine.Name + if name == nil { + return nil, fmt.Errorf("machine.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(machinesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.Machine{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Machine), err +} diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machineclass.go b/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machineclass.go index 76a5484c1..c9b1829c5 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machineclass.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machineclass.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + computev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/compute/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,7 +35,6 @@ import ( // FakeMachineClasses implements MachineClassInterface type FakeMachineClasses struct { Fake *FakeComputeV1alpha1 - ns string } var machineclassesResource = schema.GroupVersionResource{Group: "compute.api.onmetal.de", Version: "v1alpha1", Resource: "machineclasses"} @@ -42,8 +44,7 @@ var machineclassesKind = schema.GroupVersionKind{Group: "compute.api.onmetal.de" // Get takes name of the machineClass, and returns the corresponding machineClass object, and an error if there is any. func (c *FakeMachineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MachineClass, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(machineclassesResource, c.ns, name), &v1alpha1.MachineClass{}) - + Invokes(testing.NewRootGetAction(machineclassesResource, name), &v1alpha1.MachineClass{}) if obj == nil { return nil, err } @@ -53,8 +54,7 @@ func (c *FakeMachineClasses) Get(ctx context.Context, name string, options v1.Ge // List takes label and field selectors, and returns the list of MachineClasses that match those selectors. func (c *FakeMachineClasses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MachineClassList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(machineclassesResource, machineclassesKind, c.ns, opts), &v1alpha1.MachineClassList{}) - + Invokes(testing.NewRootListAction(machineclassesResource, machineclassesKind, opts), &v1alpha1.MachineClassList{}) if obj == nil { return nil, err } @@ -75,15 +75,13 @@ func (c *FakeMachineClasses) List(ctx context.Context, opts v1.ListOptions) (res // Watch returns a watch.Interface that watches the requested machineClasses. func (c *FakeMachineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(machineclassesResource, c.ns, opts)) - + InvokesWatch(testing.NewRootWatchAction(machineclassesResource, opts)) } // Create takes the representation of a machineClass and creates it. Returns the server's representation of the machineClass, and an error, if there is any. func (c *FakeMachineClasses) Create(ctx context.Context, machineClass *v1alpha1.MachineClass, opts v1.CreateOptions) (result *v1alpha1.MachineClass, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(machineclassesResource, c.ns, machineClass), &v1alpha1.MachineClass{}) - + Invokes(testing.NewRootCreateAction(machineclassesResource, machineClass), &v1alpha1.MachineClass{}) if obj == nil { return nil, err } @@ -93,8 +91,7 @@ func (c *FakeMachineClasses) Create(ctx context.Context, machineClass *v1alpha1. // Update takes the representation of a machineClass and updates it. Returns the server's representation of the machineClass, and an error, if there is any. func (c *FakeMachineClasses) Update(ctx context.Context, machineClass *v1alpha1.MachineClass, opts v1.UpdateOptions) (result *v1alpha1.MachineClass, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(machineclassesResource, c.ns, machineClass), &v1alpha1.MachineClass{}) - + Invokes(testing.NewRootUpdateAction(machineclassesResource, machineClass), &v1alpha1.MachineClass{}) if obj == nil { return nil, err } @@ -104,14 +101,13 @@ func (c *FakeMachineClasses) Update(ctx context.Context, machineClass *v1alpha1. // Delete takes name of the machineClass and deletes it. Returns an error if one occurs. func (c *FakeMachineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(machineclassesResource, c.ns, name, opts), &v1alpha1.MachineClass{}) - + Invokes(testing.NewRootDeleteActionWithOptions(machineclassesResource, name, opts), &v1alpha1.MachineClass{}) return err } // DeleteCollection deletes a collection of objects. func (c *FakeMachineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(machineclassesResource, c.ns, listOpts) + action := testing.NewRootDeleteCollectionAction(machineclassesResource, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.MachineClassList{}) return err @@ -120,8 +116,28 @@ func (c *FakeMachineClasses) DeleteCollection(ctx context.Context, opts v1.Delet // Patch applies the patch and returns the patched machineClass. func (c *FakeMachineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MachineClass, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(machineclassesResource, c.ns, name, pt, data, subresources...), &v1alpha1.MachineClass{}) + Invokes(testing.NewRootPatchSubresourceAction(machineclassesResource, name, pt, data, subresources...), &v1alpha1.MachineClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachineClass), err +} +// Apply takes the given apply declarative configuration, applies it and returns the applied machineClass. +func (c *FakeMachineClasses) Apply(ctx context.Context, machineClass *computev1alpha1.MachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MachineClass, err error) { + if machineClass == nil { + return nil, fmt.Errorf("machineClass provided to Apply must not be nil") + } + data, err := json.Marshal(machineClass) + if err != nil { + return nil, err + } + name := machineClass.Name + if name == nil { + return nil, fmt.Errorf("machineClass.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(machineclassesResource, *name, types.ApplyPatchType, data), &v1alpha1.MachineClass{}) if obj == nil { return nil, err } diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machinepool.go b/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machinepool.go index 0f6ec6869..ad49dc7fe 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machinepool.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/fake/fake_machinepool.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + computev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/compute/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -32,7 +35,6 @@ import ( // FakeMachinePools implements MachinePoolInterface type FakeMachinePools struct { Fake *FakeComputeV1alpha1 - ns string } var machinepoolsResource = schema.GroupVersionResource{Group: "compute.api.onmetal.de", Version: "v1alpha1", Resource: "machinepools"} @@ -42,8 +44,7 @@ var machinepoolsKind = schema.GroupVersionKind{Group: "compute.api.onmetal.de", // Get takes name of the machinePool, and returns the corresponding machinePool object, and an error if there is any. func (c *FakeMachinePools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MachinePool, err error) { obj, err := c.Fake. - Invokes(testing.NewGetAction(machinepoolsResource, c.ns, name), &v1alpha1.MachinePool{}) - + Invokes(testing.NewRootGetAction(machinepoolsResource, name), &v1alpha1.MachinePool{}) if obj == nil { return nil, err } @@ -53,8 +54,7 @@ func (c *FakeMachinePools) Get(ctx context.Context, name string, options v1.GetO // List takes label and field selectors, and returns the list of MachinePools that match those selectors. func (c *FakeMachinePools) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MachinePoolList, err error) { obj, err := c.Fake. - Invokes(testing.NewListAction(machinepoolsResource, machinepoolsKind, c.ns, opts), &v1alpha1.MachinePoolList{}) - + Invokes(testing.NewRootListAction(machinepoolsResource, machinepoolsKind, opts), &v1alpha1.MachinePoolList{}) if obj == nil { return nil, err } @@ -75,15 +75,13 @@ func (c *FakeMachinePools) List(ctx context.Context, opts v1.ListOptions) (resul // Watch returns a watch.Interface that watches the requested machinePools. func (c *FakeMachinePools) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { return c.Fake. - InvokesWatch(testing.NewWatchAction(machinepoolsResource, c.ns, opts)) - + InvokesWatch(testing.NewRootWatchAction(machinepoolsResource, opts)) } // Create takes the representation of a machinePool and creates it. Returns the server's representation of the machinePool, and an error, if there is any. func (c *FakeMachinePools) Create(ctx context.Context, machinePool *v1alpha1.MachinePool, opts v1.CreateOptions) (result *v1alpha1.MachinePool, err error) { obj, err := c.Fake. - Invokes(testing.NewCreateAction(machinepoolsResource, c.ns, machinePool), &v1alpha1.MachinePool{}) - + Invokes(testing.NewRootCreateAction(machinepoolsResource, machinePool), &v1alpha1.MachinePool{}) if obj == nil { return nil, err } @@ -93,8 +91,7 @@ func (c *FakeMachinePools) Create(ctx context.Context, machinePool *v1alpha1.Mac // Update takes the representation of a machinePool and updates it. Returns the server's representation of the machinePool, and an error, if there is any. func (c *FakeMachinePools) Update(ctx context.Context, machinePool *v1alpha1.MachinePool, opts v1.UpdateOptions) (result *v1alpha1.MachinePool, err error) { obj, err := c.Fake. - Invokes(testing.NewUpdateAction(machinepoolsResource, c.ns, machinePool), &v1alpha1.MachinePool{}) - + Invokes(testing.NewRootUpdateAction(machinepoolsResource, machinePool), &v1alpha1.MachinePool{}) if obj == nil { return nil, err } @@ -105,8 +102,7 @@ func (c *FakeMachinePools) Update(ctx context.Context, machinePool *v1alpha1.Mac // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). func (c *FakeMachinePools) UpdateStatus(ctx context.Context, machinePool *v1alpha1.MachinePool, opts v1.UpdateOptions) (*v1alpha1.MachinePool, error) { obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(machinepoolsResource, "status", c.ns, machinePool), &v1alpha1.MachinePool{}) - + Invokes(testing.NewRootUpdateSubresourceAction(machinepoolsResource, "status", machinePool), &v1alpha1.MachinePool{}) if obj == nil { return nil, err } @@ -116,14 +112,13 @@ func (c *FakeMachinePools) UpdateStatus(ctx context.Context, machinePool *v1alph // Delete takes name of the machinePool and deletes it. Returns an error if one occurs. func (c *FakeMachinePools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { _, err := c.Fake. - Invokes(testing.NewDeleteActionWithOptions(machinepoolsResource, c.ns, name, opts), &v1alpha1.MachinePool{}) - + Invokes(testing.NewRootDeleteActionWithOptions(machinepoolsResource, name, opts), &v1alpha1.MachinePool{}) return err } // DeleteCollection deletes a collection of objects. func (c *FakeMachinePools) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(machinepoolsResource, c.ns, listOpts) + action := testing.NewRootDeleteCollectionAction(machinepoolsResource, listOpts) _, err := c.Fake.Invokes(action, &v1alpha1.MachinePoolList{}) return err @@ -132,8 +127,50 @@ func (c *FakeMachinePools) DeleteCollection(ctx context.Context, opts v1.DeleteO // Patch applies the patch and returns the patched machinePool. func (c *FakeMachinePools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MachinePool, err error) { obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(machinepoolsResource, c.ns, name, pt, data, subresources...), &v1alpha1.MachinePool{}) + Invokes(testing.NewRootPatchSubresourceAction(machinepoolsResource, name, pt, data, subresources...), &v1alpha1.MachinePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachinePool), err +} + +// Apply takes the given apply declarative configuration, applies it and returns the applied machinePool. +func (c *FakeMachinePools) Apply(ctx context.Context, machinePool *computev1alpha1.MachinePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MachinePool, err error) { + if machinePool == nil { + return nil, fmt.Errorf("machinePool provided to Apply must not be nil") + } + data, err := json.Marshal(machinePool) + if err != nil { + return nil, err + } + name := machinePool.Name + if name == nil { + return nil, fmt.Errorf("machinePool.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(machinepoolsResource, *name, types.ApplyPatchType, data), &v1alpha1.MachinePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MachinePool), err +} +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeMachinePools) ApplyStatus(ctx context.Context, machinePool *computev1alpha1.MachinePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MachinePool, err error) { + if machinePool == nil { + return nil, fmt.Errorf("machinePool provided to Apply must not be nil") + } + data, err := json.Marshal(machinePool) + if err != nil { + return nil, err + } + name := machinePool.Name + if name == nil { + return nil, fmt.Errorf("machinePool.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(machinepoolsResource, *name, types.ApplyPatchType, data, "status"), &v1alpha1.MachinePool{}) if obj == nil { return nil, err } diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/generated_expansion.go b/client-go/onmetalapi/typed/compute/v1alpha1/generated_expansion.go index 534e61262..4a0eb1fae 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/generated_expansion.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/machine.go b/client-go/onmetalapi/typed/compute/v1alpha1/machine.go index d593b689a..977b59300 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/machine.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/machine.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + computev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/compute/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type MachineInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MachineList, 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.Machine, err error) + Apply(ctx context.Context, machine *computev1alpha1.MachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Machine, err error) + ApplyStatus(ctx context.Context, machine *computev1alpha1.MachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Machine, err error) MachineExpansion } @@ -192,3 +197,59 @@ func (c *machines) Patch(ctx context.Context, name string, pt types.PatchType, d Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied machine. +func (c *machines) Apply(ctx context.Context, machine *computev1alpha1.MachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Machine, err error) { + if machine == nil { + return nil, fmt.Errorf("machine provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(machine) + if err != nil { + return nil, err + } + name := machine.Name + if name == nil { + return nil, fmt.Errorf("machine.Name must be provided to Apply") + } + result = &v1alpha1.Machine{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("machines"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *machines) ApplyStatus(ctx context.Context, machine *computev1alpha1.MachineApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Machine, err error) { + if machine == nil { + return nil, fmt.Errorf("machine provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(machine) + if err != nil { + return nil, err + } + + name := machine.Name + if name == nil { + return nil, fmt.Errorf("machine.Name must be provided to Apply") + } + + result = &v1alpha1.Machine{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("machines"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/machineclass.go b/client-go/onmetalapi/typed/compute/v1alpha1/machineclass.go index b09e3ed7c..75848ed40 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/machineclass.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/machineclass.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + computev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/compute/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -32,7 +35,7 @@ import ( // MachineClassesGetter has a method to return a MachineClassInterface. // A group's client should implement this interface. type MachineClassesGetter interface { - MachineClasses(namespace string) MachineClassInterface + MachineClasses() MachineClassInterface } // MachineClassInterface has methods to work with MachineClass resources. @@ -45,20 +48,19 @@ type MachineClassInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MachineClassList, 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.MachineClass, err error) + Apply(ctx context.Context, machineClass *computev1alpha1.MachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MachineClass, err error) MachineClassExpansion } // machineClasses implements MachineClassInterface type machineClasses struct { client rest.Interface - ns string } // newMachineClasses returns a MachineClasses -func newMachineClasses(c *ComputeV1alpha1Client, namespace string) *machineClasses { +func newMachineClasses(c *ComputeV1alpha1Client) *machineClasses { return &machineClasses{ client: c.RESTClient(), - ns: namespace, } } @@ -66,7 +68,6 @@ func newMachineClasses(c *ComputeV1alpha1Client, namespace string) *machineClass func (c *machineClasses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MachineClass, err error) { result = &v1alpha1.MachineClass{} err = c.client.Get(). - Namespace(c.ns). Resource("machineclasses"). Name(name). VersionedParams(&options, scheme.ParameterCodec). @@ -83,7 +84,6 @@ func (c *machineClasses) List(ctx context.Context, opts v1.ListOptions) (result } result = &v1alpha1.MachineClassList{} err = c.client.Get(). - Namespace(c.ns). Resource("machineclasses"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). @@ -100,7 +100,6 @@ func (c *machineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch. } opts.Watch = true return c.client.Get(). - Namespace(c.ns). Resource("machineclasses"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). @@ -111,7 +110,6 @@ func (c *machineClasses) Watch(ctx context.Context, opts v1.ListOptions) (watch. func (c *machineClasses) Create(ctx context.Context, machineClass *v1alpha1.MachineClass, opts v1.CreateOptions) (result *v1alpha1.MachineClass, err error) { result = &v1alpha1.MachineClass{} err = c.client.Post(). - Namespace(c.ns). Resource("machineclasses"). VersionedParams(&opts, scheme.ParameterCodec). Body(machineClass). @@ -124,7 +122,6 @@ func (c *machineClasses) Create(ctx context.Context, machineClass *v1alpha1.Mach func (c *machineClasses) Update(ctx context.Context, machineClass *v1alpha1.MachineClass, opts v1.UpdateOptions) (result *v1alpha1.MachineClass, err error) { result = &v1alpha1.MachineClass{} err = c.client.Put(). - Namespace(c.ns). Resource("machineclasses"). Name(machineClass.Name). VersionedParams(&opts, scheme.ParameterCodec). @@ -137,7 +134,6 @@ func (c *machineClasses) Update(ctx context.Context, machineClass *v1alpha1.Mach // Delete takes name of the machineClass and deletes it. Returns an error if one occurs. func (c *machineClasses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("machineclasses"). Name(name). Body(&opts). @@ -152,7 +148,6 @@ func (c *machineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOpt timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). - Namespace(c.ns). Resource("machineclasses"). VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). @@ -165,7 +160,6 @@ func (c *machineClasses) DeleteCollection(ctx context.Context, opts v1.DeleteOpt func (c *machineClasses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MachineClass, err error) { result = &v1alpha1.MachineClass{} err = c.client.Patch(pt). - Namespace(c.ns). Resource("machineclasses"). Name(name). SubResource(subresources...). @@ -175,3 +169,28 @@ func (c *machineClasses) Patch(ctx context.Context, name string, pt types.PatchT Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied machineClass. +func (c *machineClasses) Apply(ctx context.Context, machineClass *computev1alpha1.MachineClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MachineClass, err error) { + if machineClass == nil { + return nil, fmt.Errorf("machineClass provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(machineClass) + if err != nil { + return nil, err + } + name := machineClass.Name + if name == nil { + return nil, fmt.Errorf("machineClass.Name must be provided to Apply") + } + result = &v1alpha1.MachineClass{} + err = c.client.Patch(types.ApplyPatchType). + Resource("machineclasses"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/compute/v1alpha1/machinepool.go b/client-go/onmetalapi/typed/compute/v1alpha1/machinepool.go index 71ebbee86..d45bc41f2 100644 --- a/client-go/onmetalapi/typed/compute/v1alpha1/machinepool.go +++ b/client-go/onmetalapi/typed/compute/v1alpha1/machinepool.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + computev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/compute/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -32,7 +35,7 @@ import ( // MachinePoolsGetter has a method to return a MachinePoolInterface. // A group's client should implement this interface. type MachinePoolsGetter interface { - MachinePools(namespace string) MachinePoolInterface + MachinePools() MachinePoolInterface } // MachinePoolInterface has methods to work with MachinePool resources. @@ -46,20 +49,20 @@ type MachinePoolInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MachinePoolList, 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.MachinePool, err error) + Apply(ctx context.Context, machinePool *computev1alpha1.MachinePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MachinePool, err error) + ApplyStatus(ctx context.Context, machinePool *computev1alpha1.MachinePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MachinePool, err error) MachinePoolExpansion } // machinePools implements MachinePoolInterface type machinePools struct { client rest.Interface - ns string } // newMachinePools returns a MachinePools -func newMachinePools(c *ComputeV1alpha1Client, namespace string) *machinePools { +func newMachinePools(c *ComputeV1alpha1Client) *machinePools { return &machinePools{ client: c.RESTClient(), - ns: namespace, } } @@ -67,7 +70,6 @@ func newMachinePools(c *ComputeV1alpha1Client, namespace string) *machinePools { func (c *machinePools) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MachinePool, err error) { result = &v1alpha1.MachinePool{} err = c.client.Get(). - Namespace(c.ns). Resource("machinepools"). Name(name). VersionedParams(&options, scheme.ParameterCodec). @@ -84,7 +86,6 @@ func (c *machinePools) List(ctx context.Context, opts v1.ListOptions) (result *v } result = &v1alpha1.MachinePoolList{} err = c.client.Get(). - Namespace(c.ns). Resource("machinepools"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). @@ -101,7 +102,6 @@ func (c *machinePools) Watch(ctx context.Context, opts v1.ListOptions) (watch.In } opts.Watch = true return c.client.Get(). - Namespace(c.ns). Resource("machinepools"). VersionedParams(&opts, scheme.ParameterCodec). Timeout(timeout). @@ -112,7 +112,6 @@ func (c *machinePools) Watch(ctx context.Context, opts v1.ListOptions) (watch.In func (c *machinePools) Create(ctx context.Context, machinePool *v1alpha1.MachinePool, opts v1.CreateOptions) (result *v1alpha1.MachinePool, err error) { result = &v1alpha1.MachinePool{} err = c.client.Post(). - Namespace(c.ns). Resource("machinepools"). VersionedParams(&opts, scheme.ParameterCodec). Body(machinePool). @@ -125,7 +124,6 @@ func (c *machinePools) Create(ctx context.Context, machinePool *v1alpha1.Machine func (c *machinePools) Update(ctx context.Context, machinePool *v1alpha1.MachinePool, opts v1.UpdateOptions) (result *v1alpha1.MachinePool, err error) { result = &v1alpha1.MachinePool{} err = c.client.Put(). - Namespace(c.ns). Resource("machinepools"). Name(machinePool.Name). VersionedParams(&opts, scheme.ParameterCodec). @@ -140,7 +138,6 @@ func (c *machinePools) Update(ctx context.Context, machinePool *v1alpha1.Machine func (c *machinePools) UpdateStatus(ctx context.Context, machinePool *v1alpha1.MachinePool, opts v1.UpdateOptions) (result *v1alpha1.MachinePool, err error) { result = &v1alpha1.MachinePool{} err = c.client.Put(). - Namespace(c.ns). Resource("machinepools"). Name(machinePool.Name). SubResource("status"). @@ -154,7 +151,6 @@ func (c *machinePools) UpdateStatus(ctx context.Context, machinePool *v1alpha1.M // Delete takes name of the machinePool and deletes it. Returns an error if one occurs. func (c *machinePools) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { return c.client.Delete(). - Namespace(c.ns). Resource("machinepools"). Name(name). Body(&opts). @@ -169,7 +165,6 @@ func (c *machinePools) DeleteCollection(ctx context.Context, opts v1.DeleteOptio timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second } return c.client.Delete(). - Namespace(c.ns). Resource("machinepools"). VersionedParams(&listOpts, scheme.ParameterCodec). Timeout(timeout). @@ -182,7 +177,6 @@ func (c *machinePools) DeleteCollection(ctx context.Context, opts v1.DeleteOptio func (c *machinePools) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MachinePool, err error) { result = &v1alpha1.MachinePool{} err = c.client.Patch(pt). - Namespace(c.ns). Resource("machinepools"). Name(name). SubResource(subresources...). @@ -192,3 +186,57 @@ func (c *machinePools) Patch(ctx context.Context, name string, pt types.PatchTyp Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied machinePool. +func (c *machinePools) Apply(ctx context.Context, machinePool *computev1alpha1.MachinePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MachinePool, err error) { + if machinePool == nil { + return nil, fmt.Errorf("machinePool provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(machinePool) + if err != nil { + return nil, err + } + name := machinePool.Name + if name == nil { + return nil, fmt.Errorf("machinePool.Name must be provided to Apply") + } + result = &v1alpha1.MachinePool{} + err = c.client.Patch(types.ApplyPatchType). + Resource("machinepools"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *machinePools) ApplyStatus(ctx context.Context, machinePool *computev1alpha1.MachinePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.MachinePool, err error) { + if machinePool == nil { + return nil, fmt.Errorf("machinePool provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(machinePool) + if err != nil { + return nil, err + } + + name := machinePool.Name + if name == nil { + return nil, fmt.Errorf("machinePool.Name must be provided to Apply") + } + + result = &v1alpha1.MachinePool{} + err = c.client.Patch(types.ApplyPatchType). + Resource("machinepools"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/ipam/v1alpha1/doc.go b/client-go/onmetalapi/typed/ipam/v1alpha1/doc.go index 99176264a..5f4c971ad 100644 --- a/client-go/onmetalapi/typed/ipam/v1alpha1/doc.go +++ b/client-go/onmetalapi/typed/ipam/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/ipam/v1alpha1/fake/doc.go b/client-go/onmetalapi/typed/ipam/v1alpha1/fake/doc.go index 51a90c3e1..82bfa735f 100644 --- a/client-go/onmetalapi/typed/ipam/v1alpha1/fake/doc.go +++ b/client-go/onmetalapi/typed/ipam/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_ipam_client.go b/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_ipam_client.go index 330aec6c8..5da793eba 100644 --- a/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_ipam_client.go +++ b/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_ipam_client.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_prefix.go b/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_prefix.go index 26e8830de..ecc547176 100644 --- a/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_prefix.go +++ b/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_prefix.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + ipamv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/ipam/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakePrefixes) Patch(ctx context.Context, name string, pt types.PatchTyp } return obj.(*v1alpha1.Prefix), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied prefix. +func (c *FakePrefixes) Apply(ctx context.Context, prefix *ipamv1alpha1.PrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Prefix, err error) { + if prefix == nil { + return nil, fmt.Errorf("prefix provided to Apply must not be nil") + } + data, err := json.Marshal(prefix) + if err != nil { + return nil, err + } + name := prefix.Name + if name == nil { + return nil, fmt.Errorf("prefix.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(prefixesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.Prefix{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Prefix), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakePrefixes) ApplyStatus(ctx context.Context, prefix *ipamv1alpha1.PrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Prefix, err error) { + if prefix == nil { + return nil, fmt.Errorf("prefix provided to Apply must not be nil") + } + data, err := json.Marshal(prefix) + if err != nil { + return nil, err + } + name := prefix.Name + if name == nil { + return nil, fmt.Errorf("prefix.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(prefixesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.Prefix{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Prefix), err +} diff --git a/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_prefixallocation.go b/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_prefixallocation.go index b7f294339..8e9e3ff31 100644 --- a/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_prefixallocation.go +++ b/client-go/onmetalapi/typed/ipam/v1alpha1/fake/fake_prefixallocation.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + ipamv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/ipam/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakePrefixAllocations) Patch(ctx context.Context, name string, pt types } return obj.(*v1alpha1.PrefixAllocation), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied prefixAllocation. +func (c *FakePrefixAllocations) Apply(ctx context.Context, prefixAllocation *ipamv1alpha1.PrefixAllocationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PrefixAllocation, err error) { + if prefixAllocation == nil { + return nil, fmt.Errorf("prefixAllocation provided to Apply must not be nil") + } + data, err := json.Marshal(prefixAllocation) + if err != nil { + return nil, err + } + name := prefixAllocation.Name + if name == nil { + return nil, fmt.Errorf("prefixAllocation.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(prefixallocationsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.PrefixAllocation{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PrefixAllocation), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakePrefixAllocations) ApplyStatus(ctx context.Context, prefixAllocation *ipamv1alpha1.PrefixAllocationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PrefixAllocation, err error) { + if prefixAllocation == nil { + return nil, fmt.Errorf("prefixAllocation provided to Apply must not be nil") + } + data, err := json.Marshal(prefixAllocation) + if err != nil { + return nil, err + } + name := prefixAllocation.Name + if name == nil { + return nil, fmt.Errorf("prefixAllocation.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(prefixallocationsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.PrefixAllocation{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.PrefixAllocation), err +} diff --git a/client-go/onmetalapi/typed/ipam/v1alpha1/generated_expansion.go b/client-go/onmetalapi/typed/ipam/v1alpha1/generated_expansion.go index da7831f85..c2530836f 100644 --- a/client-go/onmetalapi/typed/ipam/v1alpha1/generated_expansion.go +++ b/client-go/onmetalapi/typed/ipam/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/ipam/v1alpha1/ipam_client.go b/client-go/onmetalapi/typed/ipam/v1alpha1/ipam_client.go index 0775e5d93..11f1201a5 100644 --- a/client-go/onmetalapi/typed/ipam/v1alpha1/ipam_client.go +++ b/client-go/onmetalapi/typed/ipam/v1alpha1/ipam_client.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/ipam/v1alpha1/prefix.go b/client-go/onmetalapi/typed/ipam/v1alpha1/prefix.go index 5dfaef528..3779ea8c1 100644 --- a/client-go/onmetalapi/typed/ipam/v1alpha1/prefix.go +++ b/client-go/onmetalapi/typed/ipam/v1alpha1/prefix.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + ipamv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/ipam/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type PrefixInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PrefixList, 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.Prefix, err error) + Apply(ctx context.Context, prefix *ipamv1alpha1.PrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Prefix, err error) + ApplyStatus(ctx context.Context, prefix *ipamv1alpha1.PrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Prefix, err error) PrefixExpansion } @@ -192,3 +197,59 @@ func (c *prefixes) Patch(ctx context.Context, name string, pt types.PatchType, d Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied prefix. +func (c *prefixes) Apply(ctx context.Context, prefix *ipamv1alpha1.PrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Prefix, err error) { + if prefix == nil { + return nil, fmt.Errorf("prefix provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(prefix) + if err != nil { + return nil, err + } + name := prefix.Name + if name == nil { + return nil, fmt.Errorf("prefix.Name must be provided to Apply") + } + result = &v1alpha1.Prefix{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("prefixes"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *prefixes) ApplyStatus(ctx context.Context, prefix *ipamv1alpha1.PrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Prefix, err error) { + if prefix == nil { + return nil, fmt.Errorf("prefix provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(prefix) + if err != nil { + return nil, err + } + + name := prefix.Name + if name == nil { + return nil, fmt.Errorf("prefix.Name must be provided to Apply") + } + + result = &v1alpha1.Prefix{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("prefixes"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/ipam/v1alpha1/prefixallocation.go b/client-go/onmetalapi/typed/ipam/v1alpha1/prefixallocation.go index a82c34ce8..977daf314 100644 --- a/client-go/onmetalapi/typed/ipam/v1alpha1/prefixallocation.go +++ b/client-go/onmetalapi/typed/ipam/v1alpha1/prefixallocation.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + ipamv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/ipam/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type PrefixAllocationInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.PrefixAllocationList, 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.PrefixAllocation, err error) + Apply(ctx context.Context, prefixAllocation *ipamv1alpha1.PrefixAllocationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PrefixAllocation, err error) + ApplyStatus(ctx context.Context, prefixAllocation *ipamv1alpha1.PrefixAllocationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PrefixAllocation, err error) PrefixAllocationExpansion } @@ -192,3 +197,59 @@ func (c *prefixAllocations) Patch(ctx context.Context, name string, pt types.Pat Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied prefixAllocation. +func (c *prefixAllocations) Apply(ctx context.Context, prefixAllocation *ipamv1alpha1.PrefixAllocationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PrefixAllocation, err error) { + if prefixAllocation == nil { + return nil, fmt.Errorf("prefixAllocation provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(prefixAllocation) + if err != nil { + return nil, err + } + name := prefixAllocation.Name + if name == nil { + return nil, fmt.Errorf("prefixAllocation.Name must be provided to Apply") + } + result = &v1alpha1.PrefixAllocation{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("prefixallocations"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *prefixAllocations) ApplyStatus(ctx context.Context, prefixAllocation *ipamv1alpha1.PrefixAllocationApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.PrefixAllocation, err error) { + if prefixAllocation == nil { + return nil, fmt.Errorf("prefixAllocation provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(prefixAllocation) + if err != nil { + return nil, err + } + + name := prefixAllocation.Name + if name == nil { + return nil, fmt.Errorf("prefixAllocation.Name must be provided to Apply") + } + + result = &v1alpha1.PrefixAllocation{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("prefixallocations"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/aliasprefix.go b/client-go/onmetalapi/typed/networking/v1alpha1/aliasprefix.go index d297ef418..5f21294e5 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/aliasprefix.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/aliasprefix.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type AliasPrefixInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.AliasPrefixList, 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.AliasPrefix, err error) + Apply(ctx context.Context, aliasPrefix *networkingv1alpha1.AliasPrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.AliasPrefix, err error) + ApplyStatus(ctx context.Context, aliasPrefix *networkingv1alpha1.AliasPrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.AliasPrefix, err error) AliasPrefixExpansion } @@ -192,3 +197,59 @@ func (c *aliasPrefixes) Patch(ctx context.Context, name string, pt types.PatchTy Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied aliasPrefix. +func (c *aliasPrefixes) Apply(ctx context.Context, aliasPrefix *networkingv1alpha1.AliasPrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.AliasPrefix, err error) { + if aliasPrefix == nil { + return nil, fmt.Errorf("aliasPrefix provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(aliasPrefix) + if err != nil { + return nil, err + } + name := aliasPrefix.Name + if name == nil { + return nil, fmt.Errorf("aliasPrefix.Name must be provided to Apply") + } + result = &v1alpha1.AliasPrefix{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("aliasprefixes"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *aliasPrefixes) ApplyStatus(ctx context.Context, aliasPrefix *networkingv1alpha1.AliasPrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.AliasPrefix, err error) { + if aliasPrefix == nil { + return nil, fmt.Errorf("aliasPrefix provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(aliasPrefix) + if err != nil { + return nil, err + } + + name := aliasPrefix.Name + if name == nil { + return nil, fmt.Errorf("aliasPrefix.Name must be provided to Apply") + } + + result = &v1alpha1.AliasPrefix{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("aliasprefixes"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/aliasprefixrouting.go b/client-go/onmetalapi/typed/networking/v1alpha1/aliasprefixrouting.go index a8821fdae..49495e8f8 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/aliasprefixrouting.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/aliasprefixrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,7 @@ type AliasPrefixRoutingInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.AliasPrefixRoutingList, 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.AliasPrefixRouting, err error) + Apply(ctx context.Context, aliasPrefixRouting *networkingv1alpha1.AliasPrefixRoutingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.AliasPrefixRouting, err error) AliasPrefixRoutingExpansion } @@ -175,3 +179,29 @@ func (c *aliasPrefixRoutings) Patch(ctx context.Context, name string, pt types.P Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied aliasPrefixRouting. +func (c *aliasPrefixRoutings) Apply(ctx context.Context, aliasPrefixRouting *networkingv1alpha1.AliasPrefixRoutingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.AliasPrefixRouting, err error) { + if aliasPrefixRouting == nil { + return nil, fmt.Errorf("aliasPrefixRouting provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(aliasPrefixRouting) + if err != nil { + return nil, err + } + name := aliasPrefixRouting.Name + if name == nil { + return nil, fmt.Errorf("aliasPrefixRouting.Name must be provided to Apply") + } + result = &v1alpha1.AliasPrefixRouting{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("aliasprefixroutings"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/doc.go b/client-go/onmetalapi/typed/networking/v1alpha1/doc.go index 99176264a..5f4c971ad 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/doc.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/doc.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/doc.go index 51a90c3e1..82bfa735f 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/doc.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_aliasprefix.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_aliasprefix.go index 1e89b21a2..414c2c44a 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_aliasprefix.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_aliasprefix.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakeAliasPrefixes) Patch(ctx context.Context, name string, pt types.Pat } return obj.(*v1alpha1.AliasPrefix), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied aliasPrefix. +func (c *FakeAliasPrefixes) Apply(ctx context.Context, aliasPrefix *networkingv1alpha1.AliasPrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.AliasPrefix, err error) { + if aliasPrefix == nil { + return nil, fmt.Errorf("aliasPrefix provided to Apply must not be nil") + } + data, err := json.Marshal(aliasPrefix) + if err != nil { + return nil, err + } + name := aliasPrefix.Name + if name == nil { + return nil, fmt.Errorf("aliasPrefix.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(aliasprefixesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.AliasPrefix{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.AliasPrefix), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeAliasPrefixes) ApplyStatus(ctx context.Context, aliasPrefix *networkingv1alpha1.AliasPrefixApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.AliasPrefix, err error) { + if aliasPrefix == nil { + return nil, fmt.Errorf("aliasPrefix provided to Apply must not be nil") + } + data, err := json.Marshal(aliasPrefix) + if err != nil { + return nil, err + } + name := aliasPrefix.Name + if name == nil { + return nil, fmt.Errorf("aliasPrefix.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(aliasprefixesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.AliasPrefix{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.AliasPrefix), err +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_aliasprefixrouting.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_aliasprefixrouting.go index 41346228c..6eb22bd8a 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_aliasprefixrouting.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_aliasprefixrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -127,3 +130,25 @@ func (c *FakeAliasPrefixRoutings) Patch(ctx context.Context, name string, pt typ } return obj.(*v1alpha1.AliasPrefixRouting), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied aliasPrefixRouting. +func (c *FakeAliasPrefixRoutings) Apply(ctx context.Context, aliasPrefixRouting *networkingv1alpha1.AliasPrefixRoutingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.AliasPrefixRouting, err error) { + if aliasPrefixRouting == nil { + return nil, fmt.Errorf("aliasPrefixRouting provided to Apply must not be nil") + } + data, err := json.Marshal(aliasPrefixRouting) + if err != nil { + return nil, err + } + name := aliasPrefixRouting.Name + if name == nil { + return nil, fmt.Errorf("aliasPrefixRouting.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(aliasprefixroutingsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.AliasPrefixRouting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.AliasPrefixRouting), err +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_loadbalancer.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_loadbalancer.go index 1ed2dddd8..8bbc92b4b 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_loadbalancer.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_loadbalancer.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakeLoadBalancers) Patch(ctx context.Context, name string, pt types.Pat } return obj.(*v1alpha1.LoadBalancer), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied loadBalancer. +func (c *FakeLoadBalancers) Apply(ctx context.Context, loadBalancer *networkingv1alpha1.LoadBalancerApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.LoadBalancer, err error) { + if loadBalancer == nil { + return nil, fmt.Errorf("loadBalancer provided to Apply must not be nil") + } + data, err := json.Marshal(loadBalancer) + if err != nil { + return nil, err + } + name := loadBalancer.Name + if name == nil { + return nil, fmt.Errorf("loadBalancer.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(loadbalancersResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.LoadBalancer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.LoadBalancer), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeLoadBalancers) ApplyStatus(ctx context.Context, loadBalancer *networkingv1alpha1.LoadBalancerApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.LoadBalancer, err error) { + if loadBalancer == nil { + return nil, fmt.Errorf("loadBalancer provided to Apply must not be nil") + } + data, err := json.Marshal(loadBalancer) + if err != nil { + return nil, err + } + name := loadBalancer.Name + if name == nil { + return nil, fmt.Errorf("loadBalancer.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(loadbalancersResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.LoadBalancer{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.LoadBalancer), err +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_loadbalancerrouting.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_loadbalancerrouting.go index 60e325da0..82792e5c3 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_loadbalancerrouting.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_loadbalancerrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -127,3 +130,25 @@ func (c *FakeLoadBalancerRoutings) Patch(ctx context.Context, name string, pt ty } return obj.(*v1alpha1.LoadBalancerRouting), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied loadBalancerRouting. +func (c *FakeLoadBalancerRoutings) Apply(ctx context.Context, loadBalancerRouting *networkingv1alpha1.LoadBalancerRoutingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.LoadBalancerRouting, err error) { + if loadBalancerRouting == nil { + return nil, fmt.Errorf("loadBalancerRouting provided to Apply must not be nil") + } + data, err := json.Marshal(loadBalancerRouting) + if err != nil { + return nil, err + } + name := loadBalancerRouting.Name + if name == nil { + return nil, fmt.Errorf("loadBalancerRouting.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(loadbalancerroutingsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.LoadBalancerRouting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.LoadBalancerRouting), err +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_natgateway.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_natgateway.go index be54e8868..4e0303cef 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_natgateway.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_natgateway.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakeNATGateways) Patch(ctx context.Context, name string, pt types.Patch } return obj.(*v1alpha1.NATGateway), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied nATGateway. +func (c *FakeNATGateways) Apply(ctx context.Context, nATGateway *networkingv1alpha1.NATGatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NATGateway, err error) { + if nATGateway == nil { + return nil, fmt.Errorf("nATGateway provided to Apply must not be nil") + } + data, err := json.Marshal(nATGateway) + if err != nil { + return nil, err + } + name := nATGateway.Name + if name == nil { + return nil, fmt.Errorf("nATGateway.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(natgatewaysResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.NATGateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.NATGateway), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeNATGateways) ApplyStatus(ctx context.Context, nATGateway *networkingv1alpha1.NATGatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NATGateway, err error) { + if nATGateway == nil { + return nil, fmt.Errorf("nATGateway provided to Apply must not be nil") + } + data, err := json.Marshal(nATGateway) + if err != nil { + return nil, err + } + name := nATGateway.Name + if name == nil { + return nil, fmt.Errorf("nATGateway.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(natgatewaysResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.NATGateway{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.NATGateway), err +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_natgatewayrouting.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_natgatewayrouting.go index 10f58adc8..49d5d33ec 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_natgatewayrouting.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_natgatewayrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -127,3 +130,25 @@ func (c *FakeNATGatewayRoutings) Patch(ctx context.Context, name string, pt type } return obj.(*v1alpha1.NATGatewayRouting), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied nATGatewayRouting. +func (c *FakeNATGatewayRoutings) Apply(ctx context.Context, nATGatewayRouting *networkingv1alpha1.NATGatewayRoutingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NATGatewayRouting, err error) { + if nATGatewayRouting == nil { + return nil, fmt.Errorf("nATGatewayRouting provided to Apply must not be nil") + } + data, err := json.Marshal(nATGatewayRouting) + if err != nil { + return nil, err + } + name := nATGatewayRouting.Name + if name == nil { + return nil, fmt.Errorf("nATGatewayRouting.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(natgatewayroutingsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.NATGatewayRouting{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.NATGatewayRouting), err +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_network.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_network.go index 90d622688..8a7c2b6b4 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_network.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_network.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakeNetworks) Patch(ctx context.Context, name string, pt types.PatchTyp } return obj.(*v1alpha1.Network), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied network. +func (c *FakeNetworks) Apply(ctx context.Context, network *networkingv1alpha1.NetworkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Network, err error) { + if network == nil { + return nil, fmt.Errorf("network provided to Apply must not be nil") + } + data, err := json.Marshal(network) + if err != nil { + return nil, err + } + name := network.Name + if name == nil { + return nil, fmt.Errorf("network.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(networksResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.Network{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Network), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeNetworks) ApplyStatus(ctx context.Context, network *networkingv1alpha1.NetworkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Network, err error) { + if network == nil { + return nil, fmt.Errorf("network provided to Apply must not be nil") + } + data, err := json.Marshal(network) + if err != nil { + return nil, err + } + name := network.Name + if name == nil { + return nil, fmt.Errorf("network.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(networksResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.Network{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Network), err +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_networking_client.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_networking_client.go index 60bcbdcad..a530b0108 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_networking_client.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_networking_client.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_networkinterface.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_networkinterface.go index b954f36e9..6360b55f0 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_networkinterface.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_networkinterface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakeNetworkInterfaces) Patch(ctx context.Context, name string, pt types } return obj.(*v1alpha1.NetworkInterface), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied networkInterface. +func (c *FakeNetworkInterfaces) Apply(ctx context.Context, networkInterface *networkingv1alpha1.NetworkInterfaceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NetworkInterface, err error) { + if networkInterface == nil { + return nil, fmt.Errorf("networkInterface provided to Apply must not be nil") + } + data, err := json.Marshal(networkInterface) + if err != nil { + return nil, err + } + name := networkInterface.Name + if name == nil { + return nil, fmt.Errorf("networkInterface.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(networkinterfacesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.NetworkInterface{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.NetworkInterface), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeNetworkInterfaces) ApplyStatus(ctx context.Context, networkInterface *networkingv1alpha1.NetworkInterfaceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NetworkInterface, err error) { + if networkInterface == nil { + return nil, fmt.Errorf("networkInterface provided to Apply must not be nil") + } + data, err := json.Marshal(networkInterface) + if err != nil { + return nil, err + } + name := networkInterface.Name + if name == nil { + return nil, fmt.Errorf("networkInterface.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(networkinterfacesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.NetworkInterface{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.NetworkInterface), err +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_virtualip.go b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_virtualip.go index a04944ae3..7767b87c2 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_virtualip.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/fake/fake_virtualip.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakeVirtualIPs) Patch(ctx context.Context, name string, pt types.PatchT } return obj.(*v1alpha1.VirtualIP), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualIP. +func (c *FakeVirtualIPs) Apply(ctx context.Context, virtualIP *networkingv1alpha1.VirtualIPApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualIP, err error) { + if virtualIP == nil { + return nil, fmt.Errorf("virtualIP provided to Apply must not be nil") + } + data, err := json.Marshal(virtualIP) + if err != nil { + return nil, err + } + name := virtualIP.Name + if name == nil { + return nil, fmt.Errorf("virtualIP.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualipsResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.VirtualIP{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualIP), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeVirtualIPs) ApplyStatus(ctx context.Context, virtualIP *networkingv1alpha1.VirtualIPApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualIP, err error) { + if virtualIP == nil { + return nil, fmt.Errorf("virtualIP provided to Apply must not be nil") + } + data, err := json.Marshal(virtualIP) + if err != nil { + return nil, err + } + name := virtualIP.Name + if name == nil { + return nil, fmt.Errorf("virtualIP.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(virtualipsResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VirtualIP{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VirtualIP), err +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/generated_expansion.go b/client-go/onmetalapi/typed/networking/v1alpha1/generated_expansion.go index 81b227a30..b3a701179 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/generated_expansion.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/loadbalancer.go b/client-go/onmetalapi/typed/networking/v1alpha1/loadbalancer.go index 6b8475f7b..deef11529 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/loadbalancer.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/loadbalancer.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type LoadBalancerInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.LoadBalancerList, 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.LoadBalancer, err error) + Apply(ctx context.Context, loadBalancer *networkingv1alpha1.LoadBalancerApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.LoadBalancer, err error) + ApplyStatus(ctx context.Context, loadBalancer *networkingv1alpha1.LoadBalancerApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.LoadBalancer, err error) LoadBalancerExpansion } @@ -192,3 +197,59 @@ func (c *loadBalancers) Patch(ctx context.Context, name string, pt types.PatchTy Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied loadBalancer. +func (c *loadBalancers) Apply(ctx context.Context, loadBalancer *networkingv1alpha1.LoadBalancerApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.LoadBalancer, err error) { + if loadBalancer == nil { + return nil, fmt.Errorf("loadBalancer provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(loadBalancer) + if err != nil { + return nil, err + } + name := loadBalancer.Name + if name == nil { + return nil, fmt.Errorf("loadBalancer.Name must be provided to Apply") + } + result = &v1alpha1.LoadBalancer{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("loadbalancers"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *loadBalancers) ApplyStatus(ctx context.Context, loadBalancer *networkingv1alpha1.LoadBalancerApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.LoadBalancer, err error) { + if loadBalancer == nil { + return nil, fmt.Errorf("loadBalancer provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(loadBalancer) + if err != nil { + return nil, err + } + + name := loadBalancer.Name + if name == nil { + return nil, fmt.Errorf("loadBalancer.Name must be provided to Apply") + } + + result = &v1alpha1.LoadBalancer{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("loadbalancers"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/loadbalancerrouting.go b/client-go/onmetalapi/typed/networking/v1alpha1/loadbalancerrouting.go index 0419c40bc..8d4c58e5a 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/loadbalancerrouting.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/loadbalancerrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,7 @@ type LoadBalancerRoutingInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.LoadBalancerRoutingList, 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.LoadBalancerRouting, err error) + Apply(ctx context.Context, loadBalancerRouting *networkingv1alpha1.LoadBalancerRoutingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.LoadBalancerRouting, err error) LoadBalancerRoutingExpansion } @@ -175,3 +179,29 @@ func (c *loadBalancerRoutings) Patch(ctx context.Context, name string, pt types. Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied loadBalancerRouting. +func (c *loadBalancerRoutings) Apply(ctx context.Context, loadBalancerRouting *networkingv1alpha1.LoadBalancerRoutingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.LoadBalancerRouting, err error) { + if loadBalancerRouting == nil { + return nil, fmt.Errorf("loadBalancerRouting provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(loadBalancerRouting) + if err != nil { + return nil, err + } + name := loadBalancerRouting.Name + if name == nil { + return nil, fmt.Errorf("loadBalancerRouting.Name must be provided to Apply") + } + result = &v1alpha1.LoadBalancerRouting{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("loadbalancerroutings"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/natgateway.go b/client-go/onmetalapi/typed/networking/v1alpha1/natgateway.go index f7bda39a7..5b1ad2618 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/natgateway.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/natgateway.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type NATGatewayInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NATGatewayList, 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.NATGateway, err error) + Apply(ctx context.Context, nATGateway *networkingv1alpha1.NATGatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NATGateway, err error) + ApplyStatus(ctx context.Context, nATGateway *networkingv1alpha1.NATGatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NATGateway, err error) NATGatewayExpansion } @@ -192,3 +197,59 @@ func (c *nATGateways) Patch(ctx context.Context, name string, pt types.PatchType Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied nATGateway. +func (c *nATGateways) Apply(ctx context.Context, nATGateway *networkingv1alpha1.NATGatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NATGateway, err error) { + if nATGateway == nil { + return nil, fmt.Errorf("nATGateway provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(nATGateway) + if err != nil { + return nil, err + } + name := nATGateway.Name + if name == nil { + return nil, fmt.Errorf("nATGateway.Name must be provided to Apply") + } + result = &v1alpha1.NATGateway{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("natgateways"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *nATGateways) ApplyStatus(ctx context.Context, nATGateway *networkingv1alpha1.NATGatewayApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NATGateway, err error) { + if nATGateway == nil { + return nil, fmt.Errorf("nATGateway provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(nATGateway) + if err != nil { + return nil, err + } + + name := nATGateway.Name + if name == nil { + return nil, fmt.Errorf("nATGateway.Name must be provided to Apply") + } + + result = &v1alpha1.NATGateway{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("natgateways"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/natgatewayrouting.go b/client-go/onmetalapi/typed/networking/v1alpha1/natgatewayrouting.go index 70841f812..d2ce5a1fa 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/natgatewayrouting.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/natgatewayrouting.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,7 @@ type NATGatewayRoutingInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NATGatewayRoutingList, 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.NATGatewayRouting, err error) + Apply(ctx context.Context, nATGatewayRouting *networkingv1alpha1.NATGatewayRoutingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NATGatewayRouting, err error) NATGatewayRoutingExpansion } @@ -175,3 +179,29 @@ func (c *nATGatewayRoutings) Patch(ctx context.Context, name string, pt types.Pa Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied nATGatewayRouting. +func (c *nATGatewayRoutings) Apply(ctx context.Context, nATGatewayRouting *networkingv1alpha1.NATGatewayRoutingApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NATGatewayRouting, err error) { + if nATGatewayRouting == nil { + return nil, fmt.Errorf("nATGatewayRouting provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(nATGatewayRouting) + if err != nil { + return nil, err + } + name := nATGatewayRouting.Name + if name == nil { + return nil, fmt.Errorf("nATGatewayRouting.Name must be provided to Apply") + } + result = &v1alpha1.NATGatewayRouting{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("natgatewayroutings"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/network.go b/client-go/onmetalapi/typed/networking/v1alpha1/network.go index 03045696c..4e577c43b 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/network.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/network.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type NetworkInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NetworkList, 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.Network, err error) + Apply(ctx context.Context, network *networkingv1alpha1.NetworkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Network, err error) + ApplyStatus(ctx context.Context, network *networkingv1alpha1.NetworkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Network, err error) NetworkExpansion } @@ -192,3 +197,59 @@ func (c *networks) Patch(ctx context.Context, name string, pt types.PatchType, d Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied network. +func (c *networks) Apply(ctx context.Context, network *networkingv1alpha1.NetworkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Network, err error) { + if network == nil { + return nil, fmt.Errorf("network provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(network) + if err != nil { + return nil, err + } + name := network.Name + if name == nil { + return nil, fmt.Errorf("network.Name must be provided to Apply") + } + result = &v1alpha1.Network{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("networks"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *networks) ApplyStatus(ctx context.Context, network *networkingv1alpha1.NetworkApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Network, err error) { + if network == nil { + return nil, fmt.Errorf("network provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(network) + if err != nil { + return nil, err + } + + name := network.Name + if name == nil { + return nil, fmt.Errorf("network.Name must be provided to Apply") + } + + result = &v1alpha1.Network{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("networks"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/networking_client.go b/client-go/onmetalapi/typed/networking/v1alpha1/networking_client.go index 555671ada..c7101356c 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/networking_client.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/networking_client.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/networkinterface.go b/client-go/onmetalapi/typed/networking/v1alpha1/networkinterface.go index af01354ce..ad3b8e89c 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/networkinterface.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/networkinterface.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type NetworkInterfaceInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.NetworkInterfaceList, 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.NetworkInterface, err error) + Apply(ctx context.Context, networkInterface *networkingv1alpha1.NetworkInterfaceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NetworkInterface, err error) + ApplyStatus(ctx context.Context, networkInterface *networkingv1alpha1.NetworkInterfaceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NetworkInterface, err error) NetworkInterfaceExpansion } @@ -192,3 +197,59 @@ func (c *networkInterfaces) Patch(ctx context.Context, name string, pt types.Pat Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied networkInterface. +func (c *networkInterfaces) Apply(ctx context.Context, networkInterface *networkingv1alpha1.NetworkInterfaceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NetworkInterface, err error) { + if networkInterface == nil { + return nil, fmt.Errorf("networkInterface provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(networkInterface) + if err != nil { + return nil, err + } + name := networkInterface.Name + if name == nil { + return nil, fmt.Errorf("networkInterface.Name must be provided to Apply") + } + result = &v1alpha1.NetworkInterface{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *networkInterfaces) ApplyStatus(ctx context.Context, networkInterface *networkingv1alpha1.NetworkInterfaceApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.NetworkInterface, err error) { + if networkInterface == nil { + return nil, fmt.Errorf("networkInterface provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(networkInterface) + if err != nil { + return nil, err + } + + name := networkInterface.Name + if name == nil { + return nil, fmt.Errorf("networkInterface.Name must be provided to Apply") + } + + result = &v1alpha1.NetworkInterface{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("networkinterfaces"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/networking/v1alpha1/virtualip.go b/client-go/onmetalapi/typed/networking/v1alpha1/virtualip.go index 30f4c7d8e..900e73eee 100644 --- a/client-go/onmetalapi/typed/networking/v1alpha1/virtualip.go +++ b/client-go/onmetalapi/typed/networking/v1alpha1/virtualip.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/networking/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type VirtualIPInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VirtualIPList, 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.VirtualIP, err error) + Apply(ctx context.Context, virtualIP *networkingv1alpha1.VirtualIPApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualIP, err error) + ApplyStatus(ctx context.Context, virtualIP *networkingv1alpha1.VirtualIPApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualIP, err error) VirtualIPExpansion } @@ -192,3 +197,59 @@ func (c *virtualIPs) Patch(ctx context.Context, name string, pt types.PatchType, Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied virtualIP. +func (c *virtualIPs) Apply(ctx context.Context, virtualIP *networkingv1alpha1.VirtualIPApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualIP, err error) { + if virtualIP == nil { + return nil, fmt.Errorf("virtualIP provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualIP) + if err != nil { + return nil, err + } + name := virtualIP.Name + if name == nil { + return nil, fmt.Errorf("virtualIP.Name must be provided to Apply") + } + result = &v1alpha1.VirtualIP{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("virtualips"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *virtualIPs) ApplyStatus(ctx context.Context, virtualIP *networkingv1alpha1.VirtualIPApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VirtualIP, err error) { + if virtualIP == nil { + return nil, fmt.Errorf("virtualIP provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(virtualIP) + if err != nil { + return nil, err + } + + name := virtualIP.Name + if name == nil { + return nil, fmt.Errorf("virtualIP.Name must be provided to Apply") + } + + result = &v1alpha1.VirtualIP{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("virtualips"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/doc.go b/client-go/onmetalapi/typed/storage/v1alpha1/doc.go index 99176264a..5f4c971ad 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/doc.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/fake/doc.go b/client-go/onmetalapi/typed/storage/v1alpha1/fake/doc.go index 51a90c3e1..82bfa735f 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/fake/doc.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/fake/doc.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_storage_client.go b/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_storage_client.go index 75a1c7d77..82bae750c 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_storage_client.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_storage_client.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volume.go b/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volume.go index 8b8d8be29..f22d24725 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volume.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volume.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + storagev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -139,3 +142,48 @@ func (c *FakeVolumes) Patch(ctx context.Context, name string, pt types.PatchType } return obj.(*v1alpha1.Volume), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied volume. +func (c *FakeVolumes) Apply(ctx context.Context, volume *storagev1alpha1.VolumeApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Volume, err error) { + if volume == nil { + return nil, fmt.Errorf("volume provided to Apply must not be nil") + } + data, err := json.Marshal(volume) + if err != nil { + return nil, err + } + name := volume.Name + if name == nil { + return nil, fmt.Errorf("volume.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(volumesResource, c.ns, *name, types.ApplyPatchType, data), &v1alpha1.Volume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Volume), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeVolumes) ApplyStatus(ctx context.Context, volume *storagev1alpha1.VolumeApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Volume, err error) { + if volume == nil { + return nil, fmt.Errorf("volume provided to Apply must not be nil") + } + data, err := json.Marshal(volume) + if err != nil { + return nil, err + } + name := volume.Name + if name == nil { + return nil, fmt.Errorf("volume.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(volumesResource, c.ns, *name, types.ApplyPatchType, data, "status"), &v1alpha1.Volume{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.Volume), err +} diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volumeclass.go b/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volumeclass.go index 7fb585d78..abe9e9eaa 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volumeclass.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volumeclass.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + storagev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -119,3 +122,24 @@ func (c *FakeVolumeClasses) Patch(ctx context.Context, name string, pt types.Pat } return obj.(*v1alpha1.VolumeClass), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied volumeClass. +func (c *FakeVolumeClasses) Apply(ctx context.Context, volumeClass *storagev1alpha1.VolumeClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VolumeClass, err error) { + if volumeClass == nil { + return nil, fmt.Errorf("volumeClass provided to Apply must not be nil") + } + data, err := json.Marshal(volumeClass) + if err != nil { + return nil, err + } + name := volumeClass.Name + if name == nil { + return nil, fmt.Errorf("volumeClass.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(volumeclassesResource, *name, types.ApplyPatchType, data), &v1alpha1.VolumeClass{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VolumeClass), err +} diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volumepool.go b/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volumepool.go index 38bb4a2a9..ca558deb4 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volumepool.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/fake/fake_volumepool.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,8 +19,11 @@ package fake import ( "context" + json "encoding/json" + "fmt" v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + storagev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/storage/v1alpha1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" labels "k8s.io/apimachinery/pkg/labels" schema "k8s.io/apimachinery/pkg/runtime/schema" @@ -130,3 +133,46 @@ func (c *FakeVolumePools) Patch(ctx context.Context, name string, pt types.Patch } return obj.(*v1alpha1.VolumePool), err } + +// Apply takes the given apply declarative configuration, applies it and returns the applied volumePool. +func (c *FakeVolumePools) Apply(ctx context.Context, volumePool *storagev1alpha1.VolumePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VolumePool, err error) { + if volumePool == nil { + return nil, fmt.Errorf("volumePool provided to Apply must not be nil") + } + data, err := json.Marshal(volumePool) + if err != nil { + return nil, err + } + name := volumePool.Name + if name == nil { + return nil, fmt.Errorf("volumePool.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(volumepoolsResource, *name, types.ApplyPatchType, data), &v1alpha1.VolumePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VolumePool), err +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *FakeVolumePools) ApplyStatus(ctx context.Context, volumePool *storagev1alpha1.VolumePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VolumePool, err error) { + if volumePool == nil { + return nil, fmt.Errorf("volumePool provided to Apply must not be nil") + } + data, err := json.Marshal(volumePool) + if err != nil { + return nil, err + } + name := volumePool.Name + if name == nil { + return nil, fmt.Errorf("volumePool.Name must be provided to Apply") + } + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(volumepoolsResource, *name, types.ApplyPatchType, data, "status"), &v1alpha1.VolumePool{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VolumePool), err +} diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/generated_expansion.go b/client-go/onmetalapi/typed/storage/v1alpha1/generated_expansion.go index 080b9937a..b9907c900 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/generated_expansion.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/generated_expansion.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/storage_client.go b/client-go/onmetalapi/typed/storage/v1alpha1/storage_client.go index e4e653439..13cd12dab 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/storage_client.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/storage_client.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/volume.go b/client-go/onmetalapi/typed/storage/v1alpha1/volume.go index 76ecf7ccd..e07dd1b51 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/volume.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/volume.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + storagev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/storage/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type VolumeInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VolumeList, 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.Volume, err error) + Apply(ctx context.Context, volume *storagev1alpha1.VolumeApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Volume, err error) + ApplyStatus(ctx context.Context, volume *storagev1alpha1.VolumeApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Volume, err error) VolumeExpansion } @@ -192,3 +197,59 @@ func (c *volumes) Patch(ctx context.Context, name string, pt types.PatchType, da Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied volume. +func (c *volumes) Apply(ctx context.Context, volume *storagev1alpha1.VolumeApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Volume, err error) { + if volume == nil { + return nil, fmt.Errorf("volume provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(volume) + if err != nil { + return nil, err + } + name := volume.Name + if name == nil { + return nil, fmt.Errorf("volume.Name must be provided to Apply") + } + result = &v1alpha1.Volume{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("volumes"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *volumes) ApplyStatus(ctx context.Context, volume *storagev1alpha1.VolumeApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.Volume, err error) { + if volume == nil { + return nil, fmt.Errorf("volume provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(volume) + if err != nil { + return nil, err + } + + name := volume.Name + if name == nil { + return nil, fmt.Errorf("volume.Name must be provided to Apply") + } + + result = &v1alpha1.Volume{} + err = c.client.Patch(types.ApplyPatchType). + Namespace(c.ns). + Resource("volumes"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/volumeclass.go b/client-go/onmetalapi/typed/storage/v1alpha1/volumeclass.go index 5ce89eb83..457ccb064 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/volumeclass.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/volumeclass.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + storagev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/storage/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -45,6 +48,7 @@ type VolumeClassInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VolumeClassList, 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.VolumeClass, err error) + Apply(ctx context.Context, volumeClass *storagev1alpha1.VolumeClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VolumeClass, err error) VolumeClassExpansion } @@ -165,3 +169,28 @@ func (c *volumeClasses) Patch(ctx context.Context, name string, pt types.PatchTy Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied volumeClass. +func (c *volumeClasses) Apply(ctx context.Context, volumeClass *storagev1alpha1.VolumeClassApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VolumeClass, err error) { + if volumeClass == nil { + return nil, fmt.Errorf("volumeClass provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(volumeClass) + if err != nil { + return nil, err + } + name := volumeClass.Name + if name == nil { + return nil, fmt.Errorf("volumeClass.Name must be provided to Apply") + } + result = &v1alpha1.VolumeClass{} + err = c.client.Patch(types.ApplyPatchType). + Resource("volumeclasses"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/onmetalapi/typed/storage/v1alpha1/volumepool.go b/client-go/onmetalapi/typed/storage/v1alpha1/volumepool.go index f453022aa..fc5b569f8 100644 --- a/client-go/onmetalapi/typed/storage/v1alpha1/volumepool.go +++ b/client-go/onmetalapi/typed/storage/v1alpha1/volumepool.go @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -19,9 +19,12 @@ package v1alpha1 import ( "context" + json "encoding/json" + "fmt" "time" v1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + storagev1alpha1 "github.com/onmetal/onmetal-api/client-go/applyconfigurations/storage/v1alpha1" scheme "github.com/onmetal/onmetal-api/client-go/onmetalapi/scheme" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" types "k8s.io/apimachinery/pkg/types" @@ -46,6 +49,8 @@ type VolumePoolInterface interface { List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VolumePoolList, 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.VolumePool, err error) + Apply(ctx context.Context, volumePool *storagev1alpha1.VolumePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VolumePool, err error) + ApplyStatus(ctx context.Context, volumePool *storagev1alpha1.VolumePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VolumePool, err error) VolumePoolExpansion } @@ -181,3 +186,57 @@ func (c *volumePools) Patch(ctx context.Context, name string, pt types.PatchType Into(result) return } + +// Apply takes the given apply declarative configuration, applies it and returns the applied volumePool. +func (c *volumePools) Apply(ctx context.Context, volumePool *storagev1alpha1.VolumePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VolumePool, err error) { + if volumePool == nil { + return nil, fmt.Errorf("volumePool provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(volumePool) + if err != nil { + return nil, err + } + name := volumePool.Name + if name == nil { + return nil, fmt.Errorf("volumePool.Name must be provided to Apply") + } + result = &v1alpha1.VolumePool{} + err = c.client.Patch(types.ApplyPatchType). + Resource("volumepools"). + Name(*name). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} + +// ApplyStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus(). +func (c *volumePools) ApplyStatus(ctx context.Context, volumePool *storagev1alpha1.VolumePoolApplyConfiguration, opts v1.ApplyOptions) (result *v1alpha1.VolumePool, err error) { + if volumePool == nil { + return nil, fmt.Errorf("volumePool provided to Apply must not be nil") + } + patchOpts := opts.ToPatchOptions() + data, err := json.Marshal(volumePool) + if err != nil { + return nil, err + } + + name := volumePool.Name + if name == nil { + return nil, fmt.Errorf("volumePool.Name must be provided to Apply") + } + + result = &v1alpha1.VolumePool{} + err = c.client.Patch(types.ApplyPatchType). + Resource("volumepools"). + Name(*name). + SubResource("status"). + VersionedParams(&patchOpts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client-go/openapi/zz_generated.openapi.go b/client-go/openapi/zz_generated.openapi.go index 8cdc357b1..5c735ff53 100644 --- a/client-go/openapi/zz_generated.openapi.go +++ b/client-go/openapi/zz_generated.openapi.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -423,6 +423,11 @@ func schema_onmetal_api_api_common_v1alpha1_ConfigMapKeySelector(ref common.Refe }, }, }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-map-type": "atomic", + }, + }, }, } } @@ -505,6 +510,11 @@ func schema_onmetal_api_api_common_v1alpha1_LocalUIDReference(ref common.Referen }, Required: []string{"name", "uid"}, }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-map-type": "atomic", + }, + }, }, } } @@ -532,6 +542,11 @@ func schema_onmetal_api_api_common_v1alpha1_SecretKeySelector(ref common.Referen }, }, }, + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-map-type": "atomic", + }, + }, }, } } @@ -1407,6 +1422,12 @@ func schema_onmetal_api_api_compute_v1alpha1_MachineSpec(ref common.ReferenceCal }, }, "networkInterfaces": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge,retainKeys", + }, + }, SchemaProps: spec.SchemaProps{ Description: "NetworkInterfaces define a list of network interfaces present on the machine", Type: []string{"array"}, @@ -1421,6 +1442,12 @@ func schema_onmetal_api_api_compute_v1alpha1_MachineSpec(ref common.ReferenceCal }, }, "volumes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge,retainKeys", + }, + }, SchemaProps: spec.SchemaProps{ Description: "Volumes are volumes attached to this machine.", Type: []string{"array"}, @@ -1441,6 +1468,12 @@ func schema_onmetal_api_api_compute_v1alpha1_MachineSpec(ref common.ReferenceCal }, }, "efiVars": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge,retainKeys", + }, + }, SchemaProps: spec.SchemaProps{ Description: "EFIVars are variables to pass to EFI while booting up.", Type: []string{"array"}, @@ -1723,7 +1756,7 @@ func schema_onmetal_api_api_compute_v1alpha1_Volume(ref common.ReferenceCallback }, "device": { SchemaProps: spec.SchemaProps{ - Description: "Device is the device name where the volume should be attached. If empty, an unused device name will be determined if possible.", + Description: "Device is the device name where the volume should be attached. Pointer to distinguish between explicit zero and not specified. If empty, an unused device name will be determined if possible.", Type: []string{"string"}, Format: "", }, @@ -3289,6 +3322,12 @@ func schema_onmetal_api_api_networking_v1alpha1_NATGatewaySpec(ref common.Refere }, }, "ips": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-patch-merge-key": "name", + "x-kubernetes-patch-strategy": "merge,retainKeys", + }, + }, SchemaProps: spec.SchemaProps{ Description: "IPs are the ips the NAT gateway should allocate.", Type: []string{"array"}, @@ -3323,7 +3362,7 @@ func schema_onmetal_api_api_networking_v1alpha1_NATGatewaySpec(ref common.Refere }, }, }, - Required: []string{"type", "ipFamilies", "ips", "networkRef"}, + Required: []string{"type", "ipFamilies", "networkRef"}, }, }, Dependencies: []string{ diff --git a/docs/api-reference/common.md b/docs/api-reference/common.md index a6567a412..29464027f 100644 --- a/docs/api-reference/common.md +++ b/docs/api-reference/common.md @@ -26,18 +26,14 @@ In some instances, key is a required field.

-LocalObjectReference
+name
- -Kubernetes core/v1.LocalObjectReference - +string -

-(Members of LocalObjectReference are embedded into this type.) -

-

The name of the ConfigMap resource being referred to.

+

Name of the referent. +More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

@@ -207,18 +203,14 @@ In some instances, key is a required field.

-LocalObjectReference
+name
- -Kubernetes core/v1.LocalObjectReference - +string -

-(Members of LocalObjectReference are embedded into this type.) -

-

The name of the Secret resource being referred to.

+

Name of the referent. +More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names

diff --git a/docs/api-reference/compute.md b/docs/api-reference/compute.md index 95c83b32e..5c75919be 100644 --- a/docs/api-reference/compute.md +++ b/docs/api-reference/compute.md @@ -146,6 +146,7 @@ Kubernetes core/v1.LocalObjectReference +(Optional)

NetworkInterfaces define a list of network interfaces present on the machine

@@ -159,6 +160,7 @@ Kubernetes core/v1.LocalObjectReference +(Optional)

Volumes are volumes attached to this machine.

@@ -184,6 +186,7 @@ If key is empty, DefaultIgnitionKey will be used as fallback.

+(Optional)

EFIVars are variables to pass to EFI while booting up.

@@ -1159,6 +1162,7 @@ Kubernetes core/v1.LocalObjectReference +(Optional)

NetworkInterfaces define a list of network interfaces present on the machine

@@ -1172,6 +1176,7 @@ Kubernetes core/v1.LocalObjectReference +(Optional)

Volumes are volumes attached to this machine.

@@ -1197,6 +1202,7 @@ If key is empty, DefaultIgnitionKey will be used as fallback.

+(Optional)

EFIVars are variables to pass to EFI while booting up.

@@ -1647,8 +1653,9 @@ string -

Device is the device name where the volume should be attached. If empty, -an unused device name will be determined if possible.

+

Device is the device name where the volume should be attached. +Pointer to distinguish between explicit zero and not specified. +If empty, an unused device name will be determined if possible.

diff --git a/docs/api-reference/networking.md b/docs/api-reference/networking.md index 8df221df8..d3aa4d8e6 100644 --- a/docs/api-reference/networking.md +++ b/docs/api-reference/networking.md @@ -501,6 +501,7 @@ NATGatewayType +(Optional)

IPs are the ips the NAT gateway should allocate.

@@ -1360,15 +1361,24 @@ for which this LoadBalancer should be applied

-LocalUIDReference
+name
-github.com/onmetal/onmetal-api/api/common/v1alpha1.LocalUIDReference +string -

-(Members of LocalUIDReference are embedded into this type.) -

+

Name is the name of the referenced entity.

+ + + + +uid
+ +k8s.io/apimachinery/pkg/types.UID + + + +

UID is the UID of the referenced entity.

@@ -1553,6 +1563,7 @@ NATGatewayType +(Optional)

IPs are the ips the NAT gateway should allocate.

diff --git a/hack/boilerplate.go.txt b/hack/boilerplate.go.txt index e5a66c445..4fb048225 100644 --- a/hack/boilerplate.go.txt +++ b/hack/boilerplate.go.txt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index e781b0075..d1de6c0c4 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -29,7 +29,23 @@ function qualify-gvs() { echo "$res" } +function qualify-gs() { + APIS_PKG="$1" + unset GROUPS + IFS=' ' read -ra GROUPS <<< "$2" + join_char="" + res="" + + for G in "${GROUPS[@]}"; do + res="$res$join_char$APIS_PKG/$G" + join_char="," + done + + echo "$res" +} + VGOPATH="$VGOPATH" +MODELS_SCHEMA="$MODELS_SCHEMA" CLIENT_GEN="$CLIENT_GEN" DEEPCOPY_GEN="$DEEPCOPY_GEN" LISTER_GEN="$LISTER_GEN" @@ -37,12 +53,13 @@ INFORMER_GEN="$INFORMER_GEN" DEFAULTER_GEN="$DEFAULTER_GEN" CONVERSION_GEN="$CONVERSION_GEN" OPENAPI_GEN="$OPENAPI_GEN" +APPLYCONFIGURATION_GEN="$APPLYCONFIGURATION_GEN" VIRTUAL_GOPATH="$(mktemp -d)" trap 'rm -rf "$GOPATH"' EXIT # Setup virtual GOPATH so the codegen tools work as expected. -(cd "$SCRIPT_DIR/.."; "$VGOPATH" "$VIRTUAL_GOPATH") +(cd "$SCRIPT_DIR/.."; go mod download && "$VGOPATH" "$VIRTUAL_GOPATH") export GOROOT="${GOROOT:-"$(go env GOROOT)"}" export GOPATH="$VIRTUAL_GOPATH" @@ -57,12 +74,36 @@ echo "Generating ${blue}deepcopy${normal}" --input-dirs "$(qualify-gvs "github.com/onmetal/onmetal-api/api" "common:v1alpha1 compute:v1alpha1 ipam:v1alpha1 networking:v1alpha1 storage:v1alpha1")" \ -O zz_generated.deepcopy +echo "Generating ${blue}openapi${normal}" +"$OPENAPI_GEN" \ + --output-base "$GOPATH/src" \ + --go-header-file "$SCRIPT_DIR/boilerplate.go.txt" \ + --input-dirs "$(qualify-gvs "github.com/onmetal/onmetal-api/api" "common:v1alpha1 compute:v1alpha1 ipam:v1alpha1 networking:v1alpha1 storage:v1alpha1")" \ + --input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/version" \ + --input-dirs "k8s.io/api/core/v1" \ + --input-dirs "k8s.io/apimachinery/pkg/api/resource" \ + --output-package "github.com/onmetal/onmetal-api/client-go/openapi" \ + -O zz_generated.openapi \ + --report-filename "$SCRIPT_DIR/../client-go/openapi/api_violations.report" + +echo "Generating ${blue}applyconfiguration${normal}" +applyconfigurationgen_external_apis+=("k8s.io/apimachinery/pkg/apis/meta/v1") +applyconfigurationgen_external_apis+=("$(qualify-gvs "github.com/onmetal/onmetal-api/api" "common:v1alpha1 compute:v1alpha1 ipam:v1alpha1 networking:v1alpha1 storage:v1alpha1")") +applyconfigurationgen_external_apis_csv=$(IFS=,; echo "${applyconfigurationgen_external_apis[*]}") +"$APPLYCONFIGURATION_GEN" \ + --output-base "$GOPATH/src" \ + --go-header-file "$SCRIPT_DIR/boilerplate.go.txt" \ + --input-dirs "${applyconfigurationgen_external_apis_csv}" \ + --openapi-schema <("$MODELS_SCHEMA" --openapi-package "github.com/onmetal/onmetal-api/client-go/openapi" --openapi-title "onmetal-api") \ + --output-package "github.com/onmetal/onmetal-api/client-go/applyconfigurations" + echo "Generating ${blue}client${normal}" "$CLIENT_GEN" \ --output-base "$GOPATH/src" \ --go-header-file "$SCRIPT_DIR/boilerplate.go.txt" \ --input "$(qualify-gvs "github.com/onmetal/onmetal-api/api" "compute:v1alpha1 ipam:v1alpha1 networking:v1alpha1 storage:v1alpha1")" \ --output-package "github.com/onmetal/onmetal-api/client-go" \ + --apply-configuration-package "github.com/onmetal/onmetal-api/client-go/applyconfigurations" \ --clientset-name "onmetalapi" \ --input-base "" @@ -83,25 +124,13 @@ echo "Generating ${blue}informer${normal}" --output-package "github.com/onmetal/onmetal-api/client-go/informers" \ --single-directory -echo "Generating ${blue}openapi${normal}" -"$OPENAPI_GEN" \ - --output-base "$GOPATH/src" \ - --go-header-file "$SCRIPT_DIR/boilerplate.go.txt" \ - --input-dirs "$(qualify-gvs "github.com/onmetal/onmetal-api/api" "common:v1alpha1 compute:v1alpha1 ipam:v1alpha1 networking:v1alpha1 storage:v1alpha1")" \ - --input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/version" \ - --input-dirs "k8s.io/api/core/v1" \ - --input-dirs "k8s.io/apimachinery/pkg/api/resource" \ - --output-package "github.com/onmetal/onmetal-api/client-go/openapi" \ - -O zz_generated.openapi \ - --report-filename "$SCRIPT_DIR/../client-go/openapi/api_violations.report" - echo "${bold}Internal types${normal}" echo "Generating ${blue}deepcopy${normal}" "$DEEPCOPY_GEN" \ --output-base "$GOPATH/src" \ --go-header-file "$SCRIPT_DIR/boilerplate.go.txt" \ - --input-dirs "$(qualify-gvs "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis" "compute:v1alpha1 ipam:v1alpha1 networking:v1alpha1 storage:v1alpha1")" \ + --input-dirs "$(qualify-gs "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis" "compute ipam networking storage")" \ -O zz_generated.deepcopy echo "Generating ${blue}defaulter${normal}" @@ -115,5 +144,6 @@ echo "Generating ${blue}conversion${normal}" "$CONVERSION_GEN" \ --output-base "$GOPATH/src" \ --go-header-file "$SCRIPT_DIR/boilerplate.go.txt" \ + --input-dirs "$(qualify-gs "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis" "compute ipam networking storage")" \ --input-dirs "$(qualify-gvs "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis" "compute:v1alpha1 ipam:v1alpha1 networking:v1alpha1 storage:v1alpha1")" \ -O zz_generated.conversion diff --git a/machinebroker/server/machine_create.go b/machinebroker/server/machine_create.go index a2c9f3536..73b4ce365 100644 --- a/machinebroker/server/machine_create.go +++ b/machinebroker/server/machine_create.go @@ -143,7 +143,7 @@ func (s *Server) getOnmetalVolumeData( onmetalMachineVolume := &computev1alpha1.Volume{ Name: volume.Name, - Device: volume.Device, + Device: &volume.Device, VolumeSource: src, } return onmetalMachineVolume, onmetalVolumeConfig, nil @@ -336,7 +336,7 @@ func (s *Server) getOnmetalMachineConfig(ctx context.Context, cfg *ori.MachineCo } if ignitionSecret != nil { onmetalMachine.Spec.IgnitionRef = &commonv1alpha1.SecretKeySelector{ - LocalObjectReference: corev1.LocalObjectReference{Name: s.onmetalIgnitionSecretName(machineID)}, + Name: s.onmetalIgnitionSecretName(machineID), } } diff --git a/machinebroker/server/machine_create_test.go b/machinebroker/server/machine_create_test.go index 56d65efaa..c3bc5380f 100644 --- a/machinebroker/server/machine_create_test.go +++ b/machinebroker/server/machine_create_test.go @@ -27,6 +27,7 @@ import ( . "github.com/onsi/gomega" . "github.com/onsi/gomega/gstruct" corev1 "k8s.io/api/core/v1" + "k8s.io/utils/pointer" "sigs.k8s.io/controller-runtime/pkg/client" ) @@ -120,12 +121,12 @@ var _ = Describe("CreateMachine", func() { Expect(onmetalMachine.Spec.Volumes).To(HaveLen(2)) Expect(onmetalMachine.Spec.Volumes[0]).To(MatchFields(IgnoreExtras|IgnoreMissing, Fields{ "Name": Equal("foo"), - "Device": Equal("vdb"), + "Device": Equal(pointer.String("vdb")), "LocalObjectReference": Not(BeNil()), })) Expect(onmetalMachine.Spec.Volumes[1]).To(MatchFields(IgnoreExtras|IgnoreMissing, Fields{ "Name": Equal("bar"), - "Device": Equal("vdc"), + "Device": Equal(pointer.String("vdc")), "EmptyDisk": Not(BeNil()), })) Expect(onmetalMachine.Spec.NetworkInterfaces).To(HaveLen(1)) diff --git a/machinebroker/server/volume.go b/machinebroker/server/volume.go index 9d0dd6f85..835b5b547 100644 --- a/machinebroker/server/volume.go +++ b/machinebroker/server/volume.go @@ -28,6 +28,11 @@ func (s *Server) convertOnmetalVolume( onmetalVolume *computev1alpha1.Volume, onmetalStorageVolume *storagev1alpha1.Volume, ) (*ori.Volume, error) { + device := onmetalVolume.Device + if device == nil { + return nil, fmt.Errorf("volume %s does not specify device", onmetalVolume.Name) + } + var access *ori.VolumeAccess if onmetalVolume.VolumeRef != nil || onmetalVolume.Ephemeral != nil { onmetalVolumeAccess := onmetalStorageVolume.Status.Access @@ -57,7 +62,7 @@ func (s *Server) convertOnmetalVolume( MachineId: machineID, MachineMetadata: machineMetadata, Name: onmetalVolume.Name, - Device: onmetalVolume.Device, + Device: *device, Access: access, EmptyDisk: emptyDisk, }, nil diff --git a/machinepoollet/controllers/util.go b/machinepoollet/controllers/util.go index db445a55c..7c7d5bc79 100644 --- a/machinepoollet/controllers/util.go +++ b/machinepoollet/controllers/util.go @@ -250,6 +250,11 @@ func (r *MachineReconciler) checkReferencedVolumeBoundToMachine(machine *compute } func (r *MachineReconciler) getORIVolumeConfig(ctx context.Context, machine *computev1alpha1.Machine, machineVolume *computev1alpha1.Volume) (*ori.VolumeConfig, error) { + device := machineVolume.Device + if device == nil { + return nil, fmt.Errorf("volume %s does not specify a device", machineVolume.Name) + } + var ( emptyDiskConfig *ori.EmptyDiskConfig volumeAccessConfig *ori.VolumeAccessConfig @@ -301,7 +306,7 @@ func (r *MachineReconciler) getORIVolumeConfig(ctx context.Context, machine *com return &ori.VolumeConfig{ Name: machineVolume.Name, - Device: machineVolume.Device, + Device: *device, Access: volumeAccessConfig, EmptyDisk: emptyDiskConfig, }, nil diff --git a/models-schema/main.go b/models-schema/main.go new file mode 100644 index 000000000..336d7ad87 --- /dev/null +++ b/models-schema/main.go @@ -0,0 +1,97 @@ +// 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 main + +import ( + "errors" + "flag" + "fmt" + "io/fs" + "os" + "os/exec" + "text/template" + + "github.com/go-logr/logr" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + + _ "embed" +) + +var ( + //go:embed main.go.tmpl + mainGoTemplateData string + + mainGoTemplate = template.Must(template.New("main.go").Parse(mainGoTemplateData)) +) + +type mainGoTemplateArgs struct { + OpenAPIPackage string + OpenAPITitle string +} + +func main() { + var ( + zapOpts = zap.Options{Development: true} + log logr.Logger + openapiPackage string + openapiTitle string + ) + + zapOpts.BindFlags(flag.CommandLine) + flag.StringVar(&openapiPackage, "openapi-package", "", "Package containing the openapi definitions.") + flag.StringVar(&openapiTitle, "openapi-title", "", "Title for the generated openapi json definition.") + flag.Parse() + log = zap.New(zap.UseFlagOptions(&zapOpts)) + + if openapiPackage == "" { + log.Error(fmt.Errorf("must specify openapi-package"), "Invalid flags") + os.Exit(1) + } + if openapiTitle == "" { + log.Error(fmt.Errorf("must specify openapi-title"), "Invalid flags") + os.Exit(1) + } + + if err := run(log, openapiPackage, openapiTitle); err != nil { + log.Error(err, "Error running models-schema") + } +} + +func run(log logr.Logger, openapiPackage, openapiTitle string) error { + tmpFile, err := os.CreateTemp("", "models-schema-*.go") + if err != nil { + return fmt.Errorf("error creating temporary file: %w", err) + } + defer func() { + if err := os.Remove(tmpFile.Name()); err != nil && !errors.Is(err, fs.ErrNotExist) { + log.Error(err, "Error cleaning up temporary file") + } + }() + + if err := mainGoTemplate.Execute(tmpFile, mainGoTemplateArgs{ + OpenAPIPackage: openapiPackage, + OpenAPITitle: openapiTitle, + }); err != nil { + return fmt.Errorf("error executing template: %w", err) + } + + cmd := exec.Command("go", "run", tmpFile.Name()) + cmd.Stderr = os.Stderr + cmd.Stdout = os.Stdout + if err := cmd.Run(); err != nil { + return fmt.Errorf("error running command: %w", err) + } + return nil +} diff --git a/models-schema/main.go.tmpl b/models-schema/main.go.tmpl new file mode 100644 index 000000000..7539b9afc --- /dev/null +++ b/models-schema/main.go.tmpl @@ -0,0 +1,75 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + "strings" + + "{{ .OpenAPIPackage }}" + "k8s.io/kube-openapi/pkg/common" + "k8s.io/kube-openapi/pkg/validation/spec" +) + +// Outputs openAPI schema JSON containing the schema definitions in zz_generated.openapi.go. +func main() { + err := output() + if err != nil { + os.Stderr.WriteString(fmt.Sprintf("Failed: %v", err)) + os.Exit(1) + } +} + +func output() error { + refFunc := func(name string) spec.Ref { + return spec.MustCreateRef(fmt.Sprintf("#/definitions/%s", friendlyName(name))) + } + defs := openapi.GetOpenAPIDefinitions(refFunc) + schemaDefs := make(map[string]spec.Schema, len(defs)) + for k, v := range defs { + // Replace top-level schema with v2 if a v2 schema is embedded + // so that the output of this program is always in OpenAPI v2. + // This is done by looking up an extension that marks the embedded v2 + // schema, and, if the v2 schema is found, make it the resulting schema for + // the type. + if schema, ok := v.Schema.Extensions[common.ExtensionV2Schema]; ok { + if v2Schema, isOpenAPISchema := schema.(spec.Schema); isOpenAPISchema { + schemaDefs[friendlyName(k)] = v2Schema + continue + } + } + + schemaDefs[friendlyName(k)] = v.Schema + } + data, err := json.Marshal(&spec.Swagger{ + SwaggerProps: spec.SwaggerProps{ + Definitions: schemaDefs, + Info: &spec.Info{ + InfoProps: spec.InfoProps{ + Title: "{{ .OpenAPITitle }}", + Version: "unversioned", + }, + }, + Swagger: "2.0", + }, + }) + if err != nil { + return fmt.Errorf("error serializing api definitions: %w", err) + } + os.Stdout.Write(data) + return nil +} + +// From k8s.io/apiserver/pkg/endpoints/openapi/openapi.go +func friendlyName(name string) string { + nameParts := strings.Split(name, "/") + // Reverse first part. e.g., io.k8s... instead of k8s.io... + if len(nameParts) > 0 && strings.Contains(nameParts[0], ".") { + parts := strings.Split(nameParts[0], ".") + for i, j := 0, len(parts)-1; i < j; i, j = i+1, j-1 { + parts[i], parts[j] = parts[j], parts[i] + } + nameParts[0] = strings.Join(parts, ".") + } + return strings.Join(nameParts, ".") +} diff --git a/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/admission.go b/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/admission.go index 817e7835d..2a12fb57d 100644 --- a/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/admission.go +++ b/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/admission.go @@ -19,7 +19,6 @@ import ( "fmt" "io" - "github.com/onmetal/onmetal-api/apiutils/equality" "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/device" "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis/compute" apierrors "k8s.io/apimachinery/pkg/api/errors" @@ -56,10 +55,6 @@ func (d *MachineVolumeDevices) Admit(ctx context.Context, a admission.Attributes return apierrors.NewBadRequest("Resource was marked with kind Machine but was unable to be converted") } - if err := d.reuseOldDevices(a, machine); err != nil { - return err - } - namer, err := deviceNamerFromMachineVolumes(machine) if err != nil { return apierrors.NewBadRequest("Machine has conflicting volume device names") @@ -67,40 +62,18 @@ func (d *MachineVolumeDevices) Admit(ctx context.Context, a admission.Attributes for i := range machine.Spec.Volumes { volume := &machine.Spec.Volumes[i] - if volume.Device != "" { + if volume.Device != nil { continue } - volume.Device, err = namer.Generate(device.VirtioPrefix) // TODO: We should have a better way for a device prefix. + newDevice, err := namer.Generate(device.OnmetalPrefix) // TODO: We should have a better way for a device prefix. if err != nil { return apierrors.NewBadRequest("No device names left for machine") } - } - - return nil -} - -func (d *MachineVolumeDevices) reuseOldDevices(a admission.Attributes, machine *compute.Machine) error { - if oldObj := a.GetOldObject(); oldObj != nil { - oldMachine, ok := oldObj.(*compute.Machine) - if !ok { - return apierrors.NewBadRequest("Resource was marked with kind Machine but was unable to be converted") - } - for i := range machine.Spec.Volumes { - volume := &machine.Spec.Volumes[i] - if volume.Device != "" { - continue - } - - for _, oldVolume := range oldMachine.Spec.Volumes { - if oldVolume.Name == volume.Name && equality.Semantic.DeepEqual(volume.VolumeSource, oldVolume.VolumeSource) { - volume.Device = oldVolume.Device - break - } - } - } + volume.Device = &newDevice } + return nil } @@ -119,7 +92,7 @@ func shouldIgnore(a admission.Attributes) bool { func machineHasAnyVolumeWithoutDevice(machine *compute.Machine) bool { for _, volume := range machine.Spec.Volumes { - if volume.Device == "" { + if volume.Device == nil { return true } } @@ -128,16 +101,10 @@ func machineHasAnyVolumeWithoutDevice(machine *compute.Machine) bool { func deviceNamerFromMachineVolumes(machine *compute.Machine) (*device.Namer, error) { namer := device.NewNamer() - - // Observe reserved names. - if err := namer.Observe(device.Name(device.VirtioPrefix, 0)); err != nil { - return nil, err - } - for _, volume := range machine.Spec.Volumes { - if dev := volume.Device; dev != "" { - if err := namer.Observe(dev); err != nil { - return nil, fmt.Errorf("error observing device %s: %w", dev, err) + if dev := volume.Device; dev != nil { + if err := namer.Observe(*dev); err != nil { + return nil, fmt.Errorf("error observing device %s: %w", *dev, err) } } } diff --git a/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/admission_test.go b/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/admission_test.go index 2d63acab6..9964fabc4 100644 --- a/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/admission_test.go +++ b/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/admission_test.go @@ -24,6 +24,7 @@ import ( . "github.com/onsi/gomega" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apiserver/pkg/admission" + "k8s.io/utils/pointer" ) var _ = Describe("Admission", func() { @@ -72,7 +73,7 @@ var _ = Describe("Admission", func() { Volumes: []compute.Volume{ { Name: "foo", - Device: "vdb", + Device: pointer.String("odb"), }, { Name: "bar", @@ -104,121 +105,15 @@ var _ = Describe("Admission", func() { Expect(machine.Spec.Volumes).To(Equal([]compute.Volume{ { Name: "foo", - Device: "vdb", + Device: pointer.String("odb"), }, { Name: "bar", - Device: "vdc", + Device: pointer.String("oda"), }, { Name: "baz", - Device: "vdd", - }, - })) - }) - - It("should re-use old volume device names when available", func() { - oldMachine := &compute.Machine{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "foo", - Name: "bar", - }, - Spec: compute.MachineSpec{ - Volumes: []compute.Volume{ - { - Name: "foo", - Device: "vdb", - }, - }, - }, - } - newMachine := oldMachine.DeepCopy() - newMachine.Spec.Volumes[0].Device = "" - - Expect(plugin.Admit( - context.TODO(), - admission.NewAttributesRecord( - newMachine, - oldMachine, - compute.Kind("Machine").WithVersion("version"), - oldMachine.Namespace, - oldMachine.Name, - compute.Resource("machines").WithVersion("version"), - "", - admission.Update, - &metav1.CreateOptions{}, - false, - nil, - ), - nil, - )).NotTo(HaveOccurred()) - - Expect(newMachine.Spec.Volumes).To(Equal([]compute.Volume{ - { - Name: "foo", - Device: "vdb", - }, - })) - }) - - It("should allow adding a new volume with unset device", func() { - oldMachine := &compute.Machine{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "foo", - Name: "bar", - }, - Spec: compute.MachineSpec{ - Volumes: []compute.Volume{ - { - Name: "foo", - Device: "vdb", - }, - }, - }, - } - newMachine := &compute.Machine{ - ObjectMeta: metav1.ObjectMeta{ - Namespace: "foo", - Name: "bar", - }, - Spec: compute.MachineSpec{ - Volumes: []compute.Volume{ - { - Name: "foo", - }, - { - Name: "bar", - }, - }, - }, - } - - Expect(plugin.Admit( - context.TODO(), - admission.NewAttributesRecord( - newMachine, - oldMachine, - compute.Kind("Machine").WithVersion("version"), - oldMachine.Namespace, - oldMachine.Name, - compute.Resource("machines").WithVersion("version"), - "", - admission.Update, - &metav1.CreateOptions{}, - false, - nil, - ), - nil, - )).NotTo(HaveOccurred()) - - Expect(newMachine.Spec.Volumes).To(Equal([]compute.Volume{ - { - Name: "foo", - Device: "vdb", - }, - { - Name: "bar", - Device: "vdc", + Device: pointer.String("odc"), }, })) }) diff --git a/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/device/device.go b/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/device/device.go index 64e908aaa..06f149bad 100644 --- a/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/device/device.go +++ b/onmetal-apiserver/internal/admission/plugin/machinevolumedevices/device/device.go @@ -28,8 +28,8 @@ const ( // MaxIndex is the maximum index usable for Name / returned by ParseName. MaxIndex = numLetters*numLetters + numLetters - 1 - // VirtioPrefix is the device prefix used by virtio devices. - VirtioPrefix = "vd" + // OnmetalPrefix is the device prefix used by onmetal devices. + OnmetalPrefix = "od" ) var ( diff --git a/onmetal-apiserver/internal/apis/compute/machine_types.go b/onmetal-apiserver/internal/apis/compute/machine_types.go index 083778ea8..87e80d310 100644 --- a/onmetal-apiserver/internal/apis/compute/machine_types.go +++ b/onmetal-apiserver/internal/apis/compute/machine_types.go @@ -84,9 +84,10 @@ type NetworkInterfaceSource struct { type Volume struct { // Name is the name of the Volume Name string - // Device is the device name where the volume should be attached. If empty, - // an unused device name will be determined if possible. - Device string + // Device is the device name where the volume should be attached. + // Pointer to distinguish between explicit zero and not specified. + // If empty, an unused device name will be determined if possible. + Device *string // VolumeSource is the source where the storage for the Volume resides at. VolumeSource } diff --git a/onmetal-apiserver/internal/apis/compute/register.go b/onmetal-apiserver/internal/apis/compute/register.go index 80d82830b..afc128898 100644 --- a/onmetal-apiserver/internal/apis/compute/register.go +++ b/onmetal-apiserver/internal/apis/compute/register.go @@ -15,7 +15,6 @@ */ // Package compute contains API Schema definitions for the compute internal API group -// +kubebuilder:object:generate=true // +groupName=compute.api.onmetal.de package compute diff --git a/onmetal-apiserver/internal/apis/compute/v1alpha1/zz_generated.conversion.go b/onmetal-apiserver/internal/apis/compute/v1alpha1/zz_generated.conversion.go index 861eab698..9a1b855b6 100644 --- a/onmetal-apiserver/internal/apis/compute/v1alpha1/zz_generated.conversion.go +++ b/onmetal-apiserver/internal/apis/compute/v1alpha1/zz_generated.conversion.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -987,7 +987,7 @@ func Convert_compute_ReferencedVolumeStatus_To_v1alpha1_ReferencedVolumeStatus(i func autoConvert_v1alpha1_Volume_To_compute_Volume(in *v1alpha1.Volume, out *compute.Volume, s conversion.Scope) error { out.Name = in.Name - out.Device = in.Device + out.Device = (*string)(unsafe.Pointer(in.Device)) if err := Convert_v1alpha1_VolumeSource_To_compute_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { return err } @@ -1001,7 +1001,7 @@ func Convert_v1alpha1_Volume_To_compute_Volume(in *v1alpha1.Volume, out *compute func autoConvert_compute_Volume_To_v1alpha1_Volume(in *compute.Volume, out *v1alpha1.Volume, s conversion.Scope) error { out.Name = in.Name - out.Device = in.Device + out.Device = (*string)(unsafe.Pointer(in.Device)) if err := Convert_compute_VolumeSource_To_v1alpha1_VolumeSource(&in.VolumeSource, &out.VolumeSource, s); err != nil { return err } diff --git a/onmetal-apiserver/internal/apis/compute/v1alpha1/zz_generated.defaults.go b/onmetal-apiserver/internal/apis/compute/v1alpha1/zz_generated.defaults.go index eed1d7939..f4793d6f9 100644 --- a/onmetal-apiserver/internal/apis/compute/v1alpha1/zz_generated.defaults.go +++ b/onmetal-apiserver/internal/apis/compute/v1alpha1/zz_generated.defaults.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/onmetal-apiserver/internal/apis/compute/validation/machine.go b/onmetal-apiserver/internal/apis/compute/validation/machine.go index 7e39953d6..a8724426e 100644 --- a/onmetal-apiserver/internal/apis/compute/validation/machine.go +++ b/onmetal-apiserver/internal/apis/compute/validation/machine.go @@ -90,10 +90,12 @@ func validateMachineSpec(machineSpec *compute.MachineSpec, fldPath *field.Path) } else { seenNames.Insert(vol.Name) } - if seenDevices.Has(vol.Device) { - allErrs = append(allErrs, field.Duplicate(fldPath.Child("volume").Index(i).Child("device"), vol.Device)) - } else { - seenDevices.Insert(vol.Device) + if vol.Device != nil { + if seenDevices.Has(*vol.Device) { + allErrs = append(allErrs, field.Duplicate(fldPath.Child("volume").Index(i).Child("device"), vol.Device)) + } else { + seenDevices.Insert(*vol.Device) + } } allErrs = append(allErrs, validateVolume(&vol, fldPath.Child("volume").Index(i))...) } @@ -103,10 +105,6 @@ func validateMachineSpec(machineSpec *compute.MachineSpec, fldPath *field.Path) return allErrs } -func isReservedDeviceName(prefix string, idx int) bool { - return idx == 0 -} - func validateVolume(volume *compute.Volume, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList @@ -114,17 +112,11 @@ func validateVolume(volume *compute.Volume, fldPath *field.Path) field.ErrorList allErrs = append(allErrs, field.Invalid(fldPath.Child("name"), volume.Name, msg)) } - if volume.Device == "" { + if volume.Device == nil { allErrs = append(allErrs, field.Required(fldPath.Child("device"), "must specify device")) } else { - // TODO: Improve validation on prefix. - prefix, idx, err := device.ParseName(volume.Device) - if err != nil { - allErrs = append(allErrs, field.Invalid(fldPath.Child("device"), volume.Device, fmt.Sprintf("invalid device name: %v", err))) - } else { - if isReservedDeviceName(prefix, idx) { - allErrs = append(allErrs, field.Forbidden(fldPath.Child("device"), fmt.Sprintf("device name %s is reserved", volume.Device))) - } + if _, _, err := device.ParseName(*volume.Device); err != nil { + allErrs = append(allErrs, field.Invalid(fldPath.Child("device"), *volume.Device, fmt.Sprintf("invalid device name: %v", err))) } } diff --git a/onmetal-apiserver/internal/apis/compute/validation/machine_test.go b/onmetal-apiserver/internal/apis/compute/validation/machine_test.go index b7f7bf91b..f9830c353 100644 --- a/onmetal-apiserver/internal/apis/compute/validation/machine_test.go +++ b/onmetal-apiserver/internal/apis/compute/validation/machine_test.go @@ -26,6 +26,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/pointer" ) func mustParseNewQuantity(s string) *resource.Quantity { @@ -127,11 +128,11 @@ var _ = Describe("Machine", func() { Volumes: []compute.Volume{ { Name: "foo", - Device: "vda", + Device: pointer.String("vda"), }, { Name: "bar", - Device: "vda", + Device: pointer.String("vda"), }, }, }, @@ -156,33 +157,18 @@ var _ = Describe("Machine", func() { Volumes: []compute.Volume{ { Name: "foo", - Device: "foobar", + Device: pointer.String("foobar"), }, }, }, }, ContainElement(InvalidField("spec.volume[0].device")), ), - Entry("reserved volume device", - &compute.Machine{ - Spec: compute.MachineSpec{ - Volumes: []compute.Volume{ - { - Name: "foo", - Device: "vda", - }, - }, - }, - }, - ContainElement(ForbiddenField("spec.volume[0].device")), - ), Entry("invalid ignition ref name", &compute.Machine{ Spec: compute.MachineSpec{ IgnitionRef: &commonv1alpha1.SecretKeySelector{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: "foo*", - }, + Name: "foo*", }, }, }, diff --git a/onmetal-apiserver/internal/apis/compute/zz_generated.deepcopy.go b/onmetal-apiserver/internal/apis/compute/zz_generated.deepcopy.go index 0edd786ef..bf4e4a489 100644 --- a/onmetal-apiserver/internal/apis/compute/zz_generated.deepcopy.go +++ b/onmetal-apiserver/internal/apis/compute/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -22,8 +22,8 @@ package compute import ( v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" - "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis/networking" - "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis/storage" + networking "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis/networking" + storage "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis/storage" v1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -676,6 +676,11 @@ func (in *ReferencedVolumeStatus) DeepCopy() *ReferencedVolumeStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Volume) DeepCopyInto(out *Volume) { *out = *in + if in.Device != nil { + in, out := &in.Device, &out.Device + *out = new(string) + **out = **in + } in.VolumeSource.DeepCopyInto(&out.VolumeSource) return } diff --git a/onmetal-apiserver/internal/apis/ipam/doc.go b/onmetal-apiserver/internal/apis/ipam/doc.go index 3ba7231f3..2d31180cc 100644 --- a/onmetal-apiserver/internal/apis/ipam/doc.go +++ b/onmetal-apiserver/internal/apis/ipam/doc.go @@ -19,4 +19,4 @@ // +groupName=ipam.api.onmetal.de // Package ipam is the internal version of the API. -package ipam // import "github.com/onmetal/onmetal-api/api/ipam" +package ipam // import "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/ipam" diff --git a/onmetal-apiserver/internal/apis/ipam/register.go b/onmetal-apiserver/internal/apis/ipam/register.go index 4269bc86e..5cff1b5b8 100644 --- a/onmetal-apiserver/internal/apis/ipam/register.go +++ b/onmetal-apiserver/internal/apis/ipam/register.go @@ -15,7 +15,6 @@ */ // Package ipam contains API Schema definitions for the ipam internal API group -// +kubebuilder:object:generate=true // +groupName=ipam.api.onmetal.de package ipam diff --git a/onmetal-apiserver/internal/apis/ipam/v1alpha1/zz_generated.conversion.go b/onmetal-apiserver/internal/apis/ipam/v1alpha1/zz_generated.conversion.go index fa72cc83f..f989d4434 100644 --- a/onmetal-apiserver/internal/apis/ipam/v1alpha1/zz_generated.conversion.go +++ b/onmetal-apiserver/internal/apis/ipam/v1alpha1/zz_generated.conversion.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/onmetal-apiserver/internal/apis/ipam/v1alpha1/zz_generated.defaults.go b/onmetal-apiserver/internal/apis/ipam/v1alpha1/zz_generated.defaults.go index 22a390c93..e079ca25b 100644 --- a/onmetal-apiserver/internal/apis/ipam/v1alpha1/zz_generated.defaults.go +++ b/onmetal-apiserver/internal/apis/ipam/v1alpha1/zz_generated.defaults.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/onmetal-apiserver/internal/apis/ipam/zz_generated.deepcopy.go b/onmetal-apiserver/internal/apis/ipam/zz_generated.deepcopy.go index bcce20028..1b42d1785 100644 --- a/onmetal-apiserver/internal/apis/ipam/zz_generated.deepcopy.go +++ b/onmetal-apiserver/internal/apis/ipam/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/onmetal-apiserver/internal/apis/networking/doc.go b/onmetal-apiserver/internal/apis/networking/doc.go index 25739554b..6c7d4340e 100644 --- a/onmetal-apiserver/internal/apis/networking/doc.go +++ b/onmetal-apiserver/internal/apis/networking/doc.go @@ -14,11 +14,11 @@ * limitations under the License. */ -// +k8s:deepcopy-gen=package,register +// +k8s:deepcopy-gen=package // +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/api/networking" +package networking // import "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/networking" diff --git a/onmetal-apiserver/internal/apis/networking/natgatewayrouting_type.go b/onmetal-apiserver/internal/apis/networking/natgatewayrouting_type.go index dac7e4513..8a9f619ce 100644 --- a/onmetal-apiserver/internal/apis/networking/natgatewayrouting_type.go +++ b/onmetal-apiserver/internal/apis/networking/natgatewayrouting_type.go @@ -19,6 +19,7 @@ package networking import ( commonv1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/types" ) // +genclient @@ -37,7 +38,10 @@ type NATGatewayRouting struct { } type NATGatewayDestination struct { - commonv1alpha1.LocalUIDReference + // Name is the name of the referenced entity. + Name string `json:"name"` + // UID is the UID of the referenced entity. + UID types.UID `json:"uid"` // IPs are the nat gateway ips used. IPs []NATGatewayDestinationIP } diff --git a/onmetal-apiserver/internal/apis/networking/register.go b/onmetal-apiserver/internal/apis/networking/register.go index 36f807ae5..a6ce2f15b 100644 --- a/onmetal-apiserver/internal/apis/networking/register.go +++ b/onmetal-apiserver/internal/apis/networking/register.go @@ -15,7 +15,6 @@ */ // Package networking contains API Schema definitions for the networking internal API group -// +kubebuilder:object:generate=true // +groupName=networking.api.onmetal.de package networking diff --git a/onmetal-apiserver/internal/apis/networking/v1alpha1/zz_generated.conversion.go b/onmetal-apiserver/internal/apis/networking/v1alpha1/zz_generated.conversion.go index 45ed49fdd..f5fb87018 100644 --- a/onmetal-apiserver/internal/apis/networking/v1alpha1/zz_generated.conversion.go +++ b/onmetal-apiserver/internal/apis/networking/v1alpha1/zz_generated.conversion.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -32,6 +32,7 @@ import ( v1 "k8s.io/apimachinery/pkg/apis/meta/v1" conversion "k8s.io/apimachinery/pkg/conversion" runtime "k8s.io/apimachinery/pkg/runtime" + types "k8s.io/apimachinery/pkg/types" ) func init() { @@ -877,7 +878,8 @@ func Convert_networking_NATGateway_To_v1alpha1_NATGateway(in *networking.NATGate } func autoConvert_v1alpha1_NATGatewayDestination_To_networking_NATGatewayDestination(in *v1alpha1.NATGatewayDestination, out *networking.NATGatewayDestination, s conversion.Scope) error { - out.LocalUIDReference = in.LocalUIDReference + out.Name = in.Name + out.UID = types.UID(in.UID) out.IPs = *(*[]networking.NATGatewayDestinationIP)(unsafe.Pointer(&in.IPs)) return nil } @@ -888,7 +890,8 @@ func Convert_v1alpha1_NATGatewayDestination_To_networking_NATGatewayDestination( } func autoConvert_networking_NATGatewayDestination_To_v1alpha1_NATGatewayDestination(in *networking.NATGatewayDestination, out *v1alpha1.NATGatewayDestination, s conversion.Scope) error { - out.LocalUIDReference = in.LocalUIDReference + out.Name = in.Name + out.UID = types.UID(in.UID) out.IPs = *(*[]v1alpha1.NATGatewayDestinationIP)(unsafe.Pointer(&in.IPs)) return nil } diff --git a/onmetal-apiserver/internal/apis/networking/v1alpha1/zz_generated.defaults.go b/onmetal-apiserver/internal/apis/networking/v1alpha1/zz_generated.defaults.go index 6fd8fe164..ccc48f486 100644 --- a/onmetal-apiserver/internal/apis/networking/v1alpha1/zz_generated.defaults.go +++ b/onmetal-apiserver/internal/apis/networking/v1alpha1/zz_generated.defaults.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/onmetal-apiserver/internal/apis/networking/validation/natgatewayrouting_test.go b/onmetal-apiserver/internal/apis/networking/validation/natgatewayrouting_test.go index 795838fdf..96bd26724 100644 --- a/onmetal-apiserver/internal/apis/networking/validation/natgatewayrouting_test.go +++ b/onmetal-apiserver/internal/apis/networking/validation/natgatewayrouting_test.go @@ -17,7 +17,6 @@ package validation import ( - commonv1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis/networking" . "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/testutils/validation" . "github.com/onsi/ginkgo/v2" @@ -47,8 +46,8 @@ var _ = Describe("NATGatewayRouting", func() { Entry("duplicate destination", &networking.NATGatewayRouting{ Destinations: []networking.NATGatewayDestination{ - {LocalUIDReference: commonv1alpha1.LocalUIDReference{Name: "foo"}}, - {LocalUIDReference: commonv1alpha1.LocalUIDReference{Name: "foo"}}, + {Name: "foo"}, + {Name: "foo"}, }, }, ContainElement(DuplicateField("destinations[1]")), diff --git a/onmetal-apiserver/internal/apis/networking/zz_generated.deepcopy.go b/onmetal-apiserver/internal/apis/networking/zz_generated.deepcopy.go index bcc9dc478..2f8979618 100644 --- a/onmetal-apiserver/internal/apis/networking/zz_generated.deepcopy.go +++ b/onmetal-apiserver/internal/apis/networking/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. @@ -22,7 +22,7 @@ package networking import ( v1alpha1 "github.com/onmetal/onmetal-api/api/common/v1alpha1" - "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis/ipam" + ipam "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/apis/ipam" corev1 "k8s.io/api/core/v1" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" runtime "k8s.io/apimachinery/pkg/runtime" @@ -503,7 +503,6 @@ func (in *NATGateway) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NATGatewayDestination) DeepCopyInto(out *NATGatewayDestination) { *out = *in - out.LocalUIDReference = in.LocalUIDReference if in.IPs != nil { in, out := &in.IPs, &out.IPs *out = make([]NATGatewayDestinationIP, len(*in)) diff --git a/onmetal-apiserver/internal/apis/storage/doc.go b/onmetal-apiserver/internal/apis/storage/doc.go index 16cda7a93..4d89c4491 100644 --- a/onmetal-apiserver/internal/apis/storage/doc.go +++ b/onmetal-apiserver/internal/apis/storage/doc.go @@ -21,4 +21,4 @@ // +groupName=storage.api.onmetal.de // Package storage is the internal version of the API. -package storage // import "github.com/onmetal/onmetal-api/api/storage" +package storage // import "github.com/onmetal/onmetal-api/onmetal-apiserver/internal/storage" diff --git a/onmetal-apiserver/internal/apis/storage/register.go b/onmetal-apiserver/internal/apis/storage/register.go index 8da2b612a..f6c479b5c 100644 --- a/onmetal-apiserver/internal/apis/storage/register.go +++ b/onmetal-apiserver/internal/apis/storage/register.go @@ -15,7 +15,6 @@ */ // Package storage contains API Schema definitions for the storage internal API group -// +kubebuilder:object:generate=true // +groupName=storage.api.onmetal.de package storage diff --git a/onmetal-apiserver/internal/apis/storage/v1alpha1/zz_generated.conversion.go b/onmetal-apiserver/internal/apis/storage/v1alpha1/zz_generated.conversion.go index e6feb3f39..96b65290d 100644 --- a/onmetal-apiserver/internal/apis/storage/v1alpha1/zz_generated.conversion.go +++ b/onmetal-apiserver/internal/apis/storage/v1alpha1/zz_generated.conversion.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/onmetal-apiserver/internal/apis/storage/v1alpha1/zz_generated.defaults.go b/onmetal-apiserver/internal/apis/storage/v1alpha1/zz_generated.defaults.go index eed1d7939..f4793d6f9 100644 --- a/onmetal-apiserver/internal/apis/storage/v1alpha1/zz_generated.defaults.go +++ b/onmetal-apiserver/internal/apis/storage/v1alpha1/zz_generated.defaults.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/onmetal-apiserver/internal/apis/storage/zz_generated.deepcopy.go b/onmetal-apiserver/internal/apis/storage/zz_generated.deepcopy.go index d80c736c1..dc3ed26a3 100644 --- a/onmetal-apiserver/internal/apis/storage/zz_generated.deepcopy.go +++ b/onmetal-apiserver/internal/apis/storage/zz_generated.deepcopy.go @@ -2,7 +2,7 @@ // +build !ignore_autogenerated /* - * Copyright (c) 2021 by the OnMetal authors. + * Copyright (c) 2022 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. diff --git a/onmetal-apiserver/internal/app/app_suite_test.go b/onmetal-apiserver/internal/app/app_suite_test.go new file mode 100644 index 000000000..ca5ae54f9 --- /dev/null +++ b/onmetal-apiserver/internal/app/app_suite_test.go @@ -0,0 +1,130 @@ +// 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 app_test + +import ( + "context" + "path/filepath" + "testing" + "time" + + "github.com/onmetal/controller-utils/buildutils" + computev1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + ipamv1alpha1 "github.com/onmetal/onmetal-api/api/ipam/v1alpha1" + networkingv1alpha1 "github.com/onmetal/onmetal-api/api/networking/v1alpha1" + storagev1alpha1 "github.com/onmetal/onmetal-api/api/storage/v1alpha1" + "github.com/onmetal/onmetal-api/testutils/envtestutils" + "github.com/onmetal/onmetal-api/testutils/envtestutils/apiserver" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/envtest" + "sigs.k8s.io/controller-runtime/pkg/envtest/komega" + logf "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/log/zap" +) + +const ( + pollingInterval = 50 * time.Millisecond + eventuallyTimeout = 3 * time.Second + consistentlyDuration = 1 * time.Second + apiServiceTimeout = 5 * time.Minute +) + +var ( + cfg *rest.Config + k8sClient client.Client + testEnv *envtest.Environment + testEnvExt *envtestutils.EnvironmentExtensions +) + +func TestAPIs(t *testing.T) { + _, reporterConfig := GinkgoConfiguration() + reporterConfig.SlowSpecThreshold = 10 * time.Second + SetDefaultConsistentlyPollingInterval(pollingInterval) + SetDefaultEventuallyPollingInterval(pollingInterval) + SetDefaultEventuallyTimeout(eventuallyTimeout) + SetDefaultConsistentlyDuration(consistentlyDuration) + + RegisterFailHandler(Fail) + + RunSpecs(t, "Compute Controller Suite") +} + +var _ = BeforeSuite(func() { + logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true))) + + var err error + + By("bootstrapping test environment") + testEnv = &envtest.Environment{} + testEnvExt = &envtestutils.EnvironmentExtensions{ + APIServiceDirectoryPaths: []string{filepath.Join("..", "..", "..", "config", "apiserver", "apiservice", "bases")}, + ErrorIfAPIServicePathIsMissing: true, + } + + cfg, err = envtestutils.StartWithExtensions(testEnv, testEnvExt) + Expect(err).NotTo(HaveOccurred()) + Expect(cfg).NotTo(BeNil()) + DeferCleanup(envtestutils.StopWithExtensions, testEnv, testEnvExt) + + Expect(computev1alpha1.AddToScheme(scheme.Scheme)).To(Succeed()) + Expect(storagev1alpha1.AddToScheme(scheme.Scheme)).To(Succeed()) + Expect(ipamv1alpha1.AddToScheme(scheme.Scheme)).To(Succeed()) + Expect(networkingv1alpha1.AddToScheme(scheme.Scheme)).To(Succeed()) + + k8sClient, err = client.New(cfg, client.Options{Scheme: scheme.Scheme}) + Expect(err).NotTo(HaveOccurred()) + Expect(k8sClient).NotTo(BeNil()) + + komega.SetClient(k8sClient) + + apiSrv, err := apiserver.New(cfg, apiserver.Options{ + MainPath: "github.com/onmetal/onmetal-api/onmetal-apiserver/cmd/apiserver", + BuildOptions: []buildutils.BuildOption{buildutils.ModModeMod}, + ETCDServers: []string{testEnv.ControlPlane.Etcd.URL.String()}, + Host: testEnvExt.APIServiceInstallOptions.LocalServingHost, + Port: testEnvExt.APIServiceInstallOptions.LocalServingPort, + CertDir: testEnvExt.APIServiceInstallOptions.LocalServingCertDir, + }) + Expect(err).NotTo(HaveOccurred()) + + Expect(apiSrv.Start()).To(Succeed()) + DeferCleanup(apiSrv.Stop) + + err = envtestutils.WaitUntilAPIServicesReadyWithTimeout(apiServiceTimeout, testEnvExt, k8sClient, scheme.Scheme) + Expect(err).NotTo(HaveOccurred()) +}) + +func SetupTest(ctx context.Context) *corev1.Namespace { + ns := &corev1.Namespace{} + + BeforeEach(func() { + *ns = corev1.Namespace{ + ObjectMeta: metav1.ObjectMeta{ + GenerateName: "testns-", + }, + } + Expect(k8sClient.Create(ctx, ns)).To(Succeed(), "failed to create test namespace") + + DeferCleanup(k8sClient.Delete, ctx, ns) + }) + + return ns +} diff --git a/onmetal-apiserver/internal/app/app_test.go b/onmetal-apiserver/internal/app/app_test.go new file mode 100644 index 000000000..68cea7cdc --- /dev/null +++ b/onmetal-apiserver/internal/app/app_test.go @@ -0,0 +1,155 @@ +// 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 app_test + +import ( + computev1alpha1 "github.com/onmetal/onmetal-api/api/compute/v1alpha1" + . "github.com/onmetal/onmetal-api/testutils" + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/utils/pointer" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +var _ = Describe("App", func() { + ctx := SetupContext() + ns := SetupTest(ctx) + + const fieldOwner = client.FieldOwner("fieldowner.test.api.onmetal.de/onmetal-apiserver") + + Context("Machine", func() { + It("should correctly apply machines with volumes and default devices", func() { + By("applying a machine with volumes") + machine := &computev1alpha1.Machine{ + TypeMeta: metav1.TypeMeta{ + APIVersion: computev1alpha1.SchemeGroupVersion.String(), + Kind: "Machine", + }, + ObjectMeta: metav1.ObjectMeta{ + Namespace: ns.Name, + Name: "my-machine", + }, + Spec: computev1alpha1.MachineSpec{ + MachineClassRef: corev1.LocalObjectReference{Name: "my-class"}, + Volumes: []computev1alpha1.Volume{ + { + Name: "foo", + VolumeSource: computev1alpha1.VolumeSource{ + EmptyDisk: &computev1alpha1.EmptyDiskVolumeSource{}, + }, + }, + }, + }, + } + Expect(k8sClient.Patch(ctx, machine, client.Apply, fieldOwner)).To(Succeed()) + + By("inspecting the machine's volumes") + Expect(machine.Spec.Volumes).To(Equal([]computev1alpha1.Volume{ + { + Name: "foo", + Device: pointer.String("oda"), + VolumeSource: computev1alpha1.VolumeSource{ + EmptyDisk: &computev1alpha1.EmptyDiskVolumeSource{}, + }, + }, + })) + + By("applying a changed machine with a second volume") + machine = &computev1alpha1.Machine{ + TypeMeta: metav1.TypeMeta{ + APIVersion: computev1alpha1.SchemeGroupVersion.String(), + Kind: "Machine", + }, + ObjectMeta: metav1.ObjectMeta{ + Namespace: ns.Name, + Name: "my-machine", + }, + Spec: computev1alpha1.MachineSpec{ + MachineClassRef: corev1.LocalObjectReference{Name: "my-class"}, + Volumes: []computev1alpha1.Volume{ + { + Name: "foo", + VolumeSource: computev1alpha1.VolumeSource{ + EmptyDisk: &computev1alpha1.EmptyDiskVolumeSource{}, + }, + }, + { + Name: "bar", + VolumeSource: computev1alpha1.VolumeSource{ + EmptyDisk: &computev1alpha1.EmptyDiskVolumeSource{}, + }, + }, + }, + }, + } + Expect(k8sClient.Patch(ctx, machine, client.Apply, fieldOwner)).To(Succeed()) + + By("inspecting the machine's volumes") + Expect(machine.Spec.Volumes).To(Equal([]computev1alpha1.Volume{ + { + Name: "foo", + Device: pointer.String("oda"), + VolumeSource: computev1alpha1.VolumeSource{ + EmptyDisk: &computev1alpha1.EmptyDiskVolumeSource{}, + }, + }, + { + Name: "bar", + Device: pointer.String("odb"), + VolumeSource: computev1alpha1.VolumeSource{ + EmptyDisk: &computev1alpha1.EmptyDiskVolumeSource{}, + }, + }, + })) + + By("applying a changed machine with the first volume removed") + machine = &computev1alpha1.Machine{ + TypeMeta: metav1.TypeMeta{ + APIVersion: computev1alpha1.SchemeGroupVersion.String(), + Kind: "Machine", + }, + ObjectMeta: metav1.ObjectMeta{ + Namespace: ns.Name, + Name: "my-machine", + }, + Spec: computev1alpha1.MachineSpec{ + MachineClassRef: corev1.LocalObjectReference{Name: "my-class"}, + Volumes: []computev1alpha1.Volume{ + { + Name: "bar", + VolumeSource: computev1alpha1.VolumeSource{ + EmptyDisk: &computev1alpha1.EmptyDiskVolumeSource{}, + }, + }, + }, + }, + } + Expect(k8sClient.Patch(ctx, machine, client.Apply, fieldOwner)).To(Succeed()) + + By("inspecting the machine's volumes") + Expect(machine.Spec.Volumes).To(Equal([]computev1alpha1.Volume{ + { + Name: "bar", + Device: pointer.String("odb"), + VolumeSource: computev1alpha1.VolumeSource{ + EmptyDisk: &computev1alpha1.EmptyDiskVolumeSource{}, + }, + }, + })) + }) + }) +})