Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: kubernetes/client-go
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.27.4
Choose a base ref
...
head repository: kubernetes/client-go
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.27.5
Choose a head ref
  • 5 commits
  • 5 files changed
  • 3 contributors

Commits on Jun 28, 2023

  1. client-go: allow to set NotBefore in NewSelfSignedCACert()

    Signed-off-by: Etienne Champetier <e.champetier@ateme.com>
    
    Kubernetes-commit: 0fc5c972129308617d39c543a8d34d1247ade265
    champtar authored and k8s-publishing-bot committed Jun 28, 2023

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    b1b513f View commit details

Commits on Aug 2, 2023

  1. Merge pull request #119113 from champtar/automated-cherry-pick-of-#11…

    …8922-upstream-release-1.27
    
    Automated cherry pick of #118922: kubeadm: backdate generated CAs
    
    Kubernetes-commit: 382c283f339c2b8c117ee0adb3df4bb80c86b588
    k8s-publishing-bot committed Aug 2, 2023

    Unverified

    This user has not yet uploaded their public signing key.
    Copy the full SHA
    1bfd018 View commit details

Commits on Aug 8, 2023

  1. Avoid returning nil responseKind in v1beta1 aggregated discovery

    Kubernetes-commit: 3b6bcaa0b9611cc12f65f86cb48f44c3d6c8da4f
    liggitt authored and k8s-publishing-bot committed Aug 8, 2023
    Copy the full SHA
    686c038 View commit details

Commits on Aug 10, 2023

  1. Merge pull request #119868 from liggitt/automated-cherry-pick-of-#119…

    …835-upstream-release-1.27
    
    Automated cherry pick of #119835: Avoid returning nil responseKind in v1beta1 aggregated
    
    Kubernetes-commit: 00dfa0634be509c2dfdbdb1c1fc2f326c11323b6
    k8s-publishing-bot committed Aug 10, 2023
    Copy the full SHA
    f102456 View commit details

Commits on Aug 24, 2023

  1. Copy the full SHA
    5a6ea36 View commit details
Showing with 88 additions and 11 deletions.
  1. +4 −2 discovery/aggregated_discovery.go
  2. +70 −0 discovery/aggregated_discovery_test.go
  3. +4 −4 go.mod
  4. +4 −4 go.sum
  5. +6 −1 util/cert/cert.go
6 changes: 4 additions & 2 deletions discovery/aggregated_discovery.go
Original file line number Diff line number Diff line change
@@ -111,6 +111,8 @@ func convertAPIGroup(g apidiscovery.APIGroupDiscovery) (
return group, gvResources, failedGVs
}

var emptyKind = metav1.GroupVersionKind{}

// convertAPIResource tranforms a APIResourceDiscovery to an APIResource. We are
// resilient to missing GVK, since this resource might be the parent resource
// for a subresource. If the parent is missing a GVK, it is not returned in
@@ -125,7 +127,7 @@ func convertAPIResource(in apidiscovery.APIResourceDiscovery) (metav1.APIResourc
Categories: in.Categories,
}
var err error
if in.ResponseKind != nil {
if in.ResponseKind != nil && (*in.ResponseKind) != emptyKind {
result.Group = in.ResponseKind.Group
result.Version = in.ResponseKind.Version
result.Kind = in.ResponseKind.Kind
@@ -140,7 +142,7 @@ func convertAPIResource(in apidiscovery.APIResourceDiscovery) (metav1.APIResourc
// convertAPISubresource tranforms a APISubresourceDiscovery to an APIResource.
func convertAPISubresource(parent metav1.APIResource, in apidiscovery.APISubresourceDiscovery) (metav1.APIResource, error) {
result := metav1.APIResource{}
if in.ResponseKind == nil {
if in.ResponseKind == nil || (*in.ResponseKind) == emptyKind {
return result, fmt.Errorf("subresource %s/%s missing GVK", parent.Name, in.Subresource)
}
result.Name = fmt.Sprintf("%s/%s", parent.Name, in.Subresource)
70 changes: 70 additions & 0 deletions discovery/aggregated_discovery_test.go
Original file line number Diff line number Diff line change
@@ -610,6 +610,76 @@ func TestSplitGroupsAndResources(t *testing.T) {
},
expectedFailedGVs: map[schema.GroupVersion]error{},
},
{
name: "Aggregated discovery with single subresource and parent empty GVK",
agg: apidiscovery.APIGroupDiscoveryList{
Items: []apidiscovery.APIGroupDiscovery{
{
ObjectMeta: metav1.ObjectMeta{
Name: "external.metrics.k8s.io",
},
Versions: []apidiscovery.APIVersionDiscovery{
{
Version: "v1beta1",
Resources: []apidiscovery.APIResourceDiscovery{
{
// resilient to empty GVK for parent
Resource: "*",
Scope: apidiscovery.ScopeNamespace,
SingularResource: "",
ResponseKind: &metav1.GroupVersionKind{},
Subresources: []apidiscovery.APISubresourceDiscovery{
{
Subresource: "other-external-metric",
ResponseKind: &metav1.GroupVersionKind{
Kind: "MetricValueList",
},
Verbs: []string{"get"},
},
},
},
},
},
},
},
},
},
expectedGroups: metav1.APIGroupList{
Groups: []metav1.APIGroup{
{
Name: "external.metrics.k8s.io",
Versions: []metav1.GroupVersionForDiscovery{
{
GroupVersion: "external.metrics.k8s.io/v1beta1",
Version: "v1beta1",
},
},
PreferredVersion: metav1.GroupVersionForDiscovery{
GroupVersion: "external.metrics.k8s.io/v1beta1",
Version: "v1beta1",
},
},
},
},
expectedGVResources: map[schema.GroupVersion]*metav1.APIResourceList{
{Group: "external.metrics.k8s.io", Version: "v1beta1"}: {
GroupVersion: "external.metrics.k8s.io/v1beta1",
APIResources: []metav1.APIResource{
// Since parent GVK was nil, it is NOT returned--only the subresource.
{
Name: "*/other-external-metric",
SingularName: "",
Namespaced: true,
Group: "",
Version: "",
Kind: "MetricValueList",
Verbs: []string{"get"},
},
},
},
},
expectedFailedGVs: map[schema.GroupVersion]error{},
},
{
name: "Aggregated discovery with multiple subresources",
agg: apidiscovery.APIGroupDiscoveryList{
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -24,8 +24,8 @@ require (
golang.org/x/term v0.6.0
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
google.golang.org/protobuf v1.28.1
k8s.io/api v0.0.0-20230705181702-64b026215965
k8s.io/apimachinery v0.0.0-20230612171306-38152d47d786
k8s.io/api v0.27.5
k8s.io/apimachinery v0.27.5
k8s.io/klog/v2 v2.90.1
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f
k8s.io/utils v0.0.0-20230209194617-a36077c30491
@@ -59,6 +59,6 @@ require (
)

replace (
k8s.io/api => k8s.io/api v0.0.0-20230705181702-64b026215965
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20230612171306-38152d47d786
k8s.io/api => k8s.io/api v0.27.5
k8s.io/apimachinery => k8s.io/apimachinery v0.27.5
)
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
@@ -477,10 +477,10 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20230705181702-64b026215965 h1:Lv0yoxijsg4yBwh3PWCxNmYCqv0WKRXKpSd1NPbEbq8=
k8s.io/api v0.0.0-20230705181702-64b026215965/go.mod h1:9LsazkXf9OZf89wznhOAj2xkhSqSkAXtPjw1Q9i8oFI=
k8s.io/apimachinery v0.0.0-20230612171306-38152d47d786 h1:5apbbWoKi3ZjCSWm5UKfcNW2egne2ZbbG05tyUaKiKE=
k8s.io/apimachinery v0.0.0-20230612171306-38152d47d786/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E=
k8s.io/api v0.27.5 h1:49hIzqJNSuOQpA53MMihgAS4YDcQitTy58B9PMFthLc=
k8s.io/api v0.27.5/go.mod h1:zjBZB+c0KDU55Wxb9Bob9WZGxu9zdKHitzHxBtaIVoA=
k8s.io/apimachinery v0.27.5 h1:6Q5HBXYJJPisd6yDVAprLe6FQsmw7a7Cu69dcrpQET8=
k8s.io/apimachinery v0.27.5/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E=
k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw=
k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg=
7 changes: 6 additions & 1 deletion util/cert/cert.go
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ type Config struct {
Organization []string
AltNames AltNames
Usages []x509.ExtKeyUsage
NotBefore time.Time
}

// AltNames contains the domain names and IP addresses that will be added
@@ -64,14 +65,18 @@ func NewSelfSignedCACert(cfg Config, key crypto.Signer) (*x509.Certificate, erro
return nil, err
}
serial = new(big.Int).Add(serial, big.NewInt(1))
notBefore := now.UTC()
if !cfg.NotBefore.IsZero() {
notBefore = cfg.NotBefore.UTC()
}
tmpl := x509.Certificate{
SerialNumber: serial,
Subject: pkix.Name{
CommonName: cfg.CommonName,
Organization: cfg.Organization,
},
DNSNames: []string{cfg.CommonName},
NotBefore: now.UTC(),
NotBefore: notBefore,
NotAfter: now.Add(duration365d * 10).UTC(),
KeyUsage: x509.KeyUsageKeyEncipherment | x509.KeyUsageDigitalSignature | x509.KeyUsageCertSign,
BasicConstraintsValid: true,