Skip to content

Commit

Permalink
Release for Kubernetes 1.19.0
Browse files Browse the repository at this point in the history
This commit prepares Sunobuoy to support Kubernetes version 1.19.0.
The patch intdocues the following changes

* Changes to code to better align with upstream Kubernetes manifest code to
  reduce manual maintenance of code sync
* Set hard limit to registries that can be pulled from pass releases to use
  the two regressive versions from the current version
* Code clean up to remove unsupported airgap versions
* Documentation update for release procedures

Signed-off-by: Vladimir Vivien <vivienv@vmware.com>
  • Loading branch information
vladimirvivien committed Aug 27, 2020
1 parent 670b310 commit ec4cefd
Show file tree
Hide file tree
Showing 37 changed files with 1,747 additions and 515 deletions.
6 changes: 3 additions & 3 deletions kind-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
- role: control-plane
image: sonobuoy/kind-node:v1.18.0
image: sonobuoy/kind-node:v1.19.0
- role: worker
image: sonobuoy/kind-node:v1.18.0
image: sonobuoy/kind-node:v1.19.0
- role: worker
image: sonobuoy/kind-node:v1.18.0
image: sonobuoy/kind-node:v1.19.0
6 changes: 3 additions & 3 deletions pkg/buildinfo/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ limitations under the License.
package buildinfo

// Version is the current version of Sonobuoy, set by the go linker's -X flag at build time
var Version = "v0.18.5"
var Version = "v0.19.0"

// GitSHA is the actual commit that is being built, set by the go linker's -X flag at build time.
var GitSHA string

// MinimumKubeVersion is the lowest API version of Kubernetes this release of Sonobuoy supports.
var MinimumKubeVersion = "1.16.0"
var MinimumKubeVersion = "1.17.0"

// MaximumKubeVersion is the highest API version of Kubernetes this release of Sonobuoy supports.
var MaximumKubeVersion = "1.18.99"
var MaximumKubeVersion = "1.19.99"
170 changes: 129 additions & 41 deletions pkg/image/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,124 @@ import (
)

const (
// Agnhost image
Agnhost = iota
// AgnhostPrivate image
AgnhostPrivate
// APIServer image
APIServer
// AppArmorLoader image
AppArmorLoader
// AuthenticatedAlpine image
AuthenticatedAlpine
// AuthenticatedWindowsNanoServer image
AuthenticatedWindowsNanoServer
// BusyBox image
BusyBox
// CheckMetadataConcealment image
CheckMetadataConcealment
// CudaVectorAdd image
CudaVectorAdd
// CudaVectorAdd2 image
CudaVectorAdd2
// Dnsutils image
Dnsutils
// DebianIptables Image
DebianIptables
// EchoServer image
EchoServer
// Etcd image
Etcd
// GlusterDynamicProvisioner image
GlusterDynamicProvisioner
// Httpd image
Httpd
// HttpdNew image
HttpdNew
// InvalidRegistryImage image
InvalidRegistryImage
// IpcUtils image
IpcUtils
// JessieDnsutils image
JessieDnsutils
// Kitten image
Kitten
// Mounttest image
Mounttest
// MounttestUser image
MounttestUser
// Nautilus image
Nautilus
// NFSProvisioner image
NFSProvisioner
// Nginx image
Nginx
// NginxNew image
NginxNew
// Nonewprivs image
Nonewprivs
// NonRoot runs with a default user of 1234
NonRoot
// Pause - when these values are updated, also update cmd/kubelet/app/options/container_runtime.go
// Pause image
Pause
// Perl image
Perl
// PrometheusDummyExporter image
PrometheusDummyExporter
// PrometheusToSd image
PrometheusToSd
// Redis image
Redis
// RegressionIssue74839 image
RegressionIssue74839
// ResourceConsumer image
ResourceConsumer
// ResourceController image
ResourceController
// SdDummyExporter image
SdDummyExporter
// StartupScript image
StartupScript
// TestWebserver image
TestWebserver
// VolumeNFSServer image
VolumeNFSServer
// VolumeISCSIServer image
VolumeISCSIServer
// VolumeGlusterServer image
VolumeGlusterServer
// VolumeRBDServer image
VolumeRBDServer
)

const (
buildImageRegistry = "k8s.gcr.io/build-image"
dockerGluster = "docker.io/gluster"
dockerLibraryRegistry = "docker.io/library"
e2eRegistry = "gcr.io/kubernetes-e2e-test-images"
e2eVolumeRegistry = "gcr.io/kubernetes-e2e-test-images/volume"
etcdRegistry = "quay.io/coreos"
gcAuthenticatedRegistry = "gcr.io/authenticated-image-pulling"
gcRegistry = "k8s.gcr.io"
gcrReleaseRegistry = "gcr.io/gke-release"
googleContainerRegistry = "gcr.io/google-containers"
invalidRegistry = "invalid.com/invalid"
privateRegistry = "gcr.io/k8s-authenticated-test"
promoterE2eRegistry = "us.gcr.io/k8s-artifacts-prod/e2e-test-images"
promoterE2eRegistry = "k8s.gcr.io/e2e-test-images"
quayIncubator = "quay.io/kubernetes_incubator"
quayK8sCSI = "quay.io/k8scsi"
sampleRegistry = "gcr.io/google-samples"
sigStorageRegistry = "k8s.gcr.io/sig-storage"
)

// RegistryList holds public and private image registries
type RegistryList struct {
BuildImageRegistry string `yaml:"buildImageRegistry"`
DockerGluster string `yaml:"dockerGluster,omitempty"`
DockerLibraryRegistry string `yaml:"dockerLibraryRegistry,omitempty"`
E2eRegistry string `yaml:"e2eRegistry,omitempty"`
E2eVolumeRegistry string `yaml:"e2eVolumeRegistry"`
EtcdRegistry string `yaml:"etcdRegistry,omitempty"`
GcAuthenticatedRegistry string `yaml:"gcAuthenticatedRegistry,omitempty"`
GcRegistry string `yaml:"gcRegistry,omitempty"`
Expand All @@ -57,6 +154,7 @@ type RegistryList struct {
QuayIncubator string `yaml:"quayIncubator,omitempty"`
QuayK8sCSI string `yaml:"quayK8sCSI,omitempty"`
SampleRegistry string `yaml:"sampleRegistry,omitempty"`
SigStorageRegistry string `yaml:"sigStorageRegistry"`

K8sVersion *version.Version `yaml:"-"`
Images map[int]Config `yaml:"-"`
Expand All @@ -72,9 +170,11 @@ type Config struct {
// NewRegistryList returns a default registry or one that matches a config file passed
func NewRegistryList(repoConfig, k8sVersion string) (*RegistryList, error) {
registry := &RegistryList{
BuildImageRegistry: buildImageRegistry,
DockerGluster: dockerGluster,
DockerLibraryRegistry: dockerLibraryRegistry,
E2eRegistry: e2eRegistry,
E2eVolumeRegistry: e2eVolumeRegistry,
EtcdRegistry: etcdRegistry,
GcAuthenticatedRegistry: gcAuthenticatedRegistry,
GcRegistry: gcRegistry,
Expand All @@ -84,8 +184,9 @@ func NewRegistryList(repoConfig, k8sVersion string) (*RegistryList, error) {
PrivateRegistry: privateRegistry,
QuayIncubator: quayIncubator,
QuayK8sCSI: quayK8sCSI,
SampleRegistry: sampleRegistry,
PromoterE2eRegistry: promoterE2eRegistry,
SampleRegistry: sampleRegistry,
SigStorageRegistry: sigStorageRegistry,
}

// Load in a config file
Expand Down Expand Up @@ -114,25 +215,21 @@ func NewRegistryList(repoConfig, k8sVersion string) (*RegistryList, error) {
}

// getImageConfigs returns the map of image Config for the registry version
func (r *RegistryList) getImageConfigs() (map[string]Config, error) {
func (r *RegistryList) getImageConfigs() (map[int]Config, error) {
switch r.K8sVersion.Segments()[0] {
case 1:
switch r.K8sVersion.Segments()[1] {
case 13:
return r.v1_13(), nil
case 14:
return r.v1_14(), nil
case 15:
return r.v1_15(), nil
case 16:
return r.v1_16(), nil
case 13, 14, 15, 16:
return nil, fmt.Errorf("version not supported for this build: %v", r.K8sVersion)
case 17:
return r.v1_17(), nil
case 18:
return r.v1_18(), nil
case 19:
return r.v1_19(), nil
}
}
return map[string]Config{}, fmt.Errorf("No matching configuration for k8s version: %v", r.K8sVersion)
return map[int]Config{}, fmt.Errorf("no matching configuration for k8s version: %v", r.K8sVersion)

}

Expand Down Expand Up @@ -199,35 +296,8 @@ func GetDefaultImageRegistries(version string) (*RegistryList, error) {
switch v.Segments()[0] {
case 1:
switch v.Segments()[1] {
case 13, 14:
return &RegistryList{
DockerLibraryRegistry: dockerLibraryRegistry,
E2eRegistry: e2eRegistry,
EtcdRegistry: etcdRegistry,
GcRegistry: gcRegistry,
SampleRegistry: sampleRegistry,
}, nil
case 15:
return &RegistryList{
DockerLibraryRegistry: dockerLibraryRegistry,
E2eRegistry: e2eRegistry,
GcRegistry: gcRegistry,
SampleRegistry: sampleRegistry,
}, nil
case 16:
return &RegistryList{
DockerLibraryRegistry: dockerLibraryRegistry,
E2eRegistry: e2eRegistry,
GcRegistry: gcRegistry,
GoogleContainerRegistry: googleContainerRegistry,
SampleRegistry: sampleRegistry,

// The following keys are used in the v1.16 registry list however their images
// cannot be pulled as they are used as part of tests for checking image pull
// behavior. They are omitted from the resulting config.
// InvalidRegistry: invalidRegistry,
// GcAuthenticatedRegistry: gcAuthenticatedRegistry,
}, nil
case 13, 14, 15, 16:
return nil, fmt.Errorf("version not supported for this build: %s", version)
case 17:
return &RegistryList{
E2eRegistry: e2eRegistry,
Expand Down Expand Up @@ -261,6 +331,24 @@ func GetDefaultImageRegistries(version string) (*RegistryList, error) {
// GcAuthenticatedRegistry: gcAuthenticatedRegistry,
// PrivateRegistry: privateRegistry,
}, nil
case 19:
return &RegistryList{
BuildImageRegistry: buildImageRegistry,
E2eRegistry: e2eRegistry,
E2eVolumeRegistry: e2eVolumeRegistry,
DockerLibraryRegistry: dockerLibraryRegistry,
GcRegistry: gcRegistry,
DockerGluster: dockerGluster,
PromoterE2eRegistry: promoterE2eRegistry,
SigStorageRegistry: sigStorageRegistry,

// The following keys are used in the v1.19 registry list however their images
// cannot be pulled as they are used as part of tests for checking image pull
// behavior. They are omitted from the resulting config.
// InvalidRegistry: invalidRegistry,
// GcAuthenticatedRegistry: gcAuthenticatedRegistry,
// PrivateRegistry: privateRegistry,
}, nil
}
}
return nil, fmt.Errorf("No matching configuration for k8s version: %v", v)
Expand Down
30 changes: 15 additions & 15 deletions pkg/image/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@ func TestGetDefaultImageRegistryVersionValidation(t *testing.T) {
expect: "\"not-a-valid-version\" is invalid",
},
{
name: "v1.13 is valid",
version: "v1.13.0",
error: false,
name: "v1.16 is not valid",
version: "v1.16.0",
error: true,
},
{
name: "v1.14 is valid",
version: "v1.14.0",
name: "v1.17 is valid",
version: "v1.17.0",
error: false,
},
{
name: "v1.15 is valid",
version: "v1.15.0",
name: "v1.18 is valid",
version: "v1.18.0",
error: false,
},
{
name: "v1.16 is valid",
version: "v1.16.0",
name: "v1.19 is valid",
version: "v1.19.0",
error: false,
},
{
Expand Down Expand Up @@ -111,15 +111,15 @@ func TestGetE2EImages(t *testing.T) {
}

// Check one of the returned image names to ensure correct format
registryImage := expectedRegistry["Agnhost"]
registryImage := expectedRegistry[Agnhost]
registryImageName := registryImage.GetFullyQualifiedImageName()
if !contains(imageNames, registryImageName) {
t.Errorf("Expected result of GetImageNames to contain registry image %q", registryImageName)
}
}

func createTestRegistryConfig(customRegistry string) (string, error) {
registries, err := GetDefaultImageRegistries("v1.15.0")
func createTestRegistryConfig(customRegistry, version string) (string, error) {
registries, err := GetDefaultImageRegistries(version)
if err != nil {
return "", err
}
Expand All @@ -146,9 +146,9 @@ func createTestRegistryConfig(customRegistry string) (string, error) {
}

func TestGetE2EImageTagPairs(t *testing.T) {
version := "v1.15.0"
version := "v1.17.0"
customRegistry := "my-custom/registry"
customRegistries, err := createTestRegistryConfig(customRegistry)
customRegistries, err := createTestRegistryConfig(customRegistry, version)
if err != nil {
t.Fatalf("unexpected error creating temp registry config: %q", err)
}
Expand All @@ -162,7 +162,7 @@ func TestGetE2EImageTagPairs(t *testing.T) {
if err != nil {
t.Fatalf("unexpected error from NewRegistryList: %q", err)
}
expectedDefaultRegistry := defaultRegistry.v1_15()
expectedDefaultRegistry := defaultRegistry.v1_17()
if len(imageTagPairs) != len(expectedDefaultRegistry) {
t.Fatalf("Unexpected number of image tag pairs returned, expected %v, got %v", len(expectedDefaultRegistry), len(imageTagPairs))
}
Expand Down
Loading

0 comments on commit ec4cefd

Please sign in to comment.