Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add upgrader image to the version bundle #7082

Merged
merged 4 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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