update alibabacloud API group version to v1beta1 (#41)

Signed-off-by: ChrisLiu <chrisliu1995@163.com>
This commit is contained in:
ChrisLiu 2023-04-19 19:53:30 +08:00 committed by GitHub
parent ba8ce6c92d
commit 1cb53dea1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 47 additions and 59 deletions

View File

@ -1,4 +0,0 @@
// Package v1 contains API Schema definitions for the alibabacloud v1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=alibabacloud.com
package v1

View File

@ -0,0 +1,4 @@
// Package v1beta1 Package v1 contains API Schema definitions for the alibabacloud v1beta1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=alibabacloud.com
package v1beta1

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 The Kruise Authors.
Copyright 2023 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -14,52 +14,13 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package v1
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func init() {
SchemeBuilder.Register(&PodDNAT{}, &PodDNATList{})
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodDNAT let you specficy DNAT rule for pod on nat gateway
type PodDNAT struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec is the desired state of the PodDNAT.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
Spec PodDNATSpec `json:"spec,omitempty"`
// 'Status is the current state of the dnat.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Status PodDNATStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// PodDNATList is a collection of PodDNAT.
type PodDNATList struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
// Items is the list of PodDNAT.
Items []PodDNAT `json:"items"`
}
// PodDNATSpec describes the PodDNAT the user wishes to exist.
// PodDNATSpec defines the desired state of PodDNAT
type PodDNATSpec struct {
VSwitch *string `json:"vswitch,omitempty"` // deprecated
ENI *string `json:"eni,omitempty"` // deprecated
@ -79,7 +40,7 @@ type PortMapping struct {
InternalPort string `json:"internalPort,omitempty"`
}
// PodDNATStatus is the current state of the dnat.
// PodDNATStatus defines the observed state of PodDNAT
type PodDNATStatus struct {
// created create status
// +optional
@ -100,3 +61,28 @@ type Entry struct {
ForwardEntryID string `json:"forwardEntryId,omitempty"`
IPProtocol string `json:"ipProtocol,omitempty"`
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// PodDNAT is the Schema for the poddnats API
type PodDNAT struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec PodDNATSpec `json:"spec,omitempty"`
Status PodDNATStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// PodDNATList contains a list of PodDNAT
type PodDNATList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []PodDNAT `json:"items"`
}
func init() {
SchemeBuilder.Register(&PodDNAT{}, &PodDNATList{})
}

View File

@ -1,10 +1,10 @@
// NOTE: Boilerplate only. Ignore this file.
// Package v1 contains API Schema definitions for the alibabacloud v1 API group
// Package v1beta1 contains API Schema definitions for the alibabacloud v1beta1 API group
// +k8s:deepcopy-gen=package,register
// +groupName=alibabacloud.com
package v1
package v1beta1
import (
"k8s.io/apimachinery/pkg/runtime/schema"
@ -13,7 +13,7 @@ import (
var (
// SchemeGroupVersion is group version used to register these objects
SchemeGroupVersion = schema.GroupVersion{Group: "alibabacloud.com", Version: "v1"}
SchemeGroupVersion = schema.GroupVersion{Group: "alibabacloud.com", Version: "v1beta1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}

View File

@ -19,7 +19,7 @@ limitations under the License.
// Code generated by controller-gen. DO NOT EDIT.
package v1
package v1beta1
import (
runtime "k8s.io/apimachinery/pkg/runtime"

View File

@ -20,7 +20,7 @@ import (
"context"
gamekruiseiov1alpha1 "github.com/openkruise/kruise-game/apis/v1alpha1"
"github.com/openkruise/kruise-game/cloudprovider"
"github.com/openkruise/kruise-game/cloudprovider/alibabacloud/apis/v1"
"github.com/openkruise/kruise-game/cloudprovider/alibabacloud/apis/v1beta1"
"github.com/openkruise/kruise-game/cloudprovider/errors"
"github.com/openkruise/kruise-game/cloudprovider/utils"
corev1 "k8s.io/api/core/v1"
@ -83,7 +83,7 @@ func (n NatGwPlugin) OnPodUpdated(c client.Client, pod *corev1.Pod, ctx context.
return pod, errors.ToPluginError(err, errors.InternalError)
}
podDNat := &v1.PodDNAT{}
podDNat := &v1beta1.PodDNAT{}
err := c.Get(ctx, types.NamespacedName{
Name: pod.GetName(),
Namespace: pod.GetNamespace(),

View File

@ -15,10 +15,10 @@ spec:
singular: poddnat
scope: Namespaced
versions:
- name: v1
- name: v1beta1
schema:
openAPIV3Schema:
description: PodDNAT let you specficy DNAT rule for pod on nat gateway
description: PodDNAT is the Schema for the poddnats API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
@ -33,7 +33,7 @@ spec:
metadata:
type: object
spec:
description: 'Spec is the desired state of the PodDNAT. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
description: PodDNATSpec defines the desired state of PodDNAT
properties:
eni:
type: string
@ -66,7 +66,7 @@ spec:
type: string
type: object
status:
description: '''Status is the current state of the dnat. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status'
description: PodDNATStatus defines the observed state of PodDNAT
properties:
created:
description: created create status
@ -94,3 +94,5 @@ spec:
type: object
served: true
storage: true
subresources:
status: {}

View File

@ -31,7 +31,7 @@ import (
// to ensure that exec-entrypoint and run can make use of them.
_ "k8s.io/client-go/plugin/pkg/client/auth"
aliv1 "github.com/openkruise/kruise-game/cloudprovider/alibabacloud/apis/v1"
aliv1beta1 "github.com/openkruise/kruise-game/cloudprovider/alibabacloud/apis/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
@ -56,7 +56,7 @@ func init() {
utilruntime.Must(kruiseV1beta1.AddToScheme(scheme))
utilruntime.Must(kruiseV1alpha1.AddToScheme(scheme))
utilruntime.Must(aliv1.AddToScheme(scheme))
utilruntime.Must(aliv1beta1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
}