mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
promote TracingConfiguration to v1beta1
This commit is contained in:
parent
fc3cec6bf3
commit
4be473c774
@ -23,10 +23,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const GroupName = "apiserver.k8s.io"
|
const GroupName = "apiserver.k8s.io"
|
||||||
|
const ConfigGroupName = "apiserver.config.k8s.io"
|
||||||
|
|
||||||
// SchemeGroupVersion is group version used to register these objects
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
|
||||||
|
|
||||||
|
// ConfigSchemeGroupVersion is group version used to register these objects
|
||||||
|
var ConfigSchemeGroupVersion = schema.GroupVersion{Group: ConfigGroupName, Version: "v1beta1"}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
// TODO: move SchemeBuilder with zz_generated.deepcopy.go to k8s.io/api.
|
||||||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes.
|
||||||
@ -47,6 +51,9 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
|||||||
scheme.AddKnownTypes(SchemeGroupVersion,
|
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||||
&EgressSelectorConfiguration{},
|
&EgressSelectorConfiguration{},
|
||||||
)
|
)
|
||||||
|
scheme.AddKnownTypes(ConfigSchemeGroupVersion,
|
||||||
|
&TracingConfiguration{},
|
||||||
|
)
|
||||||
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -118,3 +118,23 @@ type TLSConfig struct {
|
|||||||
// +optional
|
// +optional
|
||||||
ClientCert string `json:"clientCert,omitempty"`
|
ClientCert string `json:"clientCert,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||||
|
|
||||||
|
// TracingConfiguration provides versioned configuration for tracing clients.
|
||||||
|
type TracingConfiguration struct {
|
||||||
|
metav1.TypeMeta `json:",inline"`
|
||||||
|
|
||||||
|
// +optional
|
||||||
|
// Endpoint of the collector that's running on the control-plane node.
|
||||||
|
// The APIServer uses the egressType ControlPlane when sending data to the collector.
|
||||||
|
// The syntax is defined in https://github.com/grpc/grpc/blob/master/doc/naming.md.
|
||||||
|
// Defaults to the otlpgrpc default, localhost:4317
|
||||||
|
// The connection is insecure, and does not support TLS.
|
||||||
|
Endpoint *string `json:"endpoint,omitempty" protobuf:"bytes,1,opt,name=endpoint"`
|
||||||
|
|
||||||
|
// +optional
|
||||||
|
// SamplingRatePerMillion is the number of samples to collect per million spans.
|
||||||
|
// Defaults to 0.
|
||||||
|
SamplingRatePerMillion *int32 `json:"samplingRatePerMillion,omitempty" protobuf:"varint,2,opt,name=samplingRatePerMillion"`
|
||||||
|
}
|
||||||
|
@ -81,6 +81,16 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||||||
}); err != nil {
|
}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*TracingConfiguration)(nil), (*apiserver.TracingConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_v1beta1_TracingConfiguration_To_apiserver_TracingConfiguration(a.(*TracingConfiguration), b.(*apiserver.TracingConfiguration), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := s.AddGeneratedConversionFunc((*apiserver.TracingConfiguration)(nil), (*TracingConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
|
return Convert_apiserver_TracingConfiguration_To_v1beta1_TracingConfiguration(a.(*apiserver.TracingConfiguration), b.(*TracingConfiguration), scope)
|
||||||
|
}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if err := s.AddGeneratedConversionFunc((*Transport)(nil), (*apiserver.Transport)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
if err := s.AddGeneratedConversionFunc((*Transport)(nil), (*apiserver.Transport)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||||
return Convert_v1beta1_Transport_To_apiserver_Transport(a.(*Transport), b.(*apiserver.Transport), scope)
|
return Convert_v1beta1_Transport_To_apiserver_Transport(a.(*Transport), b.(*apiserver.Transport), scope)
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
@ -238,6 +248,28 @@ func Convert_apiserver_TLSConfig_To_v1beta1_TLSConfig(in *apiserver.TLSConfig, o
|
|||||||
return autoConvert_apiserver_TLSConfig_To_v1beta1_TLSConfig(in, out, s)
|
return autoConvert_apiserver_TLSConfig_To_v1beta1_TLSConfig(in, out, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func autoConvert_v1beta1_TracingConfiguration_To_apiserver_TracingConfiguration(in *TracingConfiguration, out *apiserver.TracingConfiguration, s conversion.Scope) error {
|
||||||
|
out.Endpoint = (*string)(unsafe.Pointer(in.Endpoint))
|
||||||
|
out.SamplingRatePerMillion = (*int32)(unsafe.Pointer(in.SamplingRatePerMillion))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_v1beta1_TracingConfiguration_To_apiserver_TracingConfiguration is an autogenerated conversion function.
|
||||||
|
func Convert_v1beta1_TracingConfiguration_To_apiserver_TracingConfiguration(in *TracingConfiguration, out *apiserver.TracingConfiguration, s conversion.Scope) error {
|
||||||
|
return autoConvert_v1beta1_TracingConfiguration_To_apiserver_TracingConfiguration(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
|
func autoConvert_apiserver_TracingConfiguration_To_v1beta1_TracingConfiguration(in *apiserver.TracingConfiguration, out *TracingConfiguration, s conversion.Scope) error {
|
||||||
|
out.Endpoint = (*string)(unsafe.Pointer(in.Endpoint))
|
||||||
|
out.SamplingRatePerMillion = (*int32)(unsafe.Pointer(in.SamplingRatePerMillion))
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert_apiserver_TracingConfiguration_To_v1beta1_TracingConfiguration is an autogenerated conversion function.
|
||||||
|
func Convert_apiserver_TracingConfiguration_To_v1beta1_TracingConfiguration(in *apiserver.TracingConfiguration, out *TracingConfiguration, s conversion.Scope) error {
|
||||||
|
return autoConvert_apiserver_TracingConfiguration_To_v1beta1_TracingConfiguration(in, out, s)
|
||||||
|
}
|
||||||
|
|
||||||
func autoConvert_v1beta1_Transport_To_apiserver_Transport(in *Transport, out *apiserver.Transport, s conversion.Scope) error {
|
func autoConvert_v1beta1_Transport_To_apiserver_Transport(in *Transport, out *apiserver.Transport, s conversion.Scope) error {
|
||||||
out.TCP = (*apiserver.TCPTransport)(unsafe.Pointer(in.TCP))
|
out.TCP = (*apiserver.TCPTransport)(unsafe.Pointer(in.TCP))
|
||||||
out.UDS = (*apiserver.UDSTransport)(unsafe.Pointer(in.UDS))
|
out.UDS = (*apiserver.UDSTransport)(unsafe.Pointer(in.UDS))
|
||||||
|
@ -132,6 +132,41 @@ func (in *TLSConfig) DeepCopy() *TLSConfig {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
|
func (in *TracingConfiguration) DeepCopyInto(out *TracingConfiguration) {
|
||||||
|
*out = *in
|
||||||
|
out.TypeMeta = in.TypeMeta
|
||||||
|
if in.Endpoint != nil {
|
||||||
|
in, out := &in.Endpoint, &out.Endpoint
|
||||||
|
*out = new(string)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
if in.SamplingRatePerMillion != nil {
|
||||||
|
in, out := &in.SamplingRatePerMillion, &out.SamplingRatePerMillion
|
||||||
|
*out = new(int32)
|
||||||
|
**out = **in
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TracingConfiguration.
|
||||||
|
func (in *TracingConfiguration) DeepCopy() *TracingConfiguration {
|
||||||
|
if in == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out := new(TracingConfiguration)
|
||||||
|
in.DeepCopyInto(out)
|
||||||
|
return out
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||||
|
func (in *TracingConfiguration) DeepCopyObject() runtime.Object {
|
||||||
|
if c := in.DeepCopy(); c != nil {
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||||
func (in *Transport) DeepCopyInto(out *Transport) {
|
func (in *Transport) DeepCopyInto(out *Transport) {
|
||||||
*out = *in
|
*out = *in
|
||||||
|
@ -76,7 +76,7 @@ egressSelections:
|
|||||||
defer os.Remove(tracingConfigFile.Name())
|
defer os.Remove(tracingConfigFile.Name())
|
||||||
|
|
||||||
if err := os.WriteFile(tracingConfigFile.Name(), []byte(fmt.Sprintf(`
|
if err := os.WriteFile(tracingConfigFile.Name(), []byte(fmt.Sprintf(`
|
||||||
apiVersion: apiserver.config.k8s.io/v1alpha1
|
apiVersion: apiserver.config.k8s.io/v1beta1
|
||||||
kind: TracingConfiguration
|
kind: TracingConfiguration
|
||||||
endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil {
|
endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -118,7 +118,7 @@ func TestAPIServerTracing(t *testing.T) {
|
|||||||
defer os.Remove(tracingConfigFile.Name())
|
defer os.Remove(tracingConfigFile.Name())
|
||||||
|
|
||||||
if err := os.WriteFile(tracingConfigFile.Name(), []byte(fmt.Sprintf(`
|
if err := os.WriteFile(tracingConfigFile.Name(), []byte(fmt.Sprintf(`
|
||||||
apiVersion: apiserver.config.k8s.io/v1alpha1
|
apiVersion: apiserver.config.k8s.io/v1beta1
|
||||||
kind: TracingConfiguration
|
kind: TracingConfiguration
|
||||||
samplingRatePerMillion: 1000000
|
samplingRatePerMillion: 1000000
|
||||||
endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil {
|
endpoint: %s`, listener.Addr().String())), os.FileMode(0755)); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user