<ins> /* Copyright 2016 The Kubernetes Authors All rights reserved. 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 protoc-gen-gogo. // source: k8s.io/kubernetes/pkg/apis/apps/v1alpha1/generated.proto // DO NOT EDIT! /* Package v1alpha1 is a generated protocol buffer package. It is generated from these files: k8s.io/kubernetes/pkg/apis/apps/v1alpha1/generated.proto It has these top-level messages: PetSet PetSetList PetSetSpec PetSetStatus */ package v1alpha1 import proto "github.com/gogo/protobuf/proto" import fmt "fmt" import math "math" import _ "github.com/gogo/protobuf/gogoproto" import _ "k8s.io/kubernetes/pkg/api/resource" import k8s_io_kubernetes_pkg_api_unversioned "k8s.io/kubernetes/pkg/api/unversioned" import k8s_io_kubernetes_pkg_api_v1 "k8s.io/kubernetes/pkg/api/v1" import _ "k8s.io/kubernetes/pkg/util/intstr" import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf var _ = math.Inf func (m *PetSet) Reset()         { *m = PetSet{} } func (m *PetSet) String() string { return proto.CompactTextString(m) } func (*PetSet) ProtoMessage()    {} func (m *PetSetList) Reset()         { *m = PetSetList{} } func (m *PetSetList) String() string { return proto.CompactTextString(m) } func (*PetSetList) ProtoMessage()    {} func (m *PetSetSpec) Reset()         { *m = PetSetSpec{} } func (m *PetSetSpec) String() string { return proto.CompactTextString(m) } func (*PetSetSpec) ProtoMessage()    {} func (m *PetSetStatus) Reset()         { *m = PetSetStatus{} } func (m *PetSetStatus) String() string { return proto.CompactTextString(m) } func (*PetSetStatus) ProtoMessage()    {} func init() { proto.RegisterType((*PetSet)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.PetSet") proto.RegisterType((*PetSetList)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.PetSetList") proto.RegisterType((*PetSetSpec)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.PetSetSpec") proto.RegisterType((*PetSetStatus)(nil), "k8s.io.kubernetes.pkg.apis.apps.v1alpha1.PetSetStatus") } func (m *PetSet) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *PetSet) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ObjectMeta.Size())) n1, err := m.ObjectMeta.MarshalTo(data[i:]) if err != nil { return 0, err } i += n1 data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(m.Spec.Size())) n2, err := m.Spec.MarshalTo(data[i:]) if err != nil { return 0, err } i += n2 data[i] = 0x1a i++ i = encodeVarintGenerated(data, i, uint64(m.Status.Size())) n3, err := m.Status.MarshalTo(data[i:]) if err != nil { return 0, err } i += n3 return i, nil } func (m *PetSetList) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *PetSetList) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l data[i] = 0xa i++ i = encodeVarintGenerated(data, i, uint64(m.ListMeta.Size())) n4, err := m.ListMeta.MarshalTo(data[i:]) if err != nil { return 0, err } i += n4 if len(m.Items) > 0 { for _, msg := range m.Items { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } return i, nil } func (m *PetSetSpec) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *PetSetSpec) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.Replicas != nil { data[i] = 0x8 i++ i = encodeVarintGenerated(data, i, uint64(*m.Replicas)) } if m.Selector != nil { data[i] = 0x12 i++ i = encodeVarintGenerated(data, i, uint64(m.Selector.Size())) n5, err := m.Selector.MarshalTo(data[i:]) if err != nil { return 0, err } i += n5 } data[i] = 0x1a i++ i = encodeVarintGenerated(data, i, uint64(m.Template.Size())) n6, err := m.Template.MarshalTo(data[i:]) if err != nil { return 0, err } i += n6 if len(m.VolumeClaimTemplates) > 0 { for _, msg := range m.VolumeClaimTemplates { data[i] = 0x22 i++ i = encodeVarintGenerated(data, i, uint64(msg.Size())) n, err := msg.MarshalTo(data[i:]) if err != nil { return 0, err } i += n } } data[i] = 0x2a i++ i = encodeVarintGenerated(data, i, uint64(len(m.ServiceName))) i += copy(data[i:], m.ServiceName) return i, nil } func (m *PetSetStatus) Marshal() (data []byte, err error) { size := m.Size() data = make([]byte, size) n, err := m.MarshalTo(data) if err != nil { return nil, err } return data[:n], nil } func (m *PetSetStatus) MarshalTo(data []byte) (int, error) { var i int _ = i var l int _ = l if m.ObservedGeneration != nil { data[i] = 0x8 i++ i = encodeVarintGenerated(data, i, uint64(*m.ObservedGeneration)) } data[i] = 0x10 i++ i = encodeVarintGenerated(data, i, uint64(m.Replicas)) return i, nil } func encodeFixed64Generated(data []byte, offset int, v uint64) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) data[offset+4] = uint8(v >> 32) data[offset+5] = uint8(v >> 40) data[offset+6] = uint8(v >> 48) data[offset+7] = uint8(v >> 56) return offset + 8 } func encodeFixed32Generated(data []byte, offset int, v uint32) int { data[offset] = uint8(v) data[offset+1] = uint8(v >> 8) data[offset+2] = uint8(v >> 16) data[offset+3] = uint8(v >> 24) return offset + 4 } func encodeVarintGenerated(data []byte, offset int, v uint64) int { for v >= 1<<7 { data[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } data[offset] = uint8(v) return offset + 1 } func (m *PetSet) Size() (n int) { var l int _ = l l = m.ObjectMeta.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Spec.Size() n += 1 + l + sovGenerated(uint64(l)) l = m.Status.Size() n += 1 + l + sovGenerated(uint64(l)) return n } func (m *PetSetList) Size() (n int) { var l int _ = l l = m.ListMeta.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.Items) > 0 { for _, e := range m.Items { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } return n } func (m *PetSetSpec) Size() (n int) { var l int _ = l if m.Replicas != nil { n += 1 + sovGenerated(uint64(*m.Replicas)) } if m.Selector != nil { l = m.Selector.Size() n += 1 + l + sovGenerated(uint64(l)) } l = m.Template.Size() n += 1 + l + sovGenerated(uint64(l)) if len(m.VolumeClaimTemplates) > 0 { for _, e := range m.VolumeClaimTemplates { l = e.Size() n += 1 + l + sovGenerated(uint64(l)) } } l = len(m.ServiceName) n += 1 + l + sovGenerated(uint64(l)) return n } func (m *PetSetStatus) Size() (n int) { var l int _ = l if m.ObservedGeneration != nil { n += 1 + sovGenerated(uint64(*m.ObservedGeneration)) } n += 1 + sovGenerated(uint64(m.Replicas)) return n } func sovGenerated(x uint64) (n int) { for { n++ x >>= 7 if x == 0 { break } } return n } func sozGenerated(x uint64) (n int) { return sovGenerated(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *PetSet) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PetSet: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PetSet: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ObjectMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ObjectMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Spec", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Spec.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Status.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PetSetList) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PetSetList: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PetSetList: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ListMeta", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.ListMeta.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.Items = append(m.Items, PetSet{}) if err := m.Items[len(m.Items)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PetSetSpec) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PetSetSpec: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PetSetSpec: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Replicas", wireType) } var v int32 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int32(b) & 0x7F) << shift if b < 0x80 { break } } m.Replicas = &v case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Selector", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if m.Selector == nil { m.Selector = &k8s_io_kubernetes_pkg_api_unversioned.LabelSelector{} } if err := m.Selector.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Template", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } if err := m.Template.Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VolumeClaimTemplates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } if msglen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } m.VolumeClaimTemplates = append(m.VolumeClaimTemplates, k8s_io_kubernetes_pkg_api_v1.PersistentVolumeClaim{}) if err := m.VolumeClaimTemplates[len(m.VolumeClaimTemplates)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ stringLen |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } intStringLen := int(stringLen) if intStringLen < 0 { return ErrInvalidLengthGenerated } postIndex := iNdEx + intStringLen if postIndex > l { return io.ErrUnexpectedEOF } m.ServiceName = string(data[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func (m *PetSetStatus) Unmarshal(data []byte) error { l := len(data) iNdEx := 0 for iNdEx < l { preIndex := iNdEx var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { return fmt.Errorf("proto: PetSetStatus: wiretype end group for non-group") } if fieldNum <= 0 { return fmt.Errorf("proto: PetSetStatus: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ObservedGeneration", wireType) } var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ v |= (int64(b) & 0x7F) << shift if b < 0x80 { break } } m.ObservedGeneration = &v case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Replicas", wireType) } m.Replicas = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated } if iNdEx >= l { return io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ m.Replicas |= (int32(b) & 0x7F) << shift if b < 0x80 { break } } default: iNdEx = preIndex skippy, err := skipGenerated(data[iNdEx:]) if err != nil { return err } if skippy < 0 { return ErrInvalidLengthGenerated } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } iNdEx += skippy } } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } func skipGenerated(data []byte) (n int, err error) { l := len(data) iNdEx := 0 for iNdEx < l { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } wireType := int(wire & 0x7) switch wireType { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } iNdEx++ if data[iNdEx-1] < 0x80 { break } } return iNdEx, nil case 1: iNdEx += 8 return iNdEx, nil case 2: var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ length |= (int(b) & 0x7F) << shift if b < 0x80 { break } } iNdEx += length if length < 0 { return 0, ErrInvalidLengthGenerated } return iNdEx, nil case 3: for { var innerWire uint64 var start int = iNdEx for shift := uint(0); ; shift += 7 { if shift >= 64 { return 0, ErrIntOverflowGenerated } if iNdEx >= l { return 0, io.ErrUnexpectedEOF } b := data[iNdEx] iNdEx++ innerWire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } innerWireType := int(innerWire & 0x7) if innerWireType == 4 { break } next, err := skipGenerated(data[start:]) if err != nil { return 0, err } iNdEx = start + next } return iNdEx, nil case 4: return iNdEx, nil case 5: iNdEx += 4 return iNdEx, nil default: return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } } panic("unreachable") } var ( ErrInvalidLengthGenerated = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowGenerated   = fmt.Errorf("proto: integer overflow") ) </ins>


} // inClusterClientConfig makes a config that will work from within a kubernetes cluster container environment. <del> type inClusterClientConfig struct{} </del> <ins> // Can take options overrides for flags explicitly provided to the command inside the cluster container. type inClusterClientConfig struct { overrides               *ConfigOverrides inClusterConfigProvider func() (*restclient.Config, error) } </ins> <del> var _ ClientConfig = inClusterClientConfig{} </del> <ins> var _ ClientConfig = &inClusterClientConfig{} </ins> <del> func (inClusterClientConfig) RawConfig() (clientcmdapi.Config, error) { </del> <ins> func (config *inClusterClientConfig) RawConfig() (clientcmdapi.Config, error) { </ins> return clientcmdapi.Config{}, fmt.Errorf("inCluster environment config doesn't support multiple clusters") } <del> func (inClusterClientConfig) ClientConfig() (*restclient.Config, error) { return restclient.InClusterConfig() </del> <ins> func (config *inClusterClientConfig) ClientConfig() (*restclient.Config, error) { if config.inClusterConfigProvider == nil { config.inClusterConfigProvider = restclient.InClusterConfig } icc, err := config.inClusterConfigProvider() if err != nil { return nil, err } // in-cluster configs only takes a host, token, or CA file // if any of them were individually provided, ovewrite anything else if config.overrides != nil { if server := config.overrides.ClusterInfo.Server; len(server) > 0 { icc.Host = server } if token := config.overrides.AuthInfo.Token; len(token) > 0 { icc.BearerToken = token } if certificateAuthorityFile := config.overrides.ClusterInfo.CertificateAuthority; len(certificateAuthorityFile) > 0 { icc.TLSClientConfig.CAFile = certificateAuthorityFile } } return icc, err </ins> } <del> func (inClusterClientConfig) Namespace() (string, bool, error) { </del> <ins> func (config *inClusterClientConfig) Namespace() (string, bool, error) { </ins> // This way assumes you've set the POD_NAMESPACE environment variable using the downward API. // This check has to be done first for backwards compatibility with the way InClusterConfig was originally set up if ns := os.Getenv("POD_NAMESPACE"); ns != "" {


"The same PVC should be used after failover.") By("verifying the container output has 2 lines, indicating the pod has been created twice using the same regional PD.") <del> pod = getPod(c, ns, regionalPDLabels) </del> logs, err := framework.GetPodLogs(c, ns, pod.Name, "") Expect(err).NotTo(HaveOccurred(), "Error getting logs from pod %s in namespace %s", pod.Name, ns)


package plugin import ( <ins> "context" "fmt" "net" "os" "path/filepath" "sync" </ins> "testing" "github.com/stretchr/testify/assert" <del> v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" </del> <ins> "google.golang.org/grpc" drapb "k8s.io/kubelet/pkg/apis/dra/v1alpha4" "k8s.io/kubernetes/test/utils/ktesting" </ins> ) <del> func getFakeNode() (*v1.Node, error) { return &v1.Node{ObjectMeta: metav1.ObjectMeta{Name: "worker"}}, nil </del> <ins> const ( v1alpha4Version = "v1alpha4" ) type fakeV1alpha4GRPCServer struct { drapb.UnimplementedNodeServer } var _ drapb.NodeServer = &fakeV1alpha4GRPCServer{} func (f *fakeV1alpha4GRPCServer) NodePrepareResources(ctx context.Context, in *drapb.NodePrepareResourcesRequest) (*drapb.NodePrepareResourcesResponse, error) { return &drapb.NodePrepareResourcesResponse{Claims: map[string]*drapb.NodePrepareResourceResponse{"claim-uid": { Devices: []*drapb.Device{ { RequestNames: []string{"test-request"}, CDIDeviceIDs: []string{"test-cdi-id"}, }, }, }}}, nil } func (f *fakeV1alpha4GRPCServer) NodeUnprepareResources(ctx context.Context, in *drapb.NodeUnprepareResourcesRequest) (*drapb.NodeUnprepareResourcesResponse, error) { return &drapb.NodeUnprepareResourcesResponse{}, nil } type tearDown func() func setupFakeGRPCServer(version string) (string, tearDown, error) { p, err := os.MkdirTemp("", "dra_plugin") if err != nil { return "", nil, err } closeCh := make(chan struct{}) addr := filepath.Join(p, "server.sock") teardown := func() { close(closeCh) if err := os.RemoveAll(addr); err != nil { panic(err) } } listener, err := net.Listen("unix", addr) if err != nil { teardown() return "", nil, err } s := grpc.NewServer() switch version { case v1alpha4Version: fakeGRPCServer := &fakeV1alpha4GRPCServer{} drapb.RegisterNodeServer(s, fakeGRPCServer) default: return "", nil, fmt.Errorf("unsupported version: %s", version) } go func() { go func() { if err := s.Serve(listener); err != nil { panic(err) } }() <-closeCh s.GracefulStop() }() return addr, teardown, nil </ins> } <del> func TestRegistrationHandler_ValidatePlugin(t *testing.T) { newRegistrationHandler := func() *RegistrationHandler { return NewRegistrationHandler(nil, getFakeNode) </del> <ins> func TestGRPCConnIsReused(t *testing.T) { tCtx := ktesting.Init(t) addr, teardown, err := setupFakeGRPCServer(v1alpha4Version) if err != nil { t.Fatal(err) } defer teardown() reusedConns := make(map[*grpc.ClientConn]int) wg := sync.WaitGroup{} m := sync.Mutex{} p := &Plugin{ backgroundCtx:     tCtx, endpoint:          addr, clientCallTimeout: defaultClientCallTimeout, </ins> } <ins> conn, err := p.getOrCreateGRPCConn() defer func() { err := conn.Close() if err != nil { t.Error(err) } }() if err != nil { t.Fatal(err) } // ensure the plugin we are using is registered draPlugins.add("dummy-plugin", p) defer draPlugins.delete("dummy-plugin") // we call `NodePrepareResource` 2 times and check whether a new connection is created or the same is reused for i := 0; i < 2; i++ { wg.Add(1) go func() { defer wg.Done() client, err := NewDRAPluginClient("dummy-plugin") if err != nil { t.Error(err) return } req := &drapb.NodePrepareResourcesRequest{ Claims: []*drapb.Claim{ { Namespace: "dummy-namespace", UID:       "dummy-uid", Name:      "dummy-claim", }, }, } _, err = client.NodePrepareResources(tCtx, req) assert.NoError(t, err) client.mutex.Lock() conn := client.conn client.mutex.Unlock() m.Lock() defer m.Unlock() reusedConns[conn]++ }() } wg.Wait() // We should have only one entry otherwise it means another gRPC connection has been created if len(reusedConns) != 1 { t.Errorf("expected length to be 1 but got %d", len(reusedConns)) } if counter, ok := reusedConns[conn]; ok && counter != 2 { t.Errorf("expected counter to be 2 but got %d", counter) } } func TestNewDRAPluginClient(t *testing.T) { </ins> for _, test := range []struct { description string <del> handler     func() *RegistrationHandler </del> <ins> setup       func(string) tearDown </ins> pluginName  string <del> endpoint    string versions    []string </del> shouldError bool }{ { <del> description: "no versions provided", handler:     newRegistrationHandler, </del> <ins> description: "plugin name is empty", setup: func(_ string) tearDown { return func() {} }, pluginName:  "", </ins> shouldError: true, }, { <del> description: "unsupported version", handler:     newRegistrationHandler, versions:    []string{"v2.0.0"}, </del> <ins> description: "plugin name not found in the list", setup: func(_ string) tearDown { return func() {} }, pluginName:  "plugin-name-not-found-in-the-list", </ins> shouldError: true, }, { <del> description: "plugin already registered with a higher supported version", handler: func() *RegistrationHandler { handler := newRegistrationHandler() if err := handler.RegisterPlugin("this-plugin-already-exists-and-has-a-long-name-so-it-doesnt-collide", "", []string{"v1.1.0"}, nil); err != nil { t.Fatal(err) </del> <ins> description: "plugin exists", setup: func(name string) tearDown { draPlugins.add(name, &Plugin{}) return func() { draPlugins.delete(name) </ins> } <del> return handler </del> }, <del> pluginName:  "this-plugin-already-exists-and-has-a-long-name-so-it-doesnt-collide", versions:    []string{"v1.0.0"}, shouldError: true, }, { description: "should validate the plugin", handler:     newRegistrationHandler, pluginName:  "this-is-a-dummy-plugin-with-a-long-name-so-it-doesnt-collide", versions:    []string{"v1.3.0"}, </del> <ins> pluginName: "dummy-plugin", </ins> }, } { t.Run(test.description, func(t *testing.T) { <del> handler := test.handler() err := handler.ValidatePlugin(test.pluginName, test.endpoint, test.versions) </del> <ins> teardown := test.setup(test.pluginName) defer teardown() client, err := NewDRAPluginClient(test.pluginName) </ins> if test.shouldError { <ins> assert.Nil(t, client) </ins> assert.Error(t, err) } else { <ins> assert.NotNil(t, client) </ins> assert.Nil(t, err) } }) } <ins> } </ins> <del> t.Cleanup(func() { handler := newRegistrationHandler() handler.DeRegisterPlugin("this-plugin-already-exists-and-has-a-long-name-so-it-doesnt-collide") handler.DeRegisterPlugin("this-is-a-dummy-plugin-with-a-long-name-so-it-doesnt-collide") }) </del> <ins> func TestNodeUnprepareResources(t *testing.T) { for _, test := range []struct { description   string serverSetup   func(string) (string, tearDown, error) serverVersion string request       *drapb.NodeUnprepareResourcesRequest }{ { description:   "server supports v1alpha4", serverSetup:   setupFakeGRPCServer, serverVersion: v1alpha4Version, request:       &drapb.NodeUnprepareResourcesRequest{}, }, } { t.Run(test.description, func(t *testing.T) { tCtx := ktesting.Init(t) addr, teardown, err := setupFakeGRPCServer(test.serverVersion) if err != nil { t.Fatal(err) } defer teardown() p := &Plugin{ backgroundCtx:     tCtx, endpoint:          addr, clientCallTimeout: defaultClientCallTimeout, } conn, err := p.getOrCreateGRPCConn() defer func() { err := conn.Close() if err != nil { t.Error(err) } }() if err != nil { t.Fatal(err) } draPlugins.add("dummy-plugin", p) defer draPlugins.delete("dummy-plugin") client, err := NewDRAPluginClient("dummy-plugin") if err != nil { t.Fatal(err) } _, err = client.NodeUnprepareResources(tCtx, test.request) if err != nil { t.Fatal(err) } }) } </ins> }


} } <del> func TestNominatedNodeCleanUpUponNodeDeletion(t *testing.T) { // Initialize scheduler. testCtx := initTest(t, "preemption") defer testutils.CleanupTest(t, testCtx) cs := testCtx.ClientSet defer cleanupPodsInNamespace(cs, t, testCtx.NS.Name) // Create a node with some resources and a label. nodeRes := &v1.ResourceList{ v1.ResourcePods:   *resource.NewQuantity(32, resource.DecimalSI), v1.ResourceCPU:    *resource.NewMilliQuantity(100, resource.DecimalSI), v1.ResourceMemory: *resource.NewQuantity(100, resource.DecimalSI), } nodeNames := []string{"node1", "node2"} for _, nodeName := range nodeNames { _, err := createNode(testCtx.ClientSet, nodeName, nodeRes) if err != nil { t.Fatalf("Error creating nodes: %v", err) } } // Fill the cluster with one high-priority and one low-priority Pod. highPriPod, err := createPausePod(cs, mkPriorityPodWithGrace(testCtx, "high-pod", highPriority, 60)) if err != nil { t.Fatalf("Error creating high-priority pod: %v", err) } // Make sure the pod is scheduled. if err := testutils.WaitForPodToSchedule(cs, highPriPod); err != nil { t.Fatalf("Pod %v/%v didn't get scheduled: %v", highPriPod.Namespace, highPriPod.Name, err) } lowPriPod, err := createPausePod(cs, mkPriorityPodWithGrace(testCtx, "low-pod", lowPriority, 60)) if err != nil { t.Fatalf("Error creating low-priority pod: %v", err) } // Make sure the pod is scheduled. if err := testutils.WaitForPodToSchedule(cs, lowPriPod); err != nil { t.Fatalf("Pod %v/%v didn't get scheduled: %v", lowPriPod.Namespace, lowPriPod.Name, err) } // Create a medium-priority Pod. medPriPod, err := createPausePod(cs, mkPriorityPodWithGrace(testCtx, "med-pod", mediumPriority, 60)) if err != nil { t.Fatalf("Error creating med-priority pod: %v", err) } // Check its nominatedNodeName field is set properly. if err := waitForNominatedNodeName(cs, medPriPod); err != nil { t.Fatalf("NominatedNodeName was not set for pod %v/%v: %v", medPriPod.Namespace, medPriPod.Name, err) } // Get the live version of low and med pods. lowPriPod, _ = getPod(cs, lowPriPod.Name, lowPriPod.Namespace) medPriPod, _ = getPod(cs, medPriPod.Name, medPriPod.Namespace) want, got := lowPriPod.Spec.NodeName, medPriPod.Status.NominatedNodeName if want != got { t.Fatalf("Expect med-priority's nominatedNodeName to be %v, but got %v.", want, got) } // Delete the node where med-priority pod is nominated to. cs.CoreV1().Nodes().Delete(context.TODO(), got, metav1.DeleteOptions{}) if err := wait.Poll(200*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) { _, err := cs.CoreV1().Nodes().Get(context.TODO(), got, metav1.GetOptions{}) if apierrors.IsNotFound(err) { return true, nil } return false, err }); err != nil { t.Fatalf("Node %v cannot be deleted: %v.", got, err) } // Finally verify if med-priority pod's nominatedNodeName gets cleared. if err := wait.Poll(200*time.Millisecond, wait.ForeverTestTimeout, func() (bool, error) { pod, err := cs.CoreV1().Pods(medPriPod.Namespace).Get(context.TODO(), medPriPod.Name, metav1.GetOptions{}) if err != nil { t.Errorf("Error getting the medium priority pod info: %v", err) } if len(pod.Status.NominatedNodeName) == 0 { return true, nil } return false, err }); err != nil { t.Errorf("The nominated node name of the medium priority pod was not cleared: %v", err) } } </del> func mkMinAvailablePDB(name, namespace string, uid types.UID, minAvailable int, matchLabels map[string]string) *policy.PodDisruptionBudget { intMinAvailable := intstr.FromInt(minAvailable) return &policy.PodDisruptionBudget{


// +optional optional string imagePullPolicy = 14; <del> // Security options the pod should run with. </del> <ins> // SecurityContext defines the security options the container should be run with. // If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext. </ins> // More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ // +optional optional SecurityContext securityContext = 15;


} if (opts.Watch || forceWatch) && rw != nil { <ins> glog.Infof("Started to log from %v for %v", ctx, req.Request.URL.RequestURI()) </ins> watcher, err := rw.Watch(ctx, &opts) if err != nil { scope.err(err, res.ResponseWriter, req.Request)


trap cleanup EXIT <del> while true; do read x; done </del> <ins> while true; do sleep 1; done </ins>


in.Spec.InitContainers = values // Call defaulters explicitly until annotations are removed <del> for i := range in.Spec.InitContainers { c := &in.Spec.InitContainers[i] SetDefaults_Container(c) </del> <ins> tmpPodTemp := &PodTemplate{ Template: PodTemplateSpec{ Spec: PodSpec{ HostNetwork:    in.Spec.HostNetwork, InitContainers: values, }, }, </ins> } <ins> SetObjectDefaults_PodTemplate(tmpPodTemp) in.Spec.InitContainers = tmpPodTemp.Template.Spec.InitContainers </ins> } if err := autoConvert_v1_PodTemplateSpec_To_api_PodTemplateSpec(in, out, s); err != nil {


exit 1 fi <ins> if [ ${#errors_expect_error[@]} -ne 0 ]; then { echo "Errors:" for err in "${errors_expect_error[@]}"; do echo "$err" done echo echo 'The above files need to use framework.ExpectError(err) instead of ' echo 'Expect(err).To(HaveOccurred()) or gomega.Expect(err).To(gomega.HaveOccurred())' echo } >&2 exit 1 fi </ins> echo 'Congratulations!  All e2e test source files are valid.'


} } <del> _, err = client.CoreV1().Pods("default").Create(reinvocationMarkerFixture) if err != nil { t.Fatal(err) } </del> for i, tt := range testCases { t.Run(tt.name, func(t *testing.T) { upCh := recorder.Reset() <del> ns := fmt.Sprintf("reinvoke-%d", i) _, err = client.CoreV1().Namespaces().Create(&v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: ns}}) </del> <ins> testCaseID := strconv.Itoa(i) ns := "reinvoke-" + testCaseID nsLabels := map[string]string{"test-case": testCaseID} _, err = client.CoreV1().Namespaces().Create(&v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: ns, Labels: nsLabels}}) if err != nil { t.Fatal(err) } // Write markers to a separate namespace to avoid cross-talk markerNs := ns + "-markers" markerNsLabels := map[string]string{"test-markers": testCaseID} _, err = client.CoreV1().Namespaces().Create(&v1.Namespace{ObjectMeta: metav1.ObjectMeta{Name: markerNs, Labels: markerNsLabels}}) </ins> if err != nil { t.Fatal(err) } <ins> // Create a maker object to use to check for the webhook configurations to be ready. marker, err := client.CoreV1().Pods(markerNs).Create(newReinvocationMarkerFixture(markerNs)) if err != nil { t.Fatal(err) } fail := admissionv1beta1.Fail </ins> webhooks := []admissionv1beta1.MutatingWebhook{} for j, webhook := range tt.webhooks { <del> name := fmt.Sprintf("admission.integration.test.%d.%s", j, strings.TrimPrefix(webhook.path, "/")) fail := admissionv1beta1.Fail </del> endpoint := webhookServer.URL + webhook.path <ins> name := fmt.Sprintf("admission.integration.test.%d.%s", j, strings.TrimPrefix(webhook.path, "/")) </ins> webhooks = append(webhooks, admissionv1beta1.MutatingWebhook{ Name: name, ClientConfig: admissionv1beta1.WebhookClientConfig{


<ins> /* Copyright 2023 The Kubernetes 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 service import ( "context" "net" "time" "google.golang.org/grpc" "k8s.io/klog/v2" kmsapi "k8s.io/kms/apis/v2alpha1" ) // GRPCService is a gprc server that runs the kms v2 alpha 1 API. type GRPCService struct { addr    string timeout time.Duration server  *grpc.Server kmsService Service } var _ kmsapi.KeyManagementServiceServer = (*GRPCService)(nil) // NewGRPCService creates an instance of GRPCService. func NewGRPCService( address string, timeout time.Duration, kmsService Service, ) *GRPCService { klog.V(4).InfoS("KMS plugin configured", "address", address, "timeout", timeout) return &GRPCService{ addr:       address, timeout:    timeout, kmsService: kmsService, } } // ListenAndServe accepts incoming connections on a Unix socket. It is a blocking method. // Returns non-nil error unless Close or Shutdown is called. func (s *GRPCService) ListenAndServe() error { ln, err := net.Listen("unix", s.addr) if err != nil { return err } defer ln.Close() gs := grpc.NewServer( grpc.ConnectionTimeout(s.timeout), ) s.server = gs kmsapi.RegisterKeyManagementServiceServer(gs, s) klog.V(4).InfoS("kms plugin serving", "address", s.addr) return gs.Serve(ln) } // Shutdown performs a grafecul shutdown. Doesn't accept new connections and // blocks until all pending  RPCs are finished. func (s *GRPCService) Shutdown() { klog.V(4).InfoS("kms plugin shutdown", "address", s.addr) if s.server != nil { s.server.GracefulStop() } } // Close stops the server by closing all connections immediately and cancels // all active RPCs. func (s *GRPCService) Close() { klog.V(4).InfoS("kms plugin close", "address", s.addr) if s.server != nil { s.server.Stop() } } // Status sends a status request to specified kms service. func (s *GRPCService) Status(ctx context.Context, _ *kmsapi.StatusRequest) (*kmsapi.StatusResponse, error) { res, err := s.kmsService.Status(ctx) if err != nil { return nil, err } return &kmsapi.StatusResponse{ Version: res.Version, Healthz: res.Healthz, KeyId:   res.KeyID, }, nil } // Decrypt sends a decryption request to specified kms service. func (s *GRPCService) Decrypt(ctx context.Context, req *kmsapi.DecryptRequest) (*kmsapi.DecryptResponse, error) { klog.V(4).InfoS("decrypt request received", "id", req.Uid) plaintext, err := s.kmsService.Decrypt(ctx, req.Uid, &DecryptRequest{ Ciphertext:  req.Ciphertext, KeyID:       req.KeyId, Annotations: req.Annotations, }) if err != nil { return nil, err } return &kmsapi.DecryptResponse{ Plaintext: plaintext, }, nil } // Encrypt sends an encryption request to specified kms service. func (s *GRPCService) Encrypt(ctx context.Context, req *kmsapi.EncryptRequest) (*kmsapi.EncryptResponse, error) { klog.V(4).InfoS("encrypt request received", "id", req.Uid) encRes, err := s.kmsService.Encrypt(ctx, req.Uid, req.Plaintext) if err != nil { return nil, err } return &kmsapi.EncryptResponse{ Ciphertext:  encRes.Ciphertext, KeyId:       encRes.KeyID, Annotations: encRes.Annotations, }, nil } </ins>


set -o pipefail set -o xtrace <ins> retry() { for i in {1..5}; do "$@" && return 0 || sleep $i done "$@" } </ins> # Runs the unit and integration tests, producing JUnit-style XML test # reports in ${WORKSPACE}/artifacts. This script is intended to be run from # kubekins-test container with a kubernetes repo mapped in. See


q := NewPriorityQueue(nil) q.Add(&medPriorityPod) // Add a couple of pods to the unschedulableQ. <del> q.unschedulableQ.addOrUpdate(&unschedulablePod) q.unschedulableQ.addOrUpdate(affinityPod) </del> <ins> addOrUpdateUnschedulablePod(q, &unschedulablePod) addOrUpdateUnschedulablePod(q, affinityPod) </ins> // Simulate addition of an assigned pod. The pod has matching labels for // affinityPod. So, affinityPod should go to activeQ. q.AssignedPodAdded(&labelPod) <del> if q.unschedulableQ.get(affinityPod) != nil { </del> <ins> if getUnschedulablePod(q, affinityPod) != nil { </ins> t.Error("affinityPod is still in the unschedulableQ.") } if _, exists, _ := q.activeQ.Get(affinityPod); !exists { t.Error("affinityPod is not moved to activeQ.") } // Check that the other pod is still in the unschedulableQ. <del> if q.unschedulableQ.get(&unschedulablePod) == nil { </del> <ins> if getUnschedulablePod(q, &unschedulablePod) == nil { </ins> t.Error("unschedulablePod is not in the unschedulableQ.") } }


defer ws.Close() buf := &bytes.Buffer{} <del> for { var msg []byte if err := websocket.Message.Receive(ws, &msg); err != nil { if err == io.EOF { break </del> <ins> Eventually(func() error { for { var msg []byte if err := websocket.Message.Receive(ws, &msg); err != nil { if err == io.EOF { break } framework.Failf("Failed to read completely from websocket %s: %v", url.String(), err) </ins> } <del> framework.Failf("Failed to read completely from websocket %s: %v", url.String(), err) </del> <ins> if len(msg) == 0 { continue } if msg[0] != 1 { framework.Failf("Got message from server that didn't start with channel 1 (STDOUT): %v", msg) } buf.Write(msg[1:]) </ins> } <del> if len(msg) == 0 { continue </del> <ins> if buf.Len() == 0 { return fmt.Errorf("Unexpected output from server") </ins> } <del> if msg[0] != 1 { framework.Failf("Got message from server that didn't start with channel 1 (STDOUT): %v", msg) </del> <ins> if !strings.Contains(buf.String(), "nameserver") { return fmt.Errorf("Expected to find 'nameserver' in %q", buf.String()) </ins> } <del> buf.Write(msg[1:]) } if buf.Len() == 0 { framework.Failf("Unexpected output from server") } if !strings.Contains(buf.String(), "nameserver") { framework.Failf("Expected to find 'nameserver' in %q", buf.String()) } </del> <ins> return nil }, time.Minute, 10*time.Second).Should(BeNil()) </ins> }) It("should support retrieving logs from the container over websockets", func() {


FindBoundSatsified:   false, }, eventReason: "FailedScheduling", <del> expectError: makePredicateError("1 VolumeNodeAffinityConflict"), </del> <ins> expectError: makePredicateError("1 node(s) had volume node affinity conflict"), </ins> }, "unbound,no-matches": { volumeBinderConfig: &persistentvolume.FakeVolumeBinderConfig{


ginkgo.By(fmt.Sprintf("SSH'ing to %d nodes and running %s", len(testhosts), testCase.cmd)) for _, host := range testhosts { <ins> ginkgo.By(fmt.Sprintf("SSH'ing host %s", host)) </ins> result, err := e2essh.SSH(testCase.cmd, host, framework.TestContext.Provider) stdout, stderr := strings.TrimSpace(result.Stdout), strings.TrimSpace(result.Stderr) if err != testCase.expectedError {


<del> apiVersion: extensions/v1beta1 </del> <ins> apiVersion: networking.k8s.io/v1beta1 </ins> kind: Ingress metadata: name: pre-shared-cert


import ( "fmt" <ins> "strings" </ins> "testing" )


ginkgo.Context("when gracefully shutting down with Pod priority", func() { const ( <del> pollInterval           = 1 * time.Second podStatusUpdateTimeout = 10 * time.Second </del> <ins> pollInterval                 = 1 * time.Second podStatusUpdateTimeout       = 10 * time.Second priorityClassesCreateTimeout = 10 * time.Second </ins> ) var (


// for the iSCSI connection. dirs2, err := io.ReadDir(sessionPath) if err != nil { <del> return nil, err </del> <ins> klog.Infof("Failed to process session %s, assuming this session is unavailable: %s", sessionName, err) continue </ins> } for _, dir2 := range dirs2 { // Skip over files that aren't the connection


return nil } <ins> // hasServedCRDVersion returns true if the given version is in the list of CRD's versions and the Served flag is set. func hasServedCRDVersion(spec *apiextensions.CustomResourceDefinitionSpec, version string) bool { for _, v := range spec.Versions { if v.Name == version { return v.Served } } return false } </ins>


"time" utilnet "k8s.io/apimachinery/pkg/util/net" <ins> utilrand "k8s.io/apimachinery/pkg/util/rand" </ins> "k8s.io/client-go/tools/cache"


// MinionList is a list of minions. type MinionList struct { JSONBase `json:",inline" yaml:",inline"` <del> Items    []Minion `json:"minions,omitempty" yaml:"minions,omitempty"` </del> <ins> Items    []Minion `json:"items,omitempty" yaml:"items,omitempty"` </ins> } // Binding is written by a scheduler to cause a pod to be bound to a host.


} func IsMirrorPod(pod *api.Pod) bool { <del> if value, ok := pod.Annotations[kubetypes.ConfigMirrorAnnotationKey]; !ok { return false } else { return value == kubetypes.MirrorType } </del> <ins> _, ok := pod.Annotations[kubetypes.ConfigMirrorAnnotationKey] return ok } func getHashFromMirrorPod(pod *api.Pod) (string, bool) { hash, ok := pod.Annotations[kubetypes.ConfigMirrorAnnotationKey] return hash, ok } func getPodHash(pod *api.Pod) string { // The annotation exists for all static pods. return pod.Annotations[kubetypes.ConfigHashAnnotationKey] </ins> }


tester(unconfined) }) <del> By("Running a CAP_SYS_ADMIN pod", func() { </del> <ins> By("Running a SYS_ADMIN pod", func() { </ins> sysadmin := restrictedPod(f, "sysadmin") sysadmin.Spec.Containers[0].SecurityContext.Capabilities = &v1.Capabilities{ <del> Add: []v1.Capability{"CAP_SYS_ADMIN"}, </del> <ins> Add: []v1.Capability{"SYS_ADMIN"}, </ins> } sysadmin.Spec.Containers[0].SecurityContext.AllowPrivilegeEscalation = nil tester(sysadmin)


// General settings. fs.StringVar(&s.ContainerRuntime, "container-runtime", s.ContainerRuntime, "The container runtime to use. Possible values: 'docker', 'remote'.") fs.StringVar(&s.RuntimeCgroups, "runtime-cgroups", s.RuntimeCgroups, "Optional absolute name of cgroups to create and run the runtime in.") <del> _ = fs.Bool("redirect-container-streaming", false, "[REMOVED]") // TODO: Delete in v1.22 fs.MarkDeprecated("redirect-container-streaming", "Container streaming redirection has been removed from the kubelet as of v1.20, and this flag will be removed in v1.22. For more details, see http://git.k8s.io/enhancements/keps/sig-node/20191205-container-streaming-requests.md") </del> // Docker-specific settings. fs.StringVar(&s.DockershimRootDirectory, "experimental-dockershim-root-directory", s.DockershimRootDirectory, "Path to the dockershim root directory.")


concurrencyLimit:            6, evalDuration:                time.Second * 20, expectedFair:                []bool{true}, <del> expectedFairnessMargin:      []float64{0.15}, </del> <ins> expectedFairnessMargin:      []float64{0.155}, </ins> expectAllRequests:           true, evalInqueueMetrics:          true, evalExecutingMetrics:        true,


return hist.GetSampleSum() / float64(hist.GetSampleCount()) } <del> // Clear clears all fields of the wrapped histogram func (hist *Histogram) Clear() { if hist.SampleCount != nil { *hist.SampleCount = 0 } if hist.SampleSum != nil { *hist.SampleSum = 0 } for _, b := range hist.Bucket { if b.CumulativeCount != nil { *b.CumulativeCount = 0 } } } </del> // Validate makes sure the wrapped histogram has all necessary fields set and with valid values. func (hist *Histogram) Validate() error { if hist.SampleCount == nil || hist.GetSampleCount() == 0 {


<ins> /* Copyright 2019 The Kubernetes 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 runtime import ( "testing" "k8s.io/apimachinery/pkg/runtime/schema" ) func gv(group, version string) schema.GroupVersion { return schema.GroupVersion{Group: group, Version: version} } func gvk(group, version, kind string) schema.GroupVersionKind { return schema.GroupVersionKind{Group: group, Version: version, Kind: kind} } func gk(group, kind string) schema.GroupKind { return schema.GroupKind{Group: group, Kind: kind} } func TestCoercingMultiGroupVersioner(t *testing.T) { testcases := []struct { name           string target         schema.GroupVersion preferredKinds []schema.GroupKind kinds          []schema.GroupVersionKind expectKind     schema.GroupVersionKind }{ { name:           "matched preferred group/kind", target:         gv("mygroup", "__internal"), preferredKinds: []schema.GroupKind{gk("mygroup", "Foo"), gk("anothergroup", "Bar")}, kinds:          []schema.GroupVersionKind{gvk("yetanother", "v1", "Baz"), gvk("anothergroup", "v1", "Bar")}, expectKind:     gvk("mygroup", "__internal", "Bar"), }, { name:           "matched preferred group", target:         gv("mygroup", "__internal"), preferredKinds: []schema.GroupKind{gk("mygroup", ""), gk("anothergroup", "")}, kinds:          []schema.GroupVersionKind{gvk("yetanother", "v1", "Baz"), gvk("anothergroup", "v1", "Bar")}, expectKind:     gvk("mygroup", "__internal", "Bar"), }, { name:           "no preferred group/kind match, uses first kind in list", target:         gv("mygroup", "__internal"), preferredKinds: []schema.GroupKind{gk("mygroup", ""), gk("anothergroup", "")}, kinds:          []schema.GroupVersionKind{gvk("yetanother", "v1", "Baz"), gvk("yetanother", "v1", "Bar")}, expectKind:     gvk("mygroup", "__internal", "Baz"), }, } for _, tc := range testcases { t.Run(tc.name, func(t *testing.T) { v := NewCoercingMultiGroupVersioner(tc.target, tc.preferredKinds...) kind, ok := v.KindForGroupVersionKinds(tc.kinds) if !ok { t.Error("got no kind") } if kind != tc.expectKind { t.Errorf("expected %#v, got %#v", tc.expectKind, kind) } }) } } </ins>


<del> v1.8.3-3 </del> <ins> v1.9.1-1 </ins>


configs[CheckMetadataConcealment] = Config{e2eRegistry, "metadata-concealment", "1.2"} configs[CudaVectorAdd] = Config{e2eRegistry, "cuda-vector-add", "1.0"} configs[CudaVectorAdd2] = Config{e2eRegistry, "cuda-vector-add", "2.0"} <del> configs[DebianIptables] = Config{buildImageRegistry, "debian-iptables", "buster-v1.4.0"} </del> <ins> configs[DebianIptables] = Config{buildImageRegistry, "debian-iptables", "buster-v1.5.0"} </ins> configs[EchoServer] = Config{e2eRegistry, "echoserver", "2.2"} configs[Etcd] = Config{gcRegistry, "etcd", "3.4.13-0"} configs[GlusterDynamicProvisioner] = Config{dockerGluster, "glusterdynamic-provisioner", "v1.0"}


}, }, }, <ins> { name: "node port service with protocol sctp on a node with multiple nodeIPs", services: []*v1.Service{ makeTestService("ns1", "svc1", func(svc *v1.Service) { svc.Spec.Type = "NodePort" svc.Spec.ClusterIP = "10.20.30.41" svc.Spec.Ports = []v1.ServicePort{{ Name:     "p80", Port:     int32(80), Protocol: v1.ProtocolSCTP, NodePort: int32(3001), }} }), }, endpoints: []*v1.Endpoints{ makeTestEndpoints("ns1", "svc1", func(ept *v1.Endpoints) { ept.Subsets = []v1.EndpointSubset{{ Addresses: []v1.EndpointAddress{{ IP: "10.180.0.1", }}, Ports: []v1.EndpointPort{{ Name: "p80", Port: int32(80), }}, }} }), }, nodeIPs: []net.IP{ net.ParseIP("100.101.102.103"), net.ParseIP("100.101.102.104"), net.ParseIP("100.101.102.105"), net.ParseIP("2001:db8::1:1"), net.ParseIP("2001:db8::1:2"), net.ParseIP("2001:db8::1:3"), }, nodePortAddresses: []string{}, expectedIPVS: &ipvstest.FakeIPVS{ Services: map[ipvstest.ServiceKey]*utilipvs.VirtualServer{ { IP:       "10.20.30.41", Port:     80, Protocol: "SCTP", }: { Address:   net.ParseIP("10.20.30.41"), Protocol:  "SCTP", Port:      uint16(80), Scheduler: "rr", }, { IP:       "100.101.102.103", Port:     3001, Protocol: "SCTP", }: { Address:   net.ParseIP("100.101.102.103"), Protocol:  "SCTP", Port:      uint16(3001), Scheduler: "rr", }, { IP:       "100.101.102.104", Port:     3001, Protocol: "SCTP", }: { Address:   net.ParseIP("100.101.102.104"), Protocol:  "SCTP", Port:      uint16(3001), Scheduler: "rr", }, { IP:       "100.101.102.105", Port:     3001, Protocol: "SCTP", }: { Address:   net.ParseIP("100.101.102.105"), Protocol:  "SCTP", Port:      uint16(3001), Scheduler: "rr", }, { IP:       "2001:db8::1:1", Port:     3001, Protocol: "SCTP", }: { Address:   net.ParseIP("2001:db8::1:1"), Protocol:  "SCTP", Port:      uint16(3001), Scheduler: "rr", }, { IP:       "2001:db8::1:2", Port:     3001, Protocol: "SCTP", }: { Address:   net.ParseIP("2001:db8::1:2"), Protocol:  "SCTP", Port:      uint16(3001), Scheduler: "rr", }, { IP:       "2001:db8::1:3", Port:     3001, Protocol: "SCTP", }: { Address:   net.ParseIP("2001:db8::1:3"), Protocol:  "SCTP", Port:      uint16(3001), Scheduler: "rr", }, }, Destinations: map[ipvstest.ServiceKey][]*utilipvs.RealServer{ { IP:       "10.20.30.41", Port:     80, Protocol: "SCTP", }: { { Address: net.ParseIP("10.180.0.1"), Port:    uint16(80), Weight:  1, }, }, { IP:       "100.101.102.103", Port:     3001, Protocol: "SCTP", }: { { Address: net.ParseIP("10.180.0.1"), Port:    uint16(80), Weight:  1, }, }, { IP:       "100.101.102.104", Port:     3001, Protocol: "SCTP", }: { { Address: net.ParseIP("10.180.0.1"), Port:    uint16(80), Weight:  1, }, }, { IP:       "100.101.102.105", Port:     3001, Protocol: "SCTP", }: { { Address: net.ParseIP("10.180.0.1"), Port:    uint16(80), Weight:  1, }, }, { IP:       "2001:db8::1:1", Port:     3001, Protocol: "SCTP", }: { { Address: net.ParseIP("10.180.0.1"), Port:    uint16(80), Weight:  1, }, }, { IP:       "2001:db8::1:2", Port:     3001, Protocol: "SCTP", }: { { Address: net.ParseIP("10.180.0.1"), Port:    uint16(80), Weight:  1, }, }, { IP:       "2001:db8::1:3", Port:     3001, Protocol: "SCTP", }: { { Address: net.ParseIP("10.180.0.1"), Port:    uint16(80), Weight:  1, }, }, }, }, expectedIPSets: netlinktest.ExpectedIPSet{ kubeNodePortSetSCTP: { { IP:       "100.101.102.103", Port:     3001, Protocol: strings.ToLower(string(v1.ProtocolSCTP)), SetType:  utilipset.HashIPPort, }, { IP:       "100.101.102.104", Port:     3001, Protocol: strings.ToLower(string(v1.ProtocolSCTP)), SetType:  utilipset.HashIPPort, }, { IP:       "100.101.102.105", Port:     3001, Protocol: strings.ToLower(string(v1.ProtocolSCTP)), SetType:  utilipset.HashIPPort, }, { IP:       "2001:db8::1:1", Port:     3001, Protocol: strings.ToLower(string(v1.ProtocolSCTP)), SetType:  utilipset.HashIPPort, }, { IP:       "2001:db8::1:2", Port:     3001, Protocol: strings.ToLower(string(v1.ProtocolSCTP)), SetType:  utilipset.HashIPPort, }, { IP:       "2001:db8::1:3", Port:     3001, Protocol: strings.ToLower(string(v1.ProtocolSCTP)), SetType:  utilipset.HashIPPort, }, }, }, }, </ins> } for _, test := range tests {


// The application protocol for this port. // This field follows standard Kubernetes label syntax. // Un-prefixed names are reserved for IANA standard service names (as per <del> // RFC-6335 and http://www.iana.org/assignments/service-names). </del> <ins> // RFC-6335 and https://www.iana.org/assignments/service-names). </ins> // Non-standard protocols should use prefixed names such as // mycompany.com/my-custom-protocol. // +optional


&unversioned.APIGroup{}, &unversioned.APIResourceList{}, ) <ins> addDeepCopyFuncs(scheme) addDefaultingFuncs(scheme) addConversionFuncs(scheme) </ins> }


for format := range columnsFormats { formats = append(formats, format) } <ins> sort.Strings(formats) </ins> return formats }


// compute the context. Mutation is allowed. ValidatedPSPAnnotation is not taken into account. allowedPod, pspName, validationErrs, err := p.computeSecurityContext(ctx, a, pod, true, "") if err != nil { <del> return admission.NewForbidden(a, err) </del> <ins> return admission.NewForbidden(a, fmt.Errorf("PodSecurityPolicy: %w", err)) </ins> } if allowedPod != nil { *pod = *allowedPod


"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/managedfields" "k8s.io/apimachinery/pkg/watch" <del> "k8s.io/kube-openapi/pkg/validation/spec" </del> "k8s.io/utils/ptr" )


ginkgo.By("Ensuring resource quota status captures configMap creation") usedResources = v1.ResourceList{} usedResources[v1.ResourceQuotas] = resource.MustParse(strconv.Itoa(c + 1)) <del> // we expect there to be two configmaps because each namespace will receive // a ca.crt configmap by default. // ref:https://github.com/kubernetes/kubernetes/pull/68812 </del> usedResources[v1.ResourceConfigMaps] = resource.MustParse(hardConfigMaps) err = waitForResourceQuota(f.ClientSet, f.Namespace.Name, quotaName, usedResources) framework.ExpectNoError(err)


containerTopologyScope = "container" // podTopologyScope specifies the TopologyManagerScope per pod. podTopologyScope = "pod" <ins> // noneTopologyScope specifies the TopologyManagerScope when topologyPolicyName is none. noneTopologyScope = "none" </ins> ) type podTopologyHints map[string]map[string]TopologyHint


return } for _, pod := range podList.Items { <del> framework.Logf("Kubectl output:n%v", framework.RunKubectlOrDie("log", pod.Name, "--namespace=kube-system")) </del> <ins> framework.Logf("Kubectl output:n%v", framework.RunKubectlOrDie("log", pod.Name, "--namespace=kube-system", "--container=heapster")) </ins> } }


By(fmt.Sprintf("Initial restart count of pod %s is %d", podDescr.Name, initialRestartCount)) // Wait for at most 48 * 5 = 240s = 4 minutes until restartCount is incremented <del> pass := false </del> <ins> restarts := false </ins> for i := 0; i < 48; i++ { // Wait until restartCount is incremented. time.Sleep(5 * time.Second)


old_storage_version=${test_data[4]} kube::log::status "Verifying ${resource}/${namespace}/${name} has storage version ${old_storage_version} in etcd" <del> curl -s http://${ETCD_HOST}:${ETCD_PORT}/v2/keys/registry/${resource}/${namespace}/${name} | grep ${old_storage_version} </del> <ins> curl -s http://${ETCD_HOST}:${ETCD_PORT}/v2/keys/${ETCD_PREFIX}/${resource}/${namespace}/${name} | grep ${old_storage_version} </ins> done killApiServer


func (runner *runner) connectToFirewallD() { bus, err := runner.dbus.SystemBus() if err != nil { <del> glog.V(1).Info("Could not connect to D-Bus system bus: %s", err) </del> <ins> glog.V(1).Infof("Could not connect to D-Bus system bus: %s", err) </ins> return }


} // validateValueValidation checks the value validation in a structural schema. <del> func validateValueValidation(v *ValueValidation, skipAnyOf, skipFirstAllOfAnyOf bool, fldPath *field.Path) field.ErrorList { </del> <ins> func validateValueValidation(v *ValueValidation, skipAnyOf, skipFirstAllOfAnyOf bool, lvl level, fldPath *field.Path) field.ErrorList { </ins> if v == nil { return nil }


WaitForCacheSync: func() bool { return cache.WaitForCacheSync(c.StopEverything, c.scheduledPodsHasSynced) }, <del> NextPod: func() *v1.Pod { return c.getNextPod() }, </del> <ins> NextPod:         internalqueue.MakeNextPodFunc(c.podQueue), </ins> Error:           c.MakeDefaultErrorFunc(podBackoff, c.podQueue), StopEverything:  c.StopEverything, VolumeBinder:    c.volumeBinder,


} function dump_nodes() { <del> local node_names </del> <ins> local node_names=() </ins> if [[ -n "${1:-}" ]]; then echo "Dumping logs for nodes provided as args to dump_nodes() function" node_names=( "$@" )


package v1_test import ( <del> "encoding/json" </del> <ins> "fmt" </ins> "reflect" "testing"


configs[NginxNew] = Config{list.PromoterE2eRegistry, "nginx", "1.15-2"} configs[NodePerfNpbEp] = Config{list.PromoterE2eRegistry, "node-perf/npb-ep", "1.2"} configs[NodePerfNpbIs] = Config{list.PromoterE2eRegistry, "node-perf/npb-is", "1.2"} <del> configs[NodePerfTfWideDeep] = Config{list.PromoterE2eRegistry, "node-perf/tf-wide-deep", "1.2"} </del> <ins> configs[NodePerfTfWideDeep] = Config{list.PromoterE2eRegistry, "node-perf/tf-wide-deep", "1.3"} </ins> configs[Nonewprivs] = Config{list.PromoterE2eRegistry, "nonewprivs", "1.3"} configs[NonRoot] = Config{list.PromoterE2eRegistry, "nonroot", "1.2"} // Pause - when these values are updated, also update cmd/kubelet/app/options/container_runtime.go


} if inline := cmdutil.GetFlagString(cmd, "overrides"); len(inline) > 0 { <del> object, err = cmdutil.Merge(scheme.Codecs.LegacyCodec(scheme.Scheme.PrioritizedVersionsAllGroups()...), object, inline) </del> <ins> codec := runtime.NewCodec(scheme.DefaultJSONEncoder(), scheme.Codecs.UniversalDecoder(scheme.Scheme.PrioritizedVersionsAllGroups()...)) object, err = cmdutil.Merge(codec, object, inline) </ins> if err != nil { return err }


"strings" "time" <ins> "encoding/json" </ins> appsv1 "k8s.io/api/apps/v1" "k8s.io/api/core/v1" storage "k8s.io/api/storage/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" <ins> "k8s.io/apimachinery/pkg/types" </ins> "k8s.io/apimachinery/pkg/util/sets" <ins> "k8s.io/apimachinery/pkg/util/strategicpatch" "k8s.io/apimachinery/pkg/util/wait" </ins> clientset "k8s.io/client-go/kubernetes" podutil "k8s.io/kubernetes/pkg/api/v1/pod" "k8s.io/kubernetes/pkg/kubelet/apis" kubeletapis "k8s.io/kubernetes/pkg/kubelet/apis" "k8s.io/kubernetes/pkg/volume/util" "k8s.io/kubernetes/test/e2e/framework" <del> "k8s.io/kubernetes/test/e2e/framework/providers/gce" </del> "k8s.io/kubernetes/test/e2e/storage/testsuites" "k8s.io/kubernetes/test/e2e/storage/utils" imageutils "k8s.io/kubernetes/test/utils/image"


return c.restConfig, nil } <ins> func (c *fakeAuthenticationInfoResolver) ClientConfigForService(serviceName, serviceNamespace string) (*rest.Config, error) { atomic.AddInt32(c.cachedCount, 1) return c.restConfig, nil } </ins> func newMatchEverythingRules() []registrationv1beta1.RuleWithOperations { return []registrationv1beta1.RuleWithOperations{{ Operations: []registrationv1beta1.OperationType{registrationv1beta1.OperationAll},


// Create a security group for the load balancer sgName := "k8s-elb-" + loadBalancerName sgDescription := fmt.Sprintf("Security group for Kubernetes ELB %s (%v)", loadBalancerName, serviceName) <del> securityGroupID, err = c.ensureSecurityGroup(sgName, sgDescription) </del> <ins> securityGroupID, err = c.ensureSecurityGroup(sgName, sgDescription, getLoadBalancerAdditionalTags(annotations)) </ins> if err != nil { glog.Errorf("Error creating load balancer security group: %q", err) return nil, err


// NewKubeRegistry creates a new vanilla Registry without any Collectors // pre-registered. func NewKubeRegistry() KubeRegistry { <del> r := newKubeRegistry(version.Get()) </del> <ins> r := newKubeRegistry(BuildVersion()) </ins> return r }


// Returns true if and only if changes were made // The security group must already exist func (c *Cloud) setSecurityGroupIngress(securityGroupID string, permissions IPPermissionSet) (bool, error) { <ins> // We do not want to make changes to the Global defined SG if securityGroupID == c.cfg.Global.ElbSecurityGroup { return false, nil } </ins> group, err := c.findSecurityGroup(securityGroupID) if err != nil { glog.Warningf("Error retrieving security group %q", err)


// Next, we compare the current list of endpoints with the list of master IP keys formatCorrect, ipCorrect, portsCorrect := checkEndpointSubsetFormatWithLease(e, masterIPs, endpointPorts, reconcilePorts) if formatCorrect && ipCorrect && portsCorrect { <del> return nil </del> <ins> return r.epAdapter.EnsureEndpointSliceFromEndpoints(corev1.NamespaceDefault, e) </ins> } if !formatCorrect {


local stack_skip="${3:-0}" stack_skip=$((stack_skip + 1)) <del> # Always print the error message, regardless of KUBE_VERBOSE value kube::log::error "${message}" # Additional debug information printed if KUBE_VERBOSE is 4 or greater </del> if [[ ${KUBE_VERBOSE} -ge 4 ]]; then local source_file=${BASH_SOURCE[${stack_skip}]} local source_line=${BASH_LINENO[$((stack_skip - 1))]}


if err != nil { return nil, err } <ins> // Fall back to ARM API if the address is empty string. // TODO: this is a workaround because IMDS is not stable enough. // It should be removed after IMDS fixing the issue. if strings.TrimSpace(ipAddress.PrivateIP) == "" { return addressGetter(name) } // Use ip address got from instance metadata. </ins> addresses := []v1.NodeAddress{ {Type: v1.NodeInternalIP, Address: ipAddress.PrivateIP}, {Type: v1.NodeHostName, Address: string(name)},


// ValidateServiceStatusUpdate tests if required fields in the Service are set when updating status. func ValidateServiceStatusUpdate(service, oldService *core.Service) field.ErrorList { allErrs := ValidateObjectMetaUpdate(&service.ObjectMeta, &oldService.ObjectMeta, field.NewPath("metadata")) <del> allErrs = append(allErrs, ValidateLoadBalancerStatus(&service.Status.LoadBalancer, field.NewPath("status", "loadBalancer"))...) </del> <ins> allErrs = append(allErrs, ValidateLoadBalancerStatus(&service.Status.LoadBalancer, field.NewPath("status", "loadBalancer"), &service.Spec)...) </ins> return allErrs }


testKubelet := newTestKubelet(t) kl := testKubelet.kubelet kl.nodeLister = testNodeLister{nodes: []api.Node{ <del> {ObjectMeta: api.ObjectMeta{Name: "testnode", Labels: map[string]string{"key": "B"}}}, </del> <ins> {ObjectMeta: api.ObjectMeta{Name: testKubeletHostname, Labels: map[string]string{"key": "B"}}}, </ins> }} testKubelet.fakeCadvisor.On("MachineInfo").Return(&cadvisorApi.MachineInfo{}, nil) testKubelet.fakeCadvisor.On("DockerImagesFsInfo").Return(cadvisorApiv2.FsInfo{}, nil)


} } <ins> func TestMinionRESTWithHealthCheck(t *testing.T) { minionRegistry := registrytest.NewMinionRegistry([]string{}, api.NodeResources{}) minionHealthRegistry := HealthyRegistry{ delegate: minionRegistry, client:   &notMinion{minion: "m1"}, } ms := NewREST(&minionHealthRegistry) ctx := api.NewContext() c, err := ms.Create(ctx, &api.Minion{ObjectMeta: api.ObjectMeta{Name: "m1"}}) if err != nil { t.Errorf("insert failed") } result := <-c if m, ok := result.Object.(*api.Minion); !ok || m.Name != "m1" { t.Errorf("insert return value was weird: %#v", result) } if _, err := ms.Get(ctx, "m1"); err == nil { t.Errorf("node is unhealthy, expect no result from apiserver") } } </ins> func contains(nodes *api.MinionList, nodeID string) bool { for _, node := range nodes.Items { if node.Name == nodeID {


defer backendServer.Close() defer func() { <del> if called != tc.ExpectCalled { </del> <ins> if called := atomic.LoadInt32(&timesCalled) > 0; called != tc.ExpectCalled { </ins> t.Errorf("%s: expected called=%v, got %v", tcName, tc.ExpectCalled, called) } }()


#     sleep 4 #     i=$[$i+1] #   done <del> apiVersion: v1beta1 </del> <ins> apiVersion: v1beta3 </ins> kind: Pod <del> id: synthetic-logger-10lps-pod desiredState: manifest: version: v1beta1 id: synth-logger-10lps containers: - name: synth-lgr image: ubuntu:14.04 command: ["bash", "-c", "i="0"; while true; do echo -n "`hostname`: $i: "; date --rfc-3339 ns; sleep 0.1; i=$[$i+1]; done"] labels: name: synth-logging-source </del> <ins> metadata: creationTimestamp: null labels: name: synth-logging-source name: synthetic-logger-10lps-pod spec: containers: - args: - bash - -c - 'i="0"; while true; do echo -n "`hostname`: $i: "; date --rfc-3339 ns; sleep 0.1; i=$[$i+1]; done' image: ubuntu:14.04 name: synth-lgr </ins>


return err } <del> // GetDiskLun finds the lun on the host that the vhd is attached to, given a vhd's diskName and diskURI func (ss *scaleSet) GetDiskLun(diskName, diskURI string, nodeName types.NodeName) (int32, error) { </del> <ins> // GetDataDisks gets a list of data disks attached to the node. func (ss *scaleSet) GetDataDisks(nodeName types.NodeName) ([]compute.DataDisk, error) { </ins> _, _, vm, err := ss.getVmssVM(string(nodeName)) if err != nil { <del> return -1, err </del> <ins> return nil, err </ins> } <del> disks := *vm.StorageProfile.DataDisks for _, disk := range disks { if disk.Lun != nil && (disk.Name != nil && diskName != "" && *disk.Name == diskName) || (disk.Vhd != nil && disk.Vhd.URI != nil && diskURI != "" && *disk.Vhd.URI == diskURI) || (disk.ManagedDisk != nil && *disk.ManagedDisk.ID == diskURI) { // found the disk glog.V(4).Infof("azureDisk - find disk: lun %d name %q uri %q", *disk.Lun, diskName, diskURI) return *disk.Lun, nil } } return -1, fmt.Errorf("Cannot find Lun for disk %s", diskName) } // GetNextDiskLun searches all vhd attachment on the host and find unused lun // return -1 if all luns are used func (ss *scaleSet) GetNextDiskLun(nodeName types.NodeName) (int32, error) { _, _, vm, err := ss.getVmssVM(string(nodeName)) if err != nil { return -1, err } used := make([]bool, maxLUN) disks := *vm.StorageProfile.DataDisks for _, disk := range disks { if disk.Lun != nil { used[*disk.Lun] = true } } for k, v := range used { if !v { return int32(k), nil } } return -1, fmt.Errorf("All Luns are used") } // DisksAreAttached checks if a list of volumes are attached to the node with the specified NodeName func (ss *scaleSet) DisksAreAttached(diskNames []string, nodeName types.NodeName) (map[string]bool, error) { attached := make(map[string]bool) for _, diskName := range diskNames { attached[diskName] = false } _, _, vm, err := ss.getVmssVM(string(nodeName)) if err != nil { if err == cloudprovider.InstanceNotFound { // if host doesn't exist, no need to detach glog.Warningf("azureDisk - Cannot find node %q, DisksAreAttached will assume disks %v are not attached to it.", nodeName, diskNames) return attached, nil } return attached, err } disks := *vm.StorageProfile.DataDisks for _, disk := range disks { for _, diskName := range diskNames { if disk.Name != nil && diskName != "" && *disk.Name == diskName { attached[diskName] = true } } </del> <ins> if vm.StorageProfile.DataDisks == nil { return nil, nil </ins> } <del> return attached, nil </del> <ins> return *vm.StorageProfile.DataDisks, nil </ins> }


if err != nil { return err } <ins> if len(rsrc.Versions) == 0 { return fmt.Errorf("ThirdPartyResource %s has no defined versions", rsrc.Name) } </ins> plural, _ := meta.KindToResource(unversioned.GroupVersionKind{ Group:   group, Version: rsrc.Versions[0].Name,


return unmountedVolumes } <ins> func (asw *actualStateOfWorld) SyncReconstructedVolume(volumeName v1.UniqueVolumeName, podName volumetypes.UniquePodName, outerVolumeSpecName string) { asw.Lock() defer asw.Unlock() if volumeObj, volumeExists := asw.attachedVolumes[volumeName]; volumeExists { if podObj, podExists := volumeObj.mountedPods[podName]; podExists { if podObj.outerVolumeSpecName != outerVolumeSpecName { podObj.outerVolumeSpecName = outerVolumeSpecName asw.attachedVolumes[volumeName].mountedPods[podName] = podObj } } } } </ins> func (asw *actualStateOfWorld) newAttachedVolume( attachedVolume *attachedVolume) AttachedVolume { return AttachedVolume{


// DetachDisk detaches the disk specified by vmDiskPath func (vm *VirtualMachine) DetachDisk(ctx context.Context, vmDiskPath string) error { <del> vmDiskPath = RemoveStorageClusterORFolderNameFromVDiskPath(vmDiskPath) </del> device, err := vm.getVirtualDeviceByPath(ctx, vmDiskPath) if err != nil { klog.Errorf("Disk ID not found for VM: %q with diskPath: %q", vm.InventoryPath, vmDiskPath)


// satisfy the pod topology spread constraints. Hence it needs to preempt another low pod // to make the Pods spread like [<high>, <medium, low>]. runPausePod(f, mediumPodCfg) <del> e2epod.WaitForPodNotPending(cs, ns, mediumPodCfg.Name) </del> ginkgo.By("Verify there are 3 Pods left in this namespace") wantPods := sets.NewString("high", "medium", "low") <del> podList, err := cs.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{}) pods := podList.Items </del> <ins> var pods []v1.Pod // Wait until the number of pods stabilizes. Note that `medium` pod can get scheduled once the // second low priority pod is marked as terminating. // TODO: exact the wait.PollImmediate block to framework.WaitForNumberOfRunningPods. err := wait.PollImmediate(framework.Poll, framework.PollShortTimeout, func() (bool, error) { podList, err := cs.CoreV1().Pods(ns).List(context.TODO(), metav1.ListOptions{}) // ignore intermittent network error if err != nil { return false, nil } pods = podList.Items return len(pods) == 3, nil }) </ins> framework.ExpectNoError(err) <del> framework.ExpectEqual(len(pods), 3) </del> for _, pod := range pods { // Remove the ordinal index for low pod.


// applyPlatformSpecificDockerConfig applies platform-specific configurations to a dockertypes.ContainerCreateConfig struct. // The containerCleanupInfo struct it returns will be passed as is to performPlatformSpecificContainerCleanup <del> // after either: //   * the container creation has failed //   * the container has been successfully started //   * the container has been removed // whichever happens first. </del> <ins> // after either the container creation has failed or the container has been removed. </ins> func (ds *dockerService) applyPlatformSpecificDockerConfig(request *runtimeapi.CreateContainerRequest, createConfig *dockertypes.ContainerCreateConfig) (*containerCleanupInfo, error) { cleanupInfo := &containerCleanupInfo{}


return } <ins> func isHostRunningCgroupV2(f *framework.Framework, host string) bool { result, err := e2essh.SSH("stat -fc %T /sys/fs/cgroup/", host, framework.TestContext.Provider) framework.ExpectNoError(err) framework.ExpectEqual(result.Code, 0) // 0x63677270 == CGROUP2_SUPER_MAGIC // https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html return strings.Contains(result.Stdout, "cgroup2") || strings.Contains(result.Stdout, "0x63677270") } </ins> func getNpdPodStat(f *framework.Framework, nodeName string) (cpuUsage, rss, workingSet float64) { summary, err := e2ekubelet.GetStatsSummary(f.ClientSet, nodeName) framework.ExpectNoError(err)


} // Add volume to desired state of world <del> _, err = dswp.desiredStateOfWorld.AddPodToVolume( </del> <ins> uniqueVolumeName, err := dswp.desiredStateOfWorld.AddPodToVolume( </ins> uniquePodName, pod, volumeSpec, podVolume.Name, volumeGidValue) if err != nil { klog.ErrorS(err, "Failed to add volume to desiredStateOfWorld", "pod", klog.KObj(pod), "volumeName", podVolume.Name, "volumeSpecName", volumeSpec.Name())


"io/ioutil" "os" "reflect" <ins> "strings" </ins> "testing" "github.com/imdario/mergo" <del> "k8s.io/kubernetes/pkg/client/restclient" </del> clientcmdapi "k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api" )


hosts := []string{} for _, n := range nodelist.Items { for _, addr := range n.Status.Addresses { <del> if addr.Type == addrType { </del> <ins> if addr.Type == addrType && addr.Address != "" { </ins> hosts = append(hosts, addr.Address) break }


setMaxElements:   42, expectedSetCost:  8, }, <ins> { name:             "enums with maxLength equals to the longest possible value", schemaGenerator:  genEnumWithRuleAndValues("self.contains('A')", "A", "B", "C", "LongValue"), expectedCalcCost: 2, setMaxElements:   1000, expectedSetCost:  401, }, </ins> } for _, testCase := range cases { t.Run(testCase.name, func(t *testing.T) {


--allow "tcp:3389" & fi fi <ins> kube::util::wait-for-jobs || { code=$? echo -e "${color_red}Failed to create firewall rules.${color_norm}" >&2 exit $code } </ins> } function expand-default-subnetwork() {


WorkingDir string `gcfg:"working-dir"` // Soap round tripper count (retries = RoundTripper - 1) RoundTripperCount uint `gcfg:"soap-roundtrip-count"` <del> // Deprecated as the virtual machines will be automatically discovered. </del> <ins> // Is required on the controller-manager if it does not run on a VMware machine </ins> // VMUUID is the VM Instance UUID of virtual machine which can be retrieved from instanceUuid // property in VmConfigInfo, or also set as vc.uuid in VMX file. // If not set, will be fetched from the machine via sysfs (requires root)


stdoutBuf := bytes.NewBuffer(nil) stderrBuf := bytes.NewBuffer(nil) w := newLogWriter(stdoutBuf, stderrBuf, &LogOptions{since: test.since, timestamp: test.timestamp, bytes: -1}) <del> err := w.write(msg) </del> <ins> err := w.write(msg, true) </ins> assert.NoError(t, err) assert.Equal(t, test.expectStdout, stdoutBuf.String()) assert.Equal(t, test.expectStderr, stderrBuf.String())


} func (npm *nominatedPodMap) update(oldPod, newPod *v1.Pod) { <ins> // In some cases, an Update event with no "NominatedNode" present is received right // after a node("NominatedNode") is reserved for this pod in memory. // In this case, we need to keep reserving the NominatedNode when updating the pod pointer. nodeName := "" // We won't fall into below `if` block if the Update event represents: // (1) NominatedNode info is added // (2) NominatedNode info is updated // (3) NominatedNode info is removed if NominatedNodeName(oldPod) == "" && NominatedNodeName(newPod) == "" { if nnn, ok := npm.nominatedPodToNode[oldPod.UID]; ok { // This is the only case we should continue reserving the NominatedNode nodeName = nnn } } </ins> // We update irrespective of the nominatedNodeName changed or not, to ensure // that pod pointer is updated. npm.delete(oldPod) <del> npm.add(newPod, "") </del> <ins> npm.add(newPod, nodeName) </ins> } func (npm *nominatedPodMap) podsForNode(nodeName string) []*v1.Pod {


// ListRegisteredPriorityFunctions returns the registered priority functions. func ListRegisteredPriorityFunctions() []string { <del> schedulerFactoryMutex.Lock() defer schedulerFactoryMutex.Unlock() </del> <ins> schedulerFactoryMutex.RLock() defer schedulerFactoryMutex.RUnlock() </ins> var names []string for name := range priorityFunctionMap {


#   google         - Heapster, Google Cloud Monitoring, and Google Cloud Logging #   googleinfluxdb - Enable influxdb and google (except GCM) #   standalone     - Heapster only. Metrics available via Heapster REST API. <del> ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-googleinfluxdb}" </del> <ins> ENABLE_CLUSTER_MONITORING="${KUBE_ENABLE_CLUSTER_MONITORING:-influxdb}" </ins> # Optional: Enable node logging. ENABLE_NODE_LOGGING="${KUBE_ENABLE_NODE_LOGGING:-true}"


want      []string } testFn := func(test *testcase, t *testing.T) { <del> SortControllerRevisions(test.revisions) for i := range test.revisions { if test.revisions[i].Name != test.want[i] { t.Errorf("%s: want %s at %d got %s", test.name, test.want[i], i, test.revisions[i].Name) </del> <ins> t.Run(test.name, func(t *testing.T) { SortControllerRevisions(test.revisions) for i := range test.revisions { if test.revisions[i].Name != test.want[i] { t.Errorf("%s: want %s at %d got %s", test.name, test.want[i], i, test.revisions[i].Name) } </ins> } <del> } </del> <ins> }) </ins> } ss1 := newStatefulSet(3, "ss1", types.UID("ss1"), map[string]string{"foo": "bar"}) ss1.Status.CollisionCount = new(int32)


l.migrationCheck.validateMigrationVolumeOpCounts() } <del> ginkgo.It("should write files of various sizes, verify size, validate content [Slow][LinuxOnly]", func() { </del> <ins> ginkgo.It("should write files of various sizes, verify size, validate content [Slow]", func() { </ins> init() defer cleanup()


} }) <del> ginkgo.It("should function for pod-Service(hostNetwork): udp", func() { config := e2enetwork.NewNetworkingTestConfig(f, e2enetwork.EndpointsUseHostNetwork) ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.ClusterIP, e2enetwork.ClusterUDPPort)) err := config.DialFromTestContainer("udp", config.ClusterIP, e2enetwork.ClusterUDPPort, config.MaxTries, 0, config.EndpointHostnames()) if err != nil { framework.Failf("failed dialing endpoint, %v", err) } ginkgo.By(fmt.Sprintf("dialing(udp) %v --> %v:%v (nodeIP)", config.TestContainerPod.Name, config.NodeIP, config.NodeUDPPort)) err = config.DialFromTestContainer("udp", config.NodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames()) if err != nil { framework.Failf("failed dialing endpoint, %v", err) } }) </del> // if the endpoints pods use hostNetwork, several tests can't run in parallel // because the pods will try to acquire the same port in the host. // We run the test in serial, to avoid port conflicts.


} else { handler = restfulGetResource(getter, exporter, reqScope) } <del> handler = metrics.InstrumentRouteFunc(action.Verb, resource, subresource, namespaceScope, handler) </del> <ins> if needOverride { // need change the reported verb handler = metrics.InstrumentRouteFunc(verbOverrider.OverrideMetricsVerb(action.Verb), resource, subresource, namespaceScope, handler) } else { handler = metrics.InstrumentRouteFunc(action.Verb, resource, subresource, namespaceScope, handler) } </ins> if a.enableAPIResponseCompression { handler = genericfilters.RestfulWithCompression(handler, a.group.Context) }


case "get": // Return an existing (matching) node on get. return &api.Node{ <del> ObjectMeta: api.ObjectMeta{Name: "127.0.0.1"}, Spec:       api.NodeSpec{ExternalID: "127.0.0.1"}, </del> <ins> ObjectMeta: api.ObjectMeta{Name: testKubeletHostname}, Spec:       api.NodeSpec{ExternalID: testKubeletHostname}, </ins> }, nil default: return nil, fmt.Errorf("no reaction implemented for %s", action.Action)


function save-logs() { local -r node_name="${1}" local -r dir="${2}" <del> local files="${3} ${common_logfiles}" </del> <ins> local files="${3}" </ins> if [[ "${KUBERNETES_PROVIDER}" == "gce" || "${KUBERNETES_PROVIDER}" == "gke" ]]; then files="${files} ${gce_logfiles}" fi if [[ "${KUBERNETES_PROVIDER}" == "aws" ]]; then files="${files} ${aws_logfiles}" fi if ssh-to-node "${node_name}" "sudo systemctl status kubelet.service" &> /dev/null; then ssh-to-node "${node_name}" "sudo journalctl --output=cat -u kubelet.service" > "${dir}/kubelet.log" || true ssh-to-node "${node_name}" "sudo journalctl --output=cat -u docker.service" > "${dir}/docker.log" || true <ins> ssh-to-node "${node_name}" "sudo journalctl --output=cat -k" > "${dir}/kern.log" || true </ins> else <del> files="${files} ${initd_logfiles} ${supervisord_logfiles}" </del> <ins> files="${kern_logfile} ${files} ${initd_logfiles} ${supervisord_logfiles}" </ins> fi copy-logs-from-node "${node_name}" "${dir}" "${files}" }


return checkMirrorPodDisappear(ctx, f.ClientSet, pod.Name, pod.Namespace) }, f.Timeouts.PodDelete, f.Timeouts.Poll).Should(gomega.BeNil()) }) <del> // Regression test for an extended scenario for https://issues.k8s.io/123980 ginkgo.It("should evict running pods that do not meet the affinity after the kubelet restart", func(ctx context.Context) { nodeLabelKey := string(uuid.NewUUID()) nodeLabelValueRequired := string(uuid.NewUUID()) podName := "affinity-pod" + string(uuid.NewUUID()) nodeName := getNodeName(ctx, f) ginkgo.By(fmt.Sprintf("Adding node label for node (%s) to satisify pod (%s/%s) affinity", nodeName, f.Namespace.Name, podName)) e2enode.AddOrUpdateLabelOnNode(f.ClientSet, nodeName, nodeLabelKey, nodeLabelValueRequired) ginkgo.DeferCleanup(func() { e2enode.RemoveLabelOffNode(f.ClientSet, nodeName, nodeLabelKey) }) pod := e2epod.MustMixinRestrictedPodSecurity(&v1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name:      podName, Namespace: f.Namespace.Name, }, Spec: v1.PodSpec{ Affinity: &v1.Affinity{ NodeAffinity: &v1.NodeAffinity{ RequiredDuringSchedulingIgnoredDuringExecution: &v1.NodeSelector{ NodeSelectorTerms: []v1.NodeSelectorTerm{ { MatchExpressions: []v1.NodeSelectorRequirement{ { Key:      nodeLabelKey, Operator: v1.NodeSelectorOpIn, Values:   []string{nodeLabelValueRequired}, }, }, }, }, }, }, }, Containers: []v1.Container{ { Name:  podName, Image: imageutils.GetPauseImageName(), }, }, }, }) // Create the pod bound to the node. It will start, but will be rejected after kubelet restart. ginkgo.By(fmt.Sprintf("Creating a pod (%s/%s)", f.Namespace.Name, podName)) e2epod.NewPodClient(f).Create(ctx, pod) ginkgo.By(fmt.Sprintf("Waiting for the pod (%s/%s) to be running", f.Namespace.Name, pod.Name)) err := e2epod.WaitForPodNameRunningInNamespace(ctx, f.ClientSet, pod.Name, f.Namespace.Name) framework.ExpectNoError(err, "Failed to await for the pod to be running: (%v/%v)", f.Namespace.Name, pod.Name) // Remove node label e2enode.RemoveLabelOffNode(f.ClientSet, nodeName, nodeLabelKey) ginkgo.By("Restart the kubelet") restartKubelet(true) gomega.Eventually(ctx, func() bool { return kubeletHealthCheck(kubeletHealthCheckURL) }, recoverTimeout, f.Timeouts.Poll). Should(gomega.BeTrueBecause("kubelet should be healthy after restart")) // Pod should be terminated, maybe not immediately, should allow a few seconds for the kubelet to kill the pod // after kubelet restart, pod admission denied, kubelet will reject the pod and kill container. gomega.Eventually(ctx, func() bool { pod, err = e2epod.NewPodClient(f).Get(ctx, podName, metav1.GetOptions{}) framework.ExpectNoError(err) // pod is in a final state, the following are the behaviors of pods after kubelet restarted: // 1. kubelet `canAdmitPod` reject pod by reason Pod admission denied by nodeAffinity // 2. kubelet stop/kill container // the final state of the pod is related to the kill container. // if an error occurs in the preStop of the container or the exitCode is not 0, // the phase is PodFailed. if the exitCode of the StopContainer is 0, the phase is PodSucceeded. // in this case, stop and kill container is successful(exitCode 0), the pod phase should be PodSucceeded. return pod.Status.Phase == v1.PodSucceeded }, recoverTimeout, f.Timeouts.Poll).Should(gomega.BeTrueBecause("Pod %s not terminated: %s", pod.Name, pod.Status.Phase)) }) </del> }) })


}, &api.Pod{ ObjectMeta: api.ObjectMeta{ <del> UID:       "222", Name:      "bar" + "-" + hostname, Namespace: "default", SelfLink: getSelfLink("bar-"+hostname, kubetypes.NamespaceDefault), </del> <ins> UID:         "222", Name:        "bar" + "-" + hostname, Namespace:   "default", Annotations: map[string]string{kubetypes.ConfigHashAnnotationKey: "222"}, SelfLink:    getSelfLink("bar-"+hostname, kubetypes.NamespaceDefault), </ins> }, Spec: api.PodSpec{ NodeName:                      hostname,


apiVersion: v1 metadata: name: etcd-discovery <del> creationTimestamp: </del> labels: name: etcd-discovery spec:


} ginkgo.By(fmt.Sprintf("Create node foo by user: %v", asUser)) _, err := c.CoreV1().Nodes().Create(context.TODO(), node, metav1.CreateOptions{}) <ins> // NOTE: If the test fails and a new node IS created, we need to delete it. If we don't, we'd have // a zombie node in a NotReady state which will delay further tests since we're waiting for all // tests to be in the Ready state. defer func() { f.ClientSet.CoreV1().Nodes().Delete(context.TODO(), node.Name, metav1.DeleteOptions{}) }() </ins> framework.ExpectEqual(apierrors.IsForbidden(err), true) })


if err != nil { return nil, err } <ins> errors := ds.performPlatformSpecificContainerForContainer(r.ContainerId) if len(errors) != 0 { return nil, fmt.Errorf("failed to run platform-specific clean ups for container %q: %v", r.ContainerId, errors) } </ins> err = ds.client.RemoveContainer(r.ContainerId, dockertypes.ContainerRemoveOptions{RemoveVolumes: true, Force: true}) if err != nil { return nil, fmt.Errorf("failed to remove container %q: %v", r.ContainerId, err) } return &runtimeapi.RemoveContainerResponse{}, nil }


bash -c "${common_commands}" diff -ruN "${output_dir}/upstream" "${output_dir}/patch" >"${diff_file}" || true <ins> if [[ -t 1 ]]; then  # Attached to a terminal? less "${diff_file}" fi </ins> echo echo "  *** Diff saved in ${diff_file} ***"


"type": "string" }, "ports": { <del> "description": "List of ports to expose from the container. Exposing a port here gives the system additional information about the network connections a container uses, but is primarily informational. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Cannot be updated.", </del> <ins> "description": "List of ports to expose from the container. Not specifying a port here DOES NOT prevent that port from being exposed. Any port which is listening on the default "0.0.0.0" address inside a container will be accessible from the network. Modifying this array with strategic merge patch may corrupt the data. For more information See https://github.com/kubernetes/kubernetes/issues/108255. Cannot be updated.", </ins> "items": { "allOf": [ {


if err != nil { t.Fatalf("unexpected error: %v", err) } <ins> } func TestDeleteNamespaceWithIncompleteFinalizers(t *testing.T) { now := util.Now() fakeEtcdClient, helper := newHelper(t) fakeEtcdClient.ChangeIndex = 1 fakeEtcdClient.Data["/registry/namespaces/foo"] = tools.EtcdResponseWithError{ R: &etcd.Response{ Node: &etcd.Node{ Value: runtime.EncodeOrDie(latest.Codec, &api.Namespace{ ObjectMeta: api.ObjectMeta{ Name:              "foo", DeletionTimestamp: &now, }, Spec: api.NamespaceSpec{ Finalizers: []api.FinalizerName{api.FinalizerKubernetes}, }, Status: api.NamespaceStatus{Phase: api.NamespaceActive}, }), ModifiedIndex: 1, CreatedIndex:  1, }, }, } storage, _, _ := NewStorage(helper) _, err := storage.Delete(api.NewDefaultContext(), "foo", nil) if err == nil { t.Fatalf("expected error: %v", err) } } </ins> <del> // TODO: when we add life-cycle, this will go to Terminating, and then we need to test Terminating to gone </del> <ins> func TestDeleteNamespaceWithCompleteFinalizers(t *testing.T) { now := util.Now() fakeEtcdClient, helper := newHelper(t) fakeEtcdClient.ChangeIndex = 1 fakeEtcdClient.Data["/registry/namespaces/foo"] = tools.EtcdResponseWithError{ R: &etcd.Response{ Node: &etcd.Node{ Value: runtime.EncodeOrDie(latest.Codec, &api.Namespace{ ObjectMeta: api.ObjectMeta{ Name:              "foo", DeletionTimestamp: &now, }, Spec: api.NamespaceSpec{ Finalizers: []api.FinalizerName{}, }, Status: api.NamespaceStatus{Phase: api.NamespaceActive}, }), ModifiedIndex: 1, CreatedIndex:  1, }, }, } storage, _, _ := NewStorage(helper) _, err := storage.Delete(api.NewDefaultContext(), "foo", nil) if err != nil { t.Fatalf("unexpected error: %v", err) } </ins> }


"kind": "Service", "apiVersion": "v1beta3", "metadata": { <del> "name": "my-service", </del> <ins> "name": "my-service" </ins> }, "spec": { "selector": {


// during "reserve" extension point or later. func (mc CommunicatingPlugin) Unreserve(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) { if pod.Name == "my-test-pod" { <del> state.Lock() </del> // The pod is at the end of its lifecycle -- let's clean up the allocated // resources. In this case, our clean up is simply deleting the key written // in the Reserve operation. state.Delete(framework.StateKey(pod.Name)) <del> state.Unlock() </del> } }


### Negative caching <del> The `denial` cache TTL has been reduced to the minimum of 5 seconds [here](https://github.com/kubernetes/kubernetes/blob/master/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml#L37). In the unlikely event that this impacts performance, setting this TTL to a higher value make help alleviate issues, but be aware that operations that rely on DNS polling for orchestration may fail (for example operators with StatefulSets). </del> <ins> The `denial` cache TTL has been reduced to the minimum of 5 seconds [here](https://github.com/kubernetes/kubernetes/blob/a38ed2c5ceedf682cbc19442aac5224ae6e10eaa/cluster/addons/dns/nodelocaldns/nodelocaldns.yaml#L61). In the unlikely event that this impacts performance, setting this TTL to a higher value make help alleviate issues, but be aware that operations that rely on DNS polling for orchestration may fail (for example operators with StatefulSets). </ins>


}) } <ins> // waitForRCPodToDisappear returns nil if the pod from the given replication controller (described by rcName) no longer exists. // In case of failure or too long waiting time, an error is returned. func waitForRCPodToDisappear(c *client.Client, ns, rcName, podName string) error { label := labels.SelectorFromSet(labels.Set(map[string]string{"name": rcName})) return waitForPodToDisappear(c, ns, podName, label, 20*time.Second, 5*time.Minute) } </ins> // waitForService waits until the service appears (exist == true), or disappears (exist == false) func waitForService(c *client.Client, namespace, name string, exist bool, interval, timeout time.Duration) error { err := wait.Poll(interval, timeout, func() (bool, error) {


"name":        "The name of this port.  This must match the 'name' field in the corresponding ServicePort. Must be a DNS_LABEL. Optional only if one port is defined.", "port":        "The port number of the endpoint.", "protocol":    "The IP protocol for this port. Must be UDP, TCP, or SCTP. Default is TCP.", <del> "appProtocol": "The application protocol for this port. This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and http://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names such as mycompany.com/my-custom-protocol.", </del> <ins> "appProtocol": "The application protocol for this port. This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and https://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names such as mycompany.com/my-custom-protocol.", </ins> } func (EndpointPort) SwaggerDoc() map[string]string {


}, []string{"operation", "type"}, ) <ins> etcdObjectCounts = compbasemetrics.NewGaugeVec( &compbasemetrics.GaugeOpts{ Name:              "etcd_object_counts", DeprecatedVersion: "1.21.0", Help:              "Number of stored objects at the time of last check split by kind. This metric is replaced by apiserver_storage_object_counts.", StabilityLevel:    compbasemetrics.ALPHA, }, []string{"resource"}, ) </ins> objectCounts = compbasemetrics.NewGaugeVec( &compbasemetrics.GaugeOpts{ <del> Name:           "etcd_object_counts", </del> <ins> Name:           "apiserver_storage_object_counts", </ins> Help:           "Number of stored objects at the time of last check split by kind.", <del> StabilityLevel: compbasemetrics.ALPHA, </del> <ins> StabilityLevel: compbasemetrics.STABLE, </ins> }, []string{"resource"}, )


Status:     status, } } <ins> func TestPrioritiesRegistered(t *testing.T) { var functionNames []string // Files and directories which priorities may be referenced targetFiles := []string{ "./../../algorithmprovider/defaults/defaults.go", // Default algorithm "./../../factory/plugins.go",                     // Registered in init() } // List all golang source files under ./priorities/, excluding test files and sub-directories. files, err := codeinspector.GetSourceCodeFiles(".") if err != nil { t.Errorf("unexpected error: %v when listing files in current directory", err) } // Get all public priorities in files. for _, filePath := range files { functions, err := codeinspector.GetPublicFunctions(filePath) if err == nil { functionNames = append(functionNames, functions...) } else { t.Errorf("unexpected error when parsing %s", filePath) } } // Check if all public priorities are referenced in target files. for _, functionName := range functionNames { args := []string{"-rl", functionName} args = append(args, targetFiles...) err := exec.Command("grep", args...).Run() if err != nil { switch err.Error() { case "exit status 2": t.Errorf("unexpected error when checking %s", functionName) case "exit status 1": t.Errorf("priority %s is implemented as public but seems not registered or used in any other place", functionName) } } } } </ins>


} return parameters, nil default: <ins> sort.Slice(objs, func(i, j int) bool { obj1, obj2 := objs[i].(*resourcev1alpha2.ResourceClaimParameters), objs[j].(*resourcev1alpha2.ResourceClaimParameters) if obj1 == nil || obj2 == nil { return false } return obj1.Name < obj2.Name }) </ins> return nil, statusError(logger, fmt.Errorf("multiple generated claim parameters for %s.%s %s found: %s", claim.Spec.ParametersRef.Kind, claim.Spec.ParametersRef.APIGroup, klog.KRef(claim.Namespace, claim.Spec.ParametersRef.Name), klog.KObjSlice(objs))) } }


"PD" "ServiceAccounts" "Networkingsshouldsfunctionsforsintra-podscommunication"  # possibly causing Ginkgo to get stuck, issue: #13485 <ins> "Services.*identicallysnamed" # error waiting for reachability, issue: #16285 </ins> ) # Tests that should not run on soak cluster.


err = e2epod.WaitForPodContainerStarted(f.ClientSet, f.Namespace.Name, p.Name, 0, framework.PodStartTimeout) framework.ExpectNoError(err) <del> startedTime := time.Now() </del> // We assume the pod became ready when the container became ready. This // is true for a single container pod. err = e2epod.WaitTimeoutForPodReadyInNamespace(f.ClientSet, p.Name, f.Namespace.Name, framework.PodStartTimeout) framework.ExpectNoError(err) <del> readyTime := time.Now() </del> p, err = podClient.Get(context.TODO(), p.Name, metav1.GetOptions{}) framework.ExpectNoError(err)


} } <del> func TestDeletePodForNotExistingNode(t *testing.T) { </del> <ins> func TestDeleteUnscheduledPodForNotExistingNode(t *testing.T) { </ins> for _, f := range []bool{true, false} { defer utilfeaturetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.ScheduleDaemonSetPods, f)() for _, strategy := range updateStrategies() {


return plugin.getFakeVolume(&plugin.Attachers), nil } <ins> func (plugin *FakeVolumePlugin) GetAttachers() (Attachers []*FakeVolume) { plugin.RLock() defer plugin.RUnlock() return plugin.Attachers } </ins> func (plugin *FakeVolumePlugin) GetNewAttacherCallCount() int { plugin.RLock() defer plugin.RUnlock()


defaultBurst = 300 AcceptV1 = runtime.ContentTypeJSON <del> // Aggregated discovery content-type (currently v2beta1). NOTE: Currently, we are assuming the order // for "g", "v", and "as" from the server. We can only compare this string if we can make that assumption. </del> <ins> // Aggregated discovery content-type (v2beta1). NOTE: content-type parameters // MUST be ordered (g, v, as) for server in "Accept" header (BUT we are resilient // to ordering when comparing returned values in "Content-Type" header). </ins> AcceptV2Beta1 = runtime.ContentTypeJSON + ";" + "g=apidiscovery.k8s.io;v=v2beta1;as=APIGroupDiscoveryList" // Prioritize aggregated discovery by placing first in the order of discovery accept types. acceptDiscoveryFormats = AcceptV2Beta1 + "," + AcceptV1


readyEps := 0 notReadyEps := 0 <del> for i := range pods { // TODO: Do we need to copy here? pod := &(*pods[i]) </del> <ins> for _, pod := range pods { </ins> for i := range service.Spec.Ports { servicePort := &service.Spec.Ports[i]


# CNI plugins - name: "cni" <del> version: 0.8.7 </del> <ins> version: 0.9.1 </ins> refPaths: - path: cluster/gce/gci/configure.sh match: DEFAULT_CNI_VERSION=


framework.SkipUnlessProviderIs("gce", "gke") // Testing a 1.7 version of the sample-apiserver <del> TestSampleAPIServer(f, "gcr.io/kubernetes-e2e-test-images/k8s-aggregator-sample-apiserver-amd64:1.7", "sample-system") </del> <ins> TestSampleAPIServer(f, "gcr.io/kubernetes-e2e-test-images/k8s-aggregator-sample-apiserver-amd64:1.7v2", "sample-system") </ins> }) })


"io/ioutil" "net" "path/filepath" <ins> "time" </ins> cadvisorapiv1 "github.com/google/cadvisor/info/v1" cadvisorv2 "github.com/google/cadvisor/info/v2"