Skip to content

Commit

Permalink
Print release version in get cluster (#1399)
Browse files Browse the repository at this point in the history
* Add Release information to `get cluster` from release label

Obtain data from the Cluster CR.

Signed-off-by: Matias Charriere <matias@giantswarm.io>

* Make the default provider the generic ProviderDefault

OpenStack is not supported anymore.

Signed-off-by: Matias Charriere <matias@giantswarm.io>

* update changelog

Signed-off-by: Matias Charriere <matias@giantswarm.io>

* Fix tests

Signed-off-by: Matias Charriere <matias@giantswarm.io>

---------

Signed-off-by: Matias Charriere <matias@giantswarm.io>
  • Loading branch information
mcharriere authored Aug 12, 2024
1 parent 447ac09 commit d0c4f15
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project's packages adheres to [Semantic Versioning](http://semver.org/s

- Use more portable, Bash specific shebang for GitOps pre-commit script template
- Schedule cluster upgrades for CAPI clusters.
- Print Release information in `get cluster` command.

## [3.1.0] - 2024-07-23

Expand Down
2 changes: 2 additions & 0 deletions cmd/get/clusters/provider/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func GetCommonClusterTable(clusterResource cluster.Resource) *metav1.Table {
{Name: "Name", Type: "string"},
{Name: "Age", Type: "string", Format: "date-time"},
{Name: "Condition", Type: "string"},
{Name: "Release", Type: "string"},
{Name: "Service Priority", Type: "string"},
{Name: "Organization", Type: "string"},
{Name: "Description", Type: "string"},
Expand Down Expand Up @@ -98,6 +99,7 @@ func getCommonClusterRow(c cluster.Cluster) metav1.TableRow {
c.Cluster.GetName(),
output.TranslateTimestampSince(c.Cluster.CreationTimestamp),
getLatestCondition(c.Cluster.GetConditions()),
c.Cluster.Labels[label.ReleaseVersion],
getClusterServicePriority(c.Cluster),
c.Cluster.Labels[label.Organization],
getClusterDescription(c.Cluster),
Expand Down
1 change: 1 addition & 0 deletions internal/key/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const (
ProviderOpenStack = "openstack"
ProviderVSphere = "vsphere"
ProviderCloudDirector = "cloud-director"
ProviderDefault = "default"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/commonconfig/commonconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (cc *CommonConfig) GetProviderFromConfig(ctx context.Context, athenaUrl str
case capaRegexp.MatchString(config.Host):
provider = key.ProviderCAPA
default:
provider = key.ProviderOpenStack
provider = key.ProviderDefault
}

return provider, nil
Expand Down
20 changes: 5 additions & 15 deletions pkg/commonconfig/commonconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,19 @@ func TestCommonConfig_GetProviderFromInstallation(t *testing.T) {
expectedResult: key.ProviderAzure,
},
{
name: "case 2: AWS url",
name: "case 2: AWS URL",
k8sApiURL: "https://g8s.test.eu-west-1.aws.coolio.com",
expectedResult: key.ProviderAWS,
},
{
name: "case 3: Azure url",
name: "case 3: Azure URL",
k8sApiURL: "https://g8s.test.eu-west-1.azure.coolio.com",
expectedResult: key.ProviderAzure,
},
{
name: "case 4: OpenStack url",
k8sApiURL: "https://test12.customer.coolio.com",
expectedResult: key.ProviderOpenStack,
},
{
name: "case 5: URL containing 'aws', but not AWS",
k8sApiURL: "https://aws12.customer.coolio.com",
expectedResult: key.ProviderOpenStack,
},
{
name: "case 6: URL containing 'azure', but not Azure",
k8sApiURL: "https://azure12.customer.coolio.com",
expectedResult: key.ProviderOpenStack,
name: "case 4: Teleport URL",
k8sApiURL: "https://teleport.coolio.io",
expectedResult: key.ProviderDefault,
},
}

Expand Down

0 comments on commit d0c4f15

Please sign in to comment.