Skip to content

Commit

Permalink
Merge pull request #95 from syseleven/K8S-9040_fix_password_update
Browse files Browse the repository at this point in the history
K8s-9040 fix password update
  • Loading branch information
squ94wk authored Jan 17, 2024
2 parents 0e27052 + 6601d33 commit e582123
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 48 deletions.
8 changes: 4 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ env:
artifacts:
paths:
- test.env
only:
- master
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /k8s-.*/ || $CI_PIPELINE_SOURCE == "web"

test:
stage: test
Expand All @@ -51,5 +51,5 @@ test:
- TF_ACC=1 go test ./metakube -v -timeout 3h --parallel 10 -run TestAcc
needs:
- env
only:
- master
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /k8s-.*/ || $CI_PIPELINE_SOURCE == "web"
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ testacc:
# METAKUBE_AWS_SUBNET_ID
# METAKUBE_AWS_AVAILABILITY_ZONE
# METAKUBE_AWS_DISK_SIZE
go clean -testcache
TF_ACC=1 go test ./$(PKG_NAME) -v -timeout 120m -parallel 10 $(TESTARGS)

sweep:
Expand Down
8 changes: 4 additions & 4 deletions metakube/resource_cluster_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,23 +604,23 @@ func expandOpenstackCloudSpec(p []interface{}, include func(string) bool) *model
if v, ok := in["user_credentials"]; ok {
if vv, ok := v.([]interface{}); ok && len(vv) > 0 && vv[0] != nil {
if m, ok := vv[0].(map[string]interface{}); ok {
if v, ok := m["username"]; ok && include("user_credentials.0.username") {
if v, ok := m["username"]; ok {
if vv, ok := v.(string); ok && vv != "" {
obj.Username = vv
}
}
if v, ok := m["password"]; ok && include("user_credentials.0.password") {
if v, ok := m["password"]; ok {
if vv, ok := v.(string); ok && vv != "" {
obj.Password = vv
}
}
if v, ok := m["project_id"]; ok && include("user_credentials.0.project_id") {
if v, ok := m["project_id"]; ok {
if vv, ok := v.(string); ok && vv != "" {
obj.ProjectID = vv
}
}

if v, ok := m["project_name"]; ok && include("user_credentials.0.project_name") {
if v, ok := m["project_name"]; ok {
if vv, ok := v.(string); ok && vv != "" {
obj.Project = vv
}
Expand Down
41 changes: 1 addition & 40 deletions metakube/resource_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,7 @@ func TestAccMetakubeCluster_Openstack_Basic(t *testing.T) {
if err := clusterOpenstackBasicTemplate.Execute(&config2, data2); err != nil {
t.Fatal(err)
}
// Uncomment this block once cilium reconciliation is done.
// data4 := *data
// data4.Name += "-cilium"
// data4.CNIPlugin = "cilium"
// var config4 strings.Builder
// if err := clusterOpenstackBasicTemplate.Execute(&config4, data4); err != nil {
// t.Fatal(err)
// }

t.Log("Generated randomname: ", data.Name)
resource.Test(t, resource.TestCase{
PreCheck: func() {
Expand Down Expand Up @@ -161,38 +154,6 @@ func TestAccMetakubeCluster_Openstack_Basic(t *testing.T) {
resource.TestCheckResourceAttrSet(resourceName, "deletion_timestamp"),
),
},
// Uncomment this block once cilium reconciliation is done.
// {
// Config: config4.String(),
// Check: resource.ComposeAggregateTestCheckFunc(
// testAccCheckMetaKubeClusterExists(&cluster),
// testAccCheckMetaKubeClusterOpenstackAttributes(&cluster, data4.Name, data4.DatacenterName, data4.Version, false),
// resource.TestCheckResourceAttr(resourceName, "dc_name", data4.DatacenterName),
// resource.TestCheckResourceAttr(resourceName, "name", data4.Name),
// resource.TestCheckResourceAttr(resourceName, "labels.%", "2"),
// resource.TestCheckResourceAttr(resourceName, "labels.a", "b"),
// resource.TestCheckResourceAttr(resourceName, "labels.c", "d"),
// resource.TestCheckResourceAttr(resourceName, "spec.#", "1"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.version", data.Version),
// resource.TestCheckResourceAttr(resourceName, "spec.0.update_window.0.start", "Tue 02:00"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.update_window.0.length", "2h"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.services_cidr", "10.240.16.0/18"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.pods_cidr", "172.25.0.0/18"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.cni_plugin.#", "1"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.cni_plugin.0.type", "cilium"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.cloud.#", "1"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.cloud.0.aws.#", "0"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.cloud.0.openstack.#", "1"),
// resource.TestCheckResourceAttrSet(resourceName, "spec.0.cloud.0.openstack.0.security_group"),
// resource.TestCheckResourceAttrSet(resourceName, "spec.0.cloud.0.openstack.0.network"),
// resource.TestCheckResourceAttrSet(resourceName, "spec.0.cloud.0.openstack.0.subnet_id"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.cloud.0.openstack.0.subnet_cidr", "192.168.2.0/24"),
// resource.TestCheckResourceAttrSet(resourceName, "kube_config"),
// resource.TestCheckResourceAttr(resourceName, "spec.0.audit_logging", "false"),
// resource.TestCheckResourceAttrSet(resourceName, "creation_timestamp"),
// resource.TestCheckResourceAttrSet(resourceName, "deletion_timestamp"),
// ),
// },
{
ResourceName: resourceName,
ImportState: true,
Expand Down

0 comments on commit e582123

Please sign in to comment.