-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eliminate KopsCluster, rework KopsMetadata
Fix a bug that caused the kops name to deviate from the cluster id, ultimately failing to setup the ALB correctly. I didn't test these changes last night ;P Rework the KopsCluster structure into just a KopsMetadata structure. I think I was being too clever, and it's easier to be explicit here.
- Loading branch information
1 parent
2915005
commit 966e5b0
Showing
7 changed files
with
215 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package provisioner | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
// KopsMetadata is the provisioner metadata stored in a store.Cluster. | ||
type KopsMetadata struct { | ||
Name string | ||
} | ||
|
||
// NewKopsMetadata creates an instance of KopsMetadata given the raw provisioner metadata. | ||
func NewKopsMetadata(provisionerMetadata []byte) *KopsMetadata { | ||
kopsMetadata := KopsMetadata{} | ||
|
||
if provisionerMetadata == nil { | ||
return &kopsMetadata | ||
} | ||
|
||
_ = json.Unmarshal(provisionerMetadata, &kopsMetadata) | ||
|
||
return &kopsMetadata | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package provisioner | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestNewKopsMetadata(t *testing.T) { | ||
kopsMetadata := NewKopsMetadata(nil) | ||
require.Equal(t, "", kopsMetadata.Name) | ||
|
||
kopsMetadata = NewKopsMetadata([]byte(`{"Name": "name"}`)) | ||
require.Equal(t, "name", kopsMetadata.Name) | ||
} |
Oops, something went wrong.