update alibabacloud API group version to v1beta1 (#41)
Signed-off-by: ChrisLiu <chrisliu1995@163.com>
This commit is contained in:
parent
ba8ce6c92d
commit
1cb53dea1b
|
|
@ -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
|
|
||||||
|
|
@ -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
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2022 The Kruise Authors.
|
Copyright 2023 The Kruise Authors.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with 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.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package v1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
// PodDNATSpec defines the desired state of PodDNAT
|
||||||
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.
|
|
||||||
type PodDNATSpec struct {
|
type PodDNATSpec struct {
|
||||||
VSwitch *string `json:"vswitch,omitempty"` // deprecated
|
VSwitch *string `json:"vswitch,omitempty"` // deprecated
|
||||||
ENI *string `json:"eni,omitempty"` // deprecated
|
ENI *string `json:"eni,omitempty"` // deprecated
|
||||||
|
|
@ -79,7 +40,7 @@ type PortMapping struct {
|
||||||
InternalPort string `json:"internalPort,omitempty"`
|
InternalPort string `json:"internalPort,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// PodDNATStatus is the current state of the dnat.
|
// PodDNATStatus defines the observed state of PodDNAT
|
||||||
type PodDNATStatus struct {
|
type PodDNATStatus struct {
|
||||||
// created create status
|
// created create status
|
||||||
// +optional
|
// +optional
|
||||||
|
|
@ -100,3 +61,28 @@ type Entry struct {
|
||||||
ForwardEntryID string `json:"forwardEntryId,omitempty"`
|
ForwardEntryID string `json:"forwardEntryId,omitempty"`
|
||||||
IPProtocol string `json:"ipProtocol,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{})
|
||||||
|
}
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
// NOTE: Boilerplate only. Ignore this file.
|
// 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
|
// +k8s:deepcopy-gen=package,register
|
||||||
// +groupName=alibabacloud.com
|
// +groupName=alibabacloud.com
|
||||||
|
|
||||||
package v1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
|
|
@ -13,7 +13,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
// 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 is used to add go types to the GroupVersionKind scheme
|
||||||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}
|
||||||
|
|
@ -19,7 +19,7 @@ limitations under the License.
|
||||||
|
|
||||||
// Code generated by controller-gen. DO NOT EDIT.
|
// Code generated by controller-gen. DO NOT EDIT.
|
||||||
|
|
||||||
package v1
|
package v1beta1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||||
|
|
@ -20,7 +20,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
gamekruiseiov1alpha1 "github.com/openkruise/kruise-game/apis/v1alpha1"
|
gamekruiseiov1alpha1 "github.com/openkruise/kruise-game/apis/v1alpha1"
|
||||||
"github.com/openkruise/kruise-game/cloudprovider"
|
"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/errors"
|
||||||
"github.com/openkruise/kruise-game/cloudprovider/utils"
|
"github.com/openkruise/kruise-game/cloudprovider/utils"
|
||||||
corev1 "k8s.io/api/core/v1"
|
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)
|
return pod, errors.ToPluginError(err, errors.InternalError)
|
||||||
}
|
}
|
||||||
|
|
||||||
podDNat := &v1.PodDNAT{}
|
podDNat := &v1beta1.PodDNAT{}
|
||||||
err := c.Get(ctx, types.NamespacedName{
|
err := c.Get(ctx, types.NamespacedName{
|
||||||
Name: pod.GetName(),
|
Name: pod.GetName(),
|
||||||
Namespace: pod.GetNamespace(),
|
Namespace: pod.GetNamespace(),
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,10 @@ spec:
|
||||||
singular: poddnat
|
singular: poddnat
|
||||||
scope: Namespaced
|
scope: Namespaced
|
||||||
versions:
|
versions:
|
||||||
- name: v1
|
- name: v1beta1
|
||||||
schema:
|
schema:
|
||||||
openAPIV3Schema:
|
openAPIV3Schema:
|
||||||
description: PodDNAT let you specficy DNAT rule for pod on nat gateway
|
description: PodDNAT is the Schema for the poddnats API
|
||||||
properties:
|
properties:
|
||||||
apiVersion:
|
apiVersion:
|
||||||
description: 'APIVersion defines the versioned schema of this representation
|
description: 'APIVersion defines the versioned schema of this representation
|
||||||
|
|
@ -33,7 +33,7 @@ spec:
|
||||||
metadata:
|
metadata:
|
||||||
type: object
|
type: object
|
||||||
spec:
|
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:
|
properties:
|
||||||
eni:
|
eni:
|
||||||
type: string
|
type: string
|
||||||
|
|
@ -66,7 +66,7 @@ spec:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
status:
|
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:
|
properties:
|
||||||
created:
|
created:
|
||||||
description: created create status
|
description: created create status
|
||||||
|
|
@ -94,3 +94,5 @@ spec:
|
||||||
type: object
|
type: object
|
||||||
served: true
|
served: true
|
||||||
storage: true
|
storage: true
|
||||||
|
subresources:
|
||||||
|
status: {}
|
||||||
|
|
|
||||||
4
main.go
4
main.go
|
|
@ -31,7 +31,7 @@ import (
|
||||||
// to ensure that exec-entrypoint and run can make use of them.
|
// to ensure that exec-entrypoint and run can make use of them.
|
||||||
_ "k8s.io/client-go/plugin/pkg/client/auth"
|
_ "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"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
|
||||||
|
|
@ -56,7 +56,7 @@ func init() {
|
||||||
utilruntime.Must(kruiseV1beta1.AddToScheme(scheme))
|
utilruntime.Must(kruiseV1beta1.AddToScheme(scheme))
|
||||||
utilruntime.Must(kruiseV1alpha1.AddToScheme(scheme))
|
utilruntime.Must(kruiseV1alpha1.AddToScheme(scheme))
|
||||||
|
|
||||||
utilruntime.Must(aliv1.AddToScheme(scheme))
|
utilruntime.Must(aliv1beta1.AddToScheme(scheme))
|
||||||
//+kubebuilder:scaffold:scheme
|
//+kubebuilder:scaffold:scheme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue