Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore Server v1beta1 Go API definition #12529

Merged
merged 3 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions controller/gen/apis/server/v1beta1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// +k8s:deepcopy-gen=package

package v1beta1
49 changes: 49 additions & 0 deletions controller/gen/apis/server/v1beta1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package v1beta1

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

"github.com/linkerd/linkerd2/controller/gen/apis/server"
)

var (
// SchemeGroupVersion is the identifier for the API which includes the name
// of the group and the version of the API.
SchemeGroupVersion = schema.GroupVersion{
Group: server.GroupName,
Version: "v1beta1",
}

// SchemeBuilder collects functions that add things to a scheme. It's to
// allow code to compile without explicitly referencing generated types.
// You should declare one in each package that will have generated deep
// copy or conversion functions.
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

// AddToScheme applies all the stored functions to the scheme. A non-nil error
// indicates that one function failed and the attempt was abandoned.
AddToScheme = SchemeBuilder.AddToScheme
)

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

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

// Adds the list of known types to Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&Server{},
&ServerList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
45 changes: 45 additions & 0 deletions controller/gen/apis/server/v1beta1/types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)

// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +groupName=policy.linkerd.io

type Server struct {
// TypeMeta is the metadata for the resource, like kind and apiversion
metav1.TypeMeta `json:",inline"`

// ObjectMeta contains the metadata for the particular object, including
// things like...
// - name
// - namespace
// - self link
// - labels
// - ... etc ...
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec is the custom resource spec
Spec ServerSpec `json:"spec"`
}

// ServerSpec specifies a Server resource.
type ServerSpec struct {
PodSelector *metav1.LabelSelector `json:"podSelector"`
Port intstr.IntOrString `json:"port,omitempty"`
ProxyProtocol string `json:"proxyProtocol,omitempty"`
}

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

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

Items []Server `json:"items"`
}
109 changes: 109 additions & 0 deletions controller/gen/apis/server/v1beta1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions controller/gen/apis/server/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ type Server struct {

// ServerSpec specifies a Server resource.
type ServerSpec struct {
PodSelector *metav1.LabelSelector `json:"podSelector"`
ExternalWorkloadSelector *metav1.LabelSelector `json:"externalWorkloadSelector"`
PodSelector *metav1.LabelSelector `json:"podSelector,omitempty"`
ExternalWorkloadSelector *metav1.LabelSelector `json:"externalWorkloadSelector,omitempty"`
Port intstr.IntOrString `json:"port,omitempty"`
ProxyProtocol string `json:"proxyProtocol,omitempty"`
}
Expand Down
13 changes: 13 additions & 0 deletions controller/gen/client/clientset/versioned/clientset.go

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

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

2 changes: 2 additions & 0 deletions controller/gen/client/clientset/versioned/fake/register.go

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

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

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

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

Loading
Loading