Skip to content

Commit

Permalink
Add upgrader image to the version bundle
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Ganesh <rahulgab@amazon.com>
  • Loading branch information
Rahul Ganesh committed Nov 22, 2023
1 parent 7f767dc commit 6a242aa
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
7 changes: 7 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,12 @@ type EksDRelease struct {
Containerd Archive `json:"containerd,omitempty"`
}

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

type OSImageBundle struct {
Bottlerocket Archive `json:"bottlerocket,omitempty"`
}
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: upgrader,
}
versionsBundles = append(versionsBundles, versionsBundle)
}
Expand Down
47 changes: 47 additions & 0 deletions release/cli/pkg/bundles/upgrader.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// 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 (
releasetypes "github.com/aws/eks-anywhere/release/cli/pkg/types"
anywherev1alpha1 "github.com/aws/eks-anywhere/release/api/v1alpha1"
)

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{
Version: version,
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

0 comments on commit 6a242aa

Please sign in to comment.