Skip to content

Commit

Permalink
Updating KubeConfig secret (#250)
Browse files Browse the repository at this point in the history
* Updating KubeConfig secret

* Adding support for cluster id
  • Loading branch information
ljakimczuk committed Apr 25, 2024
1 parent 77afa3d commit a58b1e6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add support for Cluster ID selector.

### Changed

- PSP CR installation put under global scope
- Place KubeConfig under the `value` key in the secret in addition.

## [1.3.0] - 2023-11-10

Expand Down
17 changes: 13 additions & 4 deletions apptest.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,22 @@ func (a *AppSetup) createApps(ctx context.Context, apps []App) error {
return microerror.Mask(err)
}
}

labels := map[string]string{
label.AppKubernetesName: app.Name,
}

if app.ClusterID != "" {
labels[label.Cluster] = app.ClusterID
} else {
labels[label.AppOperatorVersion] = appOperatorVersion
}

appCR := &v1alpha1.App{
ObjectMeta: metav1.ObjectMeta{
Name: appCRName,
Namespace: appCRNamespace,
Labels: map[string]string{
label.AppOperatorVersion: appOperatorVersion,
label.AppKubernetesName: app.Name,
},
Labels: labels,
},
Spec: v1alpha1.AppSpec{
Catalog: app.CatalogName,
Expand Down Expand Up @@ -482,6 +490,7 @@ func (a *AppSetup) createKubeConfigSecret(ctx context.Context, name, namespace,

data := map[string][]byte{
"kubeConfig": []byte(kubeConfig),
"value": []byte(kubeConfig),
}
desired := &corev1.Secret{
Data: data,
Expand Down
1 change: 1 addition & 0 deletions spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type App struct {
AppOperatorVersion string
CatalogName string
CatalogURL string
ClusterID string
KubeConfig string
Name string
Namespace string
Expand Down

0 comments on commit a58b1e6

Please sign in to comment.