Skip to content

Commit

Permalink
Merge branch 'master' into akstest
Browse files Browse the repository at this point in the history
  • Loading branch information
gejain committed Aug 26, 2024
2 parents 9d9bbc3 + b0cb9bd commit 293dd09
Show file tree
Hide file tree
Showing 104 changed files with 8,165 additions and 1,675 deletions.
6 changes: 5 additions & 1 deletion drivers/scheduler/openshift/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,12 @@ func (k *openshift) createTorpedoSecurityContextConstraints() (*ocpsecurityv1api
func updateMaxUnavailableWorkerMCP() error {

maxUnavailable := os.Getenv("OCP_SURGE_UPGRADE_VALUE")
if maxUnavailable == "" {
log.Warnf("OCP_SURGE_UPGRADE_VALUE is not set!")
return nil
}
log.Info("Setting maxUnavailable value for worker MCP to [%s]", maxUnavailable)
patchData := fmt.Sprintf(`{"spec":{"maxUnavailable":"%s"}}`, maxUnavailable)
patchData := fmt.Sprintf(`{"spec":{"maxUnavailable":%s}}`, maxUnavailable)

t := func() (interface{}, bool, error) {
var output []byte
Expand Down
19 changes: 10 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/fatih/color v1.15.0
github.com/gambol99/go-marathon v0.7.1
github.com/gin-gonic/gin v1.9.1
github.com/go-sql-driver/mysql v1.6.0
github.com/go-sql-driver/mysql v1.7.1
github.com/gofrs/flock v0.8.1
github.com/golang/protobuf v1.5.4
github.com/google/gnostic v0.6.9
Expand All @@ -29,16 +29,16 @@ require (
github.com/libopenstorage/autopilot-api v1.3.0
github.com/libopenstorage/cloudops v0.0.0-20240528100711-6310e05a2c40
github.com/libopenstorage/openstorage v9.4.47+incompatible
github.com/libopenstorage/operator v0.0.0-20240802175229-8081f09777ed
github.com/libopenstorage/operator v0.0.0-20240812060935-09fcd70d5bcc
github.com/libopenstorage/stork v1.4.1-0.20240424105137-8c6fa2a3f934
github.com/onsi/gomega v1.31.1
github.com/openshift/api v0.0.0-20230503133300-8bbcb7ca7183
github.com/oracle/oci-go-sdk/v65 v65.13.1
github.com/pborman/uuid v1.2.1
github.com/pkg/errors v0.9.1
github.com/portworx/pds-api-go-client v0.0.0-20231102112445-993d38984eae
github.com/portworx/px-backup-api v1.2.2-0.20240729062819-401f4e76b979
github.com/portworx/sched-ops v1.20.4-rc1.0.20240625095951-0b38bc239d01
github.com/portworx/px-backup-api v1.2.2-0.20240821050917-42a94580098f
github.com/portworx/sched-ops v1.20.4-rc1.0.20240731224434-94e4e354c4b2
github.com/portworx/talisman v1.1.3
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.63.0
github.com/prometheus/client_golang v1.17.0
Expand Down Expand Up @@ -103,15 +103,15 @@ require (
github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect
github.com/hashicorp/cronexpr v1.1.2 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.11.0 // indirect
github.com/jackc/pgconn v1.12.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.2.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect
github.com/jackc/pgtype v1.10.0 // indirect
github.com/jackc/pgtype v1.11.0 // indirect
github.com/k8snetworkplumbingwg/network-attachment-definition-client v0.0.0-20191119172530-79f836b90111 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808 // indirect
github.com/montanaflynn/stats v0.7.0 // indirect
github.com/oklog/ulid v1.3.1 // indirect
github.com/openshift/custom-resource-status v1.1.2 // indirect
github.com/portworx/kdmp v0.4.1-0.20240327131138-e0fa03f5a66c // indirect
Expand Down Expand Up @@ -147,7 +147,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/eks v1.39.2
github.com/devans10/pugo/flasharray v0.0.0-20230602184138-1a5d930c950e
github.com/hashicorp/nomad/api v0.0.0-20240209231933-e2bfdf0c1034
github.com/jackc/pgx/v4 v4.15.0
github.com/jackc/pgx/v4 v4.16.1
github.com/jetstack/cert-manager v1.7.3
github.com/onsi/ginkgo/v2 v2.15.0
github.com/tektoncd/pipeline v0.56.0
Expand Down Expand Up @@ -392,6 +392,7 @@ replace (

// PX dependencies
github.com/libopenstorage/openstorage => github.com/libopenstorage/openstorage v1.0.1-0.20240618001010-e4b050e66115
github.com/portworx/sched-ops => github.com/portworx/sched-ops v1.20.4-rc1.0.20240812234304-948bf116243e

// Stork dependencies
//github.com/libopenstorage/stork => github.com/libopenstorage/stork v1.4.1-0.20230330233319-e17ea1b3fd81
Expand Down
2,146 changes: 1,990 additions & 156 deletions go.sum

Large diffs are not rendered by default.

43 changes: 14 additions & 29 deletions pkg/asyncdr/asyncdr.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package asyncdr

import (
"encoding/json"
"flag"
"fmt"
"io/ioutil"
"os"
Expand Down Expand Up @@ -762,7 +761,7 @@ func CheckDefaultPxStorageClass(name string) error {
return nil
}

func ChangePxServiceToLoadBalancer(internalLB bool) error {
func ChangePxServiceToLoadBalancer(internalLB bool, storageDriverName string, pxStc *opcorev1.StorageCluster) error {
// Check if service is already of type loadbalancer
const (
pxStcServiceTypeKey = "portworx.io/service-type"
Expand All @@ -783,22 +782,14 @@ func ChangePxServiceToLoadBalancer(internalLB bool) error {
if err != nil {
return fmt.Errorf("failed to get portworx service before changing it to load balancer: %v", err)
}
log.Infof("Current Service Type is %v, pxService.Spec.Type")
log.Infof("Current Service Type is %s, pxService.Spec.Type")
if pxService.Spec.Type == v1.ServiceTypeLoadBalancer {
log.InfoD("portworx service is already of type LoadBalancer")
return nil
}

storageDriverName := flag.Lookup("storage-driver").Value.(flag.Getter).Get().(string)
log.Infof("Storage driver name: %v", storageDriverName)

if storageDriverName == storkdriver.PortworxDriverName {
stc, err := operator.Instance().ListStorageClusters(pxNamespace)
if err != nil {
return fmt.Errorf("failed to list PX storage cluster on EKS/AKS/GKE: %v", err)
}
if len(stc.Items) > 0 {
pxStc := (*stc).Items[0]
if pxStc != nil {
// Change portworx service to LoadBalancer, since this is an EKS/AKS/GKE with PX operator install for Portworx
if pxStc.ObjectMeta.Annotations == nil {
pxStc.ObjectMeta.Annotations = make(map[string]string)
Expand All @@ -824,7 +815,7 @@ func ChangePxServiceToLoadBalancer(internalLB bool) error {
pxStc.Spec.Metadata.Annotations[pxStcServiceKey][awsNLBTargetTypeKey] = awsNLBTargetTypeVal
pxStc.Spec.Metadata.Annotations[pxStcServiceKey][awsLBSubnetKey] = os.Getenv("LB_SUBNET_KEY")
}
_, err = operator.Instance().UpdateStorageCluster(&pxStc)
_, err = operator.Instance().UpdateStorageCluster(pxStc)

if err != nil {
return fmt.Errorf("failed to update PX service type to LoadBalancer on EKS: %v", err)
Expand All @@ -849,22 +840,16 @@ func ChangePxServiceToLoadBalancer(internalLB bool) error {
return nil
}

func IsCloud(portworxNs string) (bool, string) {
stc, err := operator.Instance().ListStorageClusters(portworxNs)
if len(stc.Items) > 0 && err == nil {
log.InfoD("Storage cluster name: %s", stc.Items[0].Name)
if len(stc.Items) > 0 {
if oputils.IsEKS(&stc.Items[0]) {
log.InfoD("EKS installation detected.")
return true, "eks"
} else if oputils.IsAKS(&stc.Items[0]) {
log.InfoD("AKS installation detected.")
return true, "aks"
} else if oputils.IsGKE(&stc.Items[0]) {
log.InfoD("GKE installation detected.")
return true, "gke"
}
}
func IsCloud(stc *opcorev1.StorageCluster) (bool, string) {
if oputils.IsEKS(stc) {
log.InfoD("EKS installation detected.")
return true, "eks"
} else if oputils.IsAKS(stc) {
log.InfoD("AKS installation detected.")
return true, "aks"
} else if oputils.IsGKE(stc) {
log.InfoD("GKE installation detected.")
return true, "gke"
}
return false, ""
}
12 changes: 8 additions & 4 deletions tests/basic/async_dr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,13 +1015,17 @@ func validateFailoverFailback(clusterType, taskNamePrefix string, single, skipSo
"kubeconfig": kubeConfigPathSrc,
}

isCloud, cloudName := asyncdr.IsCloud()
stc, err := Inst().V.GetDriver()
log.FailOnError(err, "Failed to get driver")

isCloud, cloudName := asyncdr.IsCloud(stc)
var srcEp, destEp string
extraArgsCp := map[string]string{}
const defaultPort = "9001"

if isCloud {
if err = asyncdr.ChangePxServiceToLoadBalancer(false); err != nil {
storageDriverName := Inst().V.String()
if err = asyncdr.ChangePxServiceToLoadBalancer(false, storageDriverName, stc); err != nil {
log.FailOnError(err, "failed to change PX service to LoadBalancer on source cluster")
}
if cloudName == "eks" {
Expand All @@ -1031,7 +1035,7 @@ func validateFailoverFailback(clusterType, taskNamePrefix string, single, skipSo
}
err = SetDestinationKubeConfig()
log.FailOnError(err, "Failed to set destination kubeconfig")
if err = asyncdr.ChangePxServiceToLoadBalancer(false); err != nil {
if err = asyncdr.ChangePxServiceToLoadBalancer(false, storageDriverName, stc); err != nil {
log.FailOnError(err, "failed to change PX service to LoadBalancer on destination cluster")
}
if cloudName == "eks" {
Expand Down Expand Up @@ -1651,7 +1655,7 @@ func patchClusterPair(cpName, cpNs, configPath string) error {
log.Infof("Running command: %v", cmd)
_, err = exec.Command("sh", "-c", cmd).CombinedOutput()
if err != nil {
log.Infof("Error running command: %v and err is: %v", cmd, err)
log.Errorf("Error running command: %v and err is: %v", cmd, err)
return err
}
return nil
Expand Down
9 changes: 9 additions & 0 deletions vendor/github.com/go-sql-driver/mysql/AUTHORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions vendor/github.com/go-sql-driver/mysql/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 16 additions & 5 deletions vendor/github.com/go-sql-driver/mysql/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions vendor/github.com/go-sql-driver/mysql/atomic_bool.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 293dd09

Please sign in to comment.