Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PWX-28826 & PWX-30496: Pre-flight check for DMthin #1021

Merged
merged 19 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
507802a
PWX-29973 Add check result to StorageNode CRD (#992)
harsh-px Mar 23, 2023
fed2cdd
[PWX-25353][PWX-25355] Auto detect eks cloud environment and check cl…
jrivera-px Apr 24, 2023
e10aa6d
[PWX-27619] Update cloudops vendor for EKS dry run
pure-jliao Nov 7, 2022
9d64ac7
[PWX-27619] Use dry run for eks cloud permission check
pure-jliao Nov 7, 2022
6d82f02
[PWX-27621] Fix cluster status issue after running preflight
pure-jliao Nov 9, 2022
ca21303
[PWX-25354] Set default cloud storage spec on EKS
pure-jliao Oct 26, 2022
ee7eb06
PWX-27656: auto-ssl support (resync w/ DaemonSet) (#826)
zoxpx Nov 17, 2022
298ee70
[PWX-27588] Add support for EKS cloud storage capacity based configur…
pure-jliao Dec 8, 2022
180b94c
[PWX-27622] Use provided AWS credentials to run permission check on EKS
pure-jliao Jan 18, 2023
20faae0
[PWX-28664] Unset AWS credential env vars after client creation
pure-jliao Feb 2, 2023
32b0db1
PWX-29973 Add check result to StorageNode CRD (#992)
harsh-px Mar 23, 2023
64ae37b
[PWX-27765] StorageCluster status redesign to show more details
pure-jliao Nov 14, 2022
ba025c9
PWX-28826: Handle pre-flight check for DMthin (#1014)
jrivera-px Apr 17, 2023
f5e6e8f
PWX-30496: if '-T dmthin' exists in stc before preflight is ran and …
jrivera-px Apr 18, 2023
57873a2
Fix test broken when merged in pre-flight code.
jrivera-px Apr 25, 2023
1a2aaf3
Merge branch 'px-rel-23.4.0' into pre-check-px-rel-23.4.0
jrivera-px Apr 25, 2023
53a87dc
PWX-28826 & PWX-30496: Add ClusterCondition Source to test runs.
jrivera-px Apr 25, 2023
e1fc287
Merge branch 'px-rel-23.5.0' into pre-check-px-rel-23.4.0
piyush-nimbalkar Apr 26, 2023
683cc7c
[PWX-27765] Fix migration status update issue
pure-jliao Dec 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ mockgen: $(GOPATH)/bin/gomock $(GOPATH)/bin/mockgen
mockgen -destination=pkg/mock/controllermanager.mock.go -package=mock sigs.k8s.io/controller-runtime/pkg/manager Manager
mockgen -destination=pkg/mock/controller.mock.go -package=mock sigs.k8s.io/controller-runtime/pkg/controller Controller
mockgen -destination=pkg/mock/controllercache.mock.go -package=mock sigs.k8s.io/controller-runtime/pkg/cache Cache
mockgen -destination=pkg/mock/preflight.mock.go -package=mock github.com/libopenstorage/operator/pkg/preflight CheckerOps

clean: clean-release-manifest clean-bundle
@echo "Cleaning up binaries"
Expand Down
7 changes: 6 additions & 1 deletion cmd/operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
_ "github.com/libopenstorage/operator/pkg/log"
"github.com/libopenstorage/operator/pkg/migration"
"github.com/libopenstorage/operator/pkg/operator-sdk/metrics"
"github.com/libopenstorage/operator/pkg/preflight"
"github.com/libopenstorage/operator/pkg/version"
)

Expand Down Expand Up @@ -228,7 +229,11 @@ func run(c *cli.Context) {
log.Warnf("Failed to expose metrics port: %v", err)
}

if err = d.Init(mgr.GetClient(), mgr.GetScheme(), mgr.GetEventRecorderFor(storagecluster.ControllerName)); err != nil {
if err := preflight.InitPreflightChecker(mgr.GetClient()); err != nil {
log.Fatalf("Error initializing preflight checker: %v", err)
}

if err := d.Init(mgr.GetClient(), mgr.GetScheme(), mgr.GetEventRecorderFor(storagecluster.ControllerName)); err != nil {
log.Fatalf("Error initializing Storage driver %v: %v", driverName, err)
}

Expand Down
14 changes: 12 additions & 2 deletions deploy/crds/core_v1_storagecluster_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3792,6 +3792,9 @@ spec:
description: Phase of the StorageCluster is a simple, high-level summary of where the
StorageCluster is in its lifecycle. The condition array contains more detailed
information about the state of the cluster.
reason:
type: string
description: CamelCase messages split with commas indicating details about why the StorageCluster is in this state.
collisionCount:
type: integer
format: int32
Expand Down Expand Up @@ -3879,16 +3882,23 @@ spec:
items:
type: object
properties:
source:
type: string
description: Name of the component.
type:
type: string
description: Type of the condition.
status:
type: string
description: Status of the condition.
reason:
message:
type: string
description: Reason is human readable message indicating details about the current
description: Message is human readable message indicating details about the current
state of the cluster.
lastTransitionTime:
type: string
format: date-time
description: Time at which the condition changed.
- name: v1alpha1
served: false
storage: false
Expand Down
15 changes: 15 additions & 0 deletions deploy/crds/core_v1_storagenode_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,21 @@ spec:
type: string
format: date-time
description: Time at which the condition changed.
checks:
type: array
description: Contains list of pre or post flight checks that are performed by the Operator
items:
type: object
properties:
type:
type: string
description: Type of the check.
reason:
type: string
description: Reason for success or failure of the check
success:
type: boolean
description: If true, the check was successful
geography:
type: object
description: Contains topology information for the storage node.
Expand Down
3 changes: 3 additions & 0 deletions drivers/storage/portworx/cloud_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import (
// importing azure cloud provider so that it registers itself
// as a provider of the StorageManager interface
_ "github.com/libopenstorage/cloudops/azure/storagemanager"
// importing aws cloud provider so that it registers itself
// as a provider of the StorageManager interface
_ "github.com/libopenstorage/cloudops/aws/storagemanager"
corev1 "github.com/libopenstorage/operator/pkg/apis/core/v1"
"github.com/libopenstorage/operator/pkg/cloudstorage"
v1 "k8s.io/api/core/v1"
Expand Down
2 changes: 1 addition & 1 deletion drivers/storage/portworx/component/disruption_budget.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c *disruptionBudget) IsEnabled(cluster *corev1.StorageCluster) bool {
}

func (c *disruptionBudget) Reconcile(cluster *corev1.StorageCluster) error {
if cluster.Status.Phase == "" || cluster.Status.Phase == string(corev1.ClusterInit) {
if pxutil.IsFreshInstall(cluster) {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/storage/portworx/component/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ func (c *security) closeSdkConn() {
}

func (c *security) updateSystemGuestRole(cluster *corev1.StorageCluster) error {
if cluster.Status.Phase == "" || cluster.Status.Phase == string(corev1.ClusterInit) {
if pxutil.IsFreshInstall(cluster) {
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ package component
import (
"context"
"fmt"
"reflect"
"strconv"

"github.com/hashicorp/go-version"
ocp_secv1 "github.com/openshift/api/security/v1"
"github.com/sirupsen/logrus"
Expand All @@ -12,9 +15,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/tools/record"
"reflect"
"sigs.k8s.io/controller-runtime/pkg/client"
"strconv"

"k8s.io/apimachinery/pkg/types"

Expand Down
21 changes: 11 additions & 10 deletions drivers/storage/portworx/components_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4234,8 +4234,9 @@ func TestGuestAccessSecurity(t *testing.T) {
err = driver.PreInstall(cluster)
require.NoError(t, err)

// GuestAccess disabled but hould not call update as cluster is still initializing
cluster.Status.Phase = string(corev1.ClusterInit)
// GuestAccess disabled but should not call update as cluster is still initializing
cluster.Status.Phase = string(corev1.ClusterStateInit)

mockRoleServer.EXPECT().
Inspect(gomock.Any(), &osdapi.SdkRoleInspectRequest{
Name: component.SecuritySystemGuestRoleName,
Expand All @@ -4248,7 +4249,7 @@ func TestGuestAccessSecurity(t *testing.T) {

// Disable GuestAccess. Should expect an update to be called.
cluster.Spec.Security.Auth.GuestAccess = guestAccessTypePtr(corev1.GuestRoleDisabled)
cluster.Status.Phase = string(corev1.ClusterOnline)
cluster.Status.Phase = string(corev1.ClusterStateRunning)
inspectedRole := component.GuestRoleEnabled
inspectedRoleResp := &osdapi.SdkRoleInspectResponse{
Role: &inspectedRole,
Expand Down Expand Up @@ -11081,7 +11082,7 @@ func TestPodDisruptionBudgetEnabled(t *testing.T) {
Namespace: "kube-test",
},
Status: corev1.StorageClusterStatus{
Phase: string(corev1.ClusterOnline),
Phase: string(corev1.ClusterStateRunning),
},
}

Expand Down Expand Up @@ -11281,7 +11282,7 @@ func TestPodDisruptionBudgetWithMetroDR(t *testing.T) {
},
},
Status: corev1.StorageClusterStatus{
Phase: string(corev1.ClusterOnline),
Phase: string(corev1.ClusterStateRunning),
},
}

Expand Down Expand Up @@ -11343,7 +11344,7 @@ func TestPodDisruptionBudgetWithDifferentKvdbClusterSize(t *testing.T) {
Namespace: "kube-test",
},
Status: corev1.StorageClusterStatus{
Phase: string(corev1.ClusterOnline),
Phase: string(corev1.ClusterStateRunning),
},
}

Expand Down Expand Up @@ -11519,7 +11520,7 @@ func TestPodDisruptionBudgetDuringInitialization(t *testing.T) {
require.Empty(t, pdbList.Items)

// TestCase: Do not create PDB if the cluster is initializing
cluster.Status.Phase = string(corev1.ClusterInit)
cluster.Status.Phase = string(corev1.ClusterStateInit)

err = driver.PreInstall(cluster)
require.NoError(t, err)
Expand All @@ -11530,7 +11531,7 @@ func TestPodDisruptionBudgetDuringInitialization(t *testing.T) {
require.Empty(t, pdbList.Items)

// TestCase: Create PDBs when cluster is done initializing
cluster.Status.Phase = string(corev1.ClusterOnline)
cluster.Status.Phase = string(corev1.ClusterStateRunning)

err = driver.PreInstall(cluster)
require.NoError(t, err)
Expand Down Expand Up @@ -11566,7 +11567,7 @@ func TestPodDisruptionBudgetWithErrors(t *testing.T) {
},
},
Status: corev1.StorageClusterStatus{
Phase: string(corev1.ClusterOnline),
Phase: string(corev1.ClusterStateRunning),
},
}

Expand Down Expand Up @@ -11691,7 +11692,7 @@ func TestDisablePodDisruptionBudgets(t *testing.T) {
},
},
Status: corev1.StorageClusterStatus{
Phase: string(corev1.ClusterOnline),
Phase: string(corev1.ClusterStateRunning),
},
}

Expand Down
Loading