Skip to content

Commit

Permalink
Add upgrader image to the version bundle (aws#7082)
Browse files Browse the repository at this point in the history
* Add upgrader image to the version bundle

Signed-off-by: Rahul Ganesh <[email protected]>

* Fix lint formatting and bundle variable name

Signed-off-by: Rahul Ganesh <[email protected]>

* Fix presubmits, omit version field and update generated deepcopy files

Signed-off-by: Rahul Ganesh <[email protected]>

* Add upgrader project to assets config and update manifests

Signed-off-by: Rahul Ganesh <[email protected]>

---------

Signed-off-by: Rahul Ganesh <[email protected]>
Co-authored-by: Rahul Ganesh <[email protected]>
  • Loading branch information
rahulbabu95 and Rahul Ganesh authored Nov 28, 2023
1 parent f8cb14e commit 4922ca1
Show file tree
Hide file tree
Showing 12 changed files with 4,295 additions and 154 deletions.
36 changes: 36 additions & 0 deletions config/crd/bases/anywhere.eks.amazonaws.com_bundles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2816,6 +2816,42 @@ spec:
- metadata
- version
type: object
upgrader:
description: UpgraderBundle is a In-place Kubernetes version
upgrader bundle.
properties:
upgrader:
properties:
arch:
description: Architectures of the asset
items:
type: string
type: array
description:
type: string
imageDigest:
description: The SHA256 digest of the image manifest
type: string
name:
description: The asset name
type: string
os:
description: Operating system of the asset
enum:
- linux
- darwin
- windows
type: string
osName:
description: Name of the OS like ubuntu, bottlerocket
type: string
uri:
description: The image repository, name, and tag
type: string
type: object
required:
- upgrader
type: object
vSphere:
properties:
clusterAPIController:
Expand Down
36 changes: 36 additions & 0 deletions config/manifest/eksa-components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2984,6 +2984,42 @@ spec:
- metadata
- version
type: object
upgrader:
description: UpgraderBundle is a In-place Kubernetes version
upgrader bundle.
properties:
upgrader:
properties:
arch:
description: Architectures of the asset
items:
type: string
type: array
description:
type: string
imageDigest:
description: The SHA256 digest of the image manifest
type: string
name:
description: The asset name
type: string
os:
description: Operating system of the asset
enum:
- linux
- darwin
- windows
type: string
osName:
description: Name of the OS like ubuntu, bottlerocket
type: string
uri:
description: The image repository, name, and tag
type: string
type: object
required:
- upgrader
type: object
vSphere:
properties:
clusterAPIController:
Expand Down
6 changes: 6 additions & 0 deletions release/api/v1alpha1/bundle_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ type VersionsBundle struct {
Haproxy HaproxyBundle `json:"haproxy,omitempty"`
Snow SnowBundle `json:"snow,omitempty"`
Nutanix NutanixBundle `json:"nutanix,omitempty"`
Upgrader UpgraderBundle `json:"upgrader,omitempty"`
// This field has been deprecated
Aws *AwsBundle `json:"aws,omitempty"`
}
Expand Down Expand Up @@ -134,6 +135,11 @@ type EksDRelease struct {
Containerd Archive `json:"containerd,omitempty"`
}

// UpgraderBundle is a In-place Kubernetes version upgrader bundle.
type UpgraderBundle struct {
Upgrader Image `json:"upgrader"`
}

type OSImageBundle struct {
Bottlerocket Archive `json:"bottlerocket,omitempty"`
}
Expand Down
17 changes: 17 additions & 0 deletions release/api/v1alpha1/zz_generated.deepcopy.go

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

22 changes: 22 additions & 0 deletions release/cli/pkg/assets/config/bundle_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,28 @@ var bundleReleaseAssetsConfigMap = []assettypes.AssetConfig{
"projectPath",
},
},
// Upgrader artifacts
{
ProjectName: "upgrader",
ProjectPath: "projects/aws/upgrader",
GitTagAssigner: tagger.NonExistentTagAssigner,
Images: []*assettypes.Image{
{
RepoName: "upgrader",
ImageTagConfiguration: assettypes.ImageTagConfiguration{
NonProdSourceImageTagFormat: "v<eksDReleaseChannel>-<eksDReleaseNumber>",
ProdSourceImageTagFormat: "v<eksDReleaseChannel>-<eksDReleaseNumber>",
ReleaseImageTagFormat: "v<eksDReleaseChannel>-<eksDReleaseNumber>",
},
},
},
ImageTagOptions: []string{
"eksDReleaseChannel",
"eksDReleaseNumber",
"gitTag",
},
HasReleaseBranches: true,
},
}

func GetBundleReleaseAssetsConfigMap() []assettypes.AssetConfig {
Expand Down
6 changes: 6 additions & 0 deletions release/cli/pkg/bundles/bundles.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ func GetVersionsBundles(r *releasetypes.ReleaseConfig, imageDigests map[string]s
return nil, errors.Wrapf(err, "Error getting bundle for Snow infrastructure provider")
}

upgraderBundle, err := GetUpgraderBundle(r, channel, imageDigests)
if err != nil {
return nil, errors.Wrapf(err, "Error getting upgrader bundle for eks-d %s release", channel)
}

versionsBundle := anywherev1alpha1.VersionsBundle{
KubeVersion: shortKubeVersion,
EksD: eksDReleaseBundle,
Expand All @@ -199,6 +204,7 @@ func GetVersionsBundles(r *releasetypes.ReleaseConfig, imageDigests map[string]s
Haproxy: haproxyBundle,
Snow: snowBundle,
Nutanix: nutanixBundle,
Upgrader: upgraderBundle,
}
versionsBundles = append(versionsBundles, versionsBundle)
}
Expand Down
48 changes: 48 additions & 0 deletions release/cli/pkg/bundles/upgrader.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright Amazon.com Inc. or its affiliates. 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.

package bundles

import (
"fmt"

anywherev1alpha1 "github.com/aws/eks-anywhere/release/api/v1alpha1"
releasetypes "github.com/aws/eks-anywhere/release/cli/pkg/types"
)

func GetUpgraderBundle(r *releasetypes.ReleaseConfig, eksDReleaseChannel string, imageDigests map[string]string) (anywherev1alpha1.UpgraderBundle, error) {
artifacts := r.BundleArtifactsTable[fmt.Sprintf("upgrader-%s", eksDReleaseChannel)]
bundleImageArtifacts := map[string]anywherev1alpha1.Image{}

for _, artifact := range artifacts {
if artifact.Image != nil {
imageArtifact := artifact.Image
bundleImageArtifact := anywherev1alpha1.Image{
Name: imageArtifact.AssetName,
Description: fmt.Sprintf("Container image for %s image", imageArtifact.AssetName),
OS: imageArtifact.OS,
Arch: imageArtifact.Arch,
URI: imageArtifact.ReleaseImageURI,
ImageDigest: imageDigests[imageArtifact.ReleaseImageURI],
}
bundleImageArtifacts[imageArtifact.AssetName] = bundleImageArtifact
}
}

bundle := anywherev1alpha1.UpgraderBundle{
Upgrader: bundleImageArtifacts["upgrader"],
}

return bundle, nil
}
1 change: 1 addition & 0 deletions release/cli/pkg/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
KindProjectPath = "projects/kubernetes-sigs/kind"
KubeRbacProxyProjectPath = "projects/brancz/kube-rbac-proxy"
PackagesProjectPath = "projects/aws/eks-anywhere-packages"
UpgraderProjectPath = "projects/aws/upgrader"

// Date format with standard reference time values
// The reference time used is the specific time stamp:
Expand Down
14 changes: 7 additions & 7 deletions release/cli/pkg/operations/bundle_release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ func TestGenerateBundleManifest(t *testing.T) {
testName: "Dev-release from main",
buildRepoBranchName: "main",
cliRepoBranchName: "main",
cliMinVersion: "v0.17.0",
cliMaxVersion: "v0.17.0",
cliMinVersion: "v0.18.0",
cliMaxVersion: "v0.18.0",
},
{
testName: "Dev-release from release-0.17",
buildRepoBranchName: "release-0.17",
cliRepoBranchName: "release-0.17",
cliMinVersion: "v0.17.0",
cliMaxVersion: "v0.17.0",
testName: "Dev-release from release-0.18",
buildRepoBranchName: "release-0.18",
cliRepoBranchName: "release-0.18",
cliMinVersion: "v0.18.0",
cliMaxVersion: "v0.18.0",
},
}

Expand Down
Loading

0 comments on commit 4922ca1

Please sign in to comment.