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

Remove Extra Fields From Minimal CR #800

Merged
merged 50 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
10b02dc
set default replicas to 2 if not specified
suryagupta4 Nov 22, 2024
b5aefc3
set default path for KUBELET_CONFIG_DIR
suryagupta4 Nov 22, 2024
4b1ffa1
set default path for KUBELET_CONFIG_DIR
suryagupta4 Nov 22, 2024
b7e33cc
define DefaultKubeletConfigDir
suryagupta4 Nov 22, 2024
4517b8b
Same KUBECONFIG_DIR changes for powerscale and powerstore. Tested on
anathoodell Nov 22, 2024
120ad06
updated structs to pointers
rishabhatdell Nov 25, 2024
f029446
Remove mdm from CR. We still need to add the MDM var to the daemonset.
anathoodell Nov 26, 2024
b49985b
fixed operator crashing
rishabhatdell Nov 26, 2024
2773cfc
[WIP] Increase coverage for driver package (#801)
sakshi-garg1 Nov 27, 2024
1618b77
Fixed initContainers in CR
rishabhatdell Nov 27, 2024
36ab65a
Update common_test.go for increaing powermax.go coverage
sakshi-garg1 Nov 27, 2024
acc95c5
Update common_test.go
sakshi-garg1 Nov 27, 2024
c5fd8d2
Update common_test.go to increase powerflex.go coverage
sakshi-garg1 Nov 27, 2024
e5c238b
fixed linting errors
rishabhatdell Nov 27, 2024
b6b934a
fixed linting errors
rishabhatdell Nov 27, 2024
4af66a1
fixed yaml linting errors
rishabhatdell Nov 27, 2024
466029e
To increase coverage for powerstore.go
sakshi-garg1 Nov 28, 2024
4911e77
Increase coverage for unity.go file
sakshi-garg1 Nov 28, 2024
0c01ab8
Increase coverage for unity.go file
sakshi-garg1 Nov 28, 2024
ada2143
To increase coverage for unity.go
sakshi-garg1 Nov 28, 2024
a9047a4
To increase coverage for commonconfig.go
sakshi-garg1 Nov 28, 2024
2f426c8
To increase coverage for commonconfig.go
sakshi-garg1 Nov 28, 2024
2894e0f
Fixed Linting issues
sakshi-garg1 Nov 28, 2024
cb39149
Fixed Linting issues
sakshi-garg1 Nov 28, 2024
6b273e0
Fixed Linting issues
sakshi-garg1 Nov 28, 2024
85d5a5f
fixed linters error
rishabhatdell Nov 28, 2024
f3bcc93
fixed linters error
rishabhatdell Nov 28, 2024
e784f68
e2e tests for minimal sample
rishabhatdell Nov 29, 2024
16a6a74
Removing code that defaults replica count in deployment and CR to 2 when
anathoodell Dec 3, 2024
9d4e09a
Fix linter error.
anathoodell Dec 3, 2024
f919e53
Merge branch 'main' of https://github.com/dell/csm-operator into 1594…
rishabhatdell Dec 4, 2024
01d2c78
addressed @rajendraindukuri & @kumarp20 review comment
rishabhatdell Dec 4, 2024
d7827cb
fixed liniting errors for crd
rishabhatdell Dec 4, 2024
1958691
added no mdm unit test
rishabhatdell Dec 4, 2024
e9e6a63
fixed reverseproxy envs
rishabhatdell Dec 6, 2024
9c4fa54
Inject ReverseProxy directly into the deployment
AkshaySainiDell Dec 11, 2024
e15599d
Merge branch 'main' of https://github.com/dell/csm-operator into 1594…
AkshaySainiDell Dec 11, 2024
d895a6b
Refactor ReverseProxy code
AkshaySainiDell Dec 12, 2024
707cf3e
Fix unit test failures
AkshaySainiDell Dec 17, 2024
1f19649
Fix step_defs.go
AkshaySainiDell Dec 17, 2024
e2bea8c
Merge branch 'main' into 1594_remove_extra_fields
AkshaySainiDell Dec 17, 2024
0bb8fd1
Increase coverage of controller
AkshaySainiDell Dec 17, 2024
7c25b49
Increase coverage of controller
AkshaySainiDell Dec 18, 2024
e2e64fe
Fix gosec error
AkshaySainiDell Dec 18, 2024
b3b5a9d
Fix lint error
AkshaySainiDell Dec 18, 2024
252d2ea
Increase coverage of reverseproxy
AkshaySainiDell Dec 18, 2024
ab93bba
Fix lint error
AkshaySainiDell Dec 18, 2024
42576c8
Fix minimal e2e scenarios
AkshaySainiDell Dec 19, 2024
dc98c2d
Merge branch 'main' into 1594_remove_extra_fields
AkshaySainiDell Dec 20, 2024
0d79b9f
Fix driver UT
AkshaySainiDell Dec 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions api/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,15 @@ type Driver struct {

// CSIDriverSpec is the specification for CSIDriver
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="CSI Driver Spec"
CSIDriverSpec CSIDriverSpec `json:"csiDriverSpec" yaml:"csiDriverSpec"`
CSIDriverSpec *CSIDriverSpec `json:"csiDriverSpec" yaml:"csiDriverSpec"`

// ConfigVersion is the configuration version of the driver
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Config Version"
ConfigVersion string `json:"configVersion" yaml:"configVersion"`

// Replicas is the count of controllers for Controller plugin
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Controller count"
// +kubebuilder:default=2
Replicas int32 `json:"replicas" yaml:"replicas"`

// DNSPolicy is the dnsPolicy of the daemonset for Node plugin
Expand All @@ -193,15 +194,15 @@ type Driver struct {

// Common is the common specification for both controller and node plugins
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Common specification"
Common ContainerTemplate `json:"common" yaml:"common"`
Common *ContainerTemplate `json:"common" yaml:"common"`

// Controller is the specification for Controller plugin only
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Controller Specification"
Controller ContainerTemplate `json:"controller,omitempty" yaml:"controller"`
Controller *ContainerTemplate `json:"controller,omitempty" yaml:"controller"`

// Node is the specification for Node plugin only
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Node specification"
Node ContainerTemplate `json:"node,omitempty" yaml:"node"`
Node *ContainerTemplate `json:"node,omitempty" yaml:"node"`

// SideCars is the specification for CSI sidecar containers
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="CSI SideCars specification"
Expand Down
24 changes: 20 additions & 4 deletions api/v1/zz_generated.deepcopy.go

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

2,895 changes: 1,711 additions & 1,184 deletions config/crd/bases/storage.dell.com_containerstoragemodules.yaml

Large diffs are not rendered by default.

54 changes: 35 additions & 19 deletions controllers/csm_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,15 +731,15 @@ func (r *ContainerStorageModuleReconciler) SyncCSM(ctx context.Context, cr csmv1
}

// Create/Update Reverseproxy Server
if reverseProxyEnabled, _ := utils.IsModuleEnabled(ctx, cr, csmv1.ReverseProxy); reverseProxyEnabled {
if reverseProxyEnabled, _ := utils.IsModuleEnabled(ctx, cr, csmv1.ReverseProxy); reverseProxyEnabled && !modules.IsReverseProxySidecar() {
log.Infow("Trying Create/Update reverseproxy...")
if err := r.reconcileReverseProxy(ctx, false, operatorConfig, cr, ctrlClient); err != nil {
if err := r.reconcileReverseProxyServer(ctx, false, operatorConfig, cr, ctrlClient); err != nil {
return fmt.Errorf("failed to deploy reverseproxy proxy server: %v", err)
}
}

// Get Driver resources
driverConfig, err := getDriverConfig(ctx, cr, operatorConfig)
driverConfig, err := getDriverConfig(ctx, cr, operatorConfig, ctrlClient)
if err != nil {
return err
}
Expand All @@ -759,6 +759,25 @@ func (r *ContainerStorageModuleReconciler) SyncCSM(ctx context.Context, cr csmv1
node := driverConfig.Node
controller := driverConfig.Controller

if cr.GetDriverType() == csmv1.PowerMax {
if !modules.IsReverseProxySidecar() {
log.Infof("DeployAsSidar is false...csi-reverseproxy should be present as deployement\n")
log.Infof("adding proxy service name...\n")
modules.AddReverseProxyServiceName(&controller.Deployment)
} else {
log.Info("Starting CSI ReverseProxy Service")
if err := modules.ReverseProxyStartService(ctx, false, operatorConfig, cr, ctrlClient); err != nil {
return fmt.Errorf("unable to reconcile reverse-proxy service: %v", err)
}
log.Info("Injecting CSI ReverseProxy")
dp, err := modules.ReverseProxyInjectDeployment(controller.Deployment, cr, operatorConfig)
if err != nil {
return fmt.Errorf("injecting replication into deployment: %v", err)
}
controller.Deployment = *dp
}
}

replicationEnabled, clusterClients, err := utils.GetDefaultClusters(ctx, cr, r)
if err != nil {
return err
Expand Down Expand Up @@ -827,13 +846,6 @@ func (r *ContainerStorageModuleReconciler) SyncCSM(ctx context.Context, cr csmv1
}

controller.Rbac.ClusterRole = *clusterRole
case csmv1.ReverseProxy:
log.Info("Injecting CSI ReverseProxy")
dp, err := modules.ReverseProxyInjectDeployment(controller.Deployment, cr, operatorConfig)
if err != nil {
return fmt.Errorf("injecting replication into deployment: %v", err)
}
controller.Deployment = *dp
}
}
}
Expand Down Expand Up @@ -1095,6 +1107,7 @@ func (r *ContainerStorageModuleReconciler) reconcileAppMobility(ctx context.Cont
func getDriverConfig(ctx context.Context,
cr csmv1.ContainerStorageModule,
operatorConfig utils.OperatorConfig,
ctrlClient client.Client,
) (*DriverConfig, error) {
var (
err error
Expand Down Expand Up @@ -1129,7 +1142,7 @@ func getDriverConfig(ctx context.Context,
return nil, fmt.Errorf("getting %s CSIDriver: %v", driverType, err)
}

node, err = drivers.GetNode(ctx, cr, operatorConfig, driverType, NodeYaml)
node, err = drivers.GetNode(ctx, cr, operatorConfig, driverType, NodeYaml, ctrlClient)
if err != nil {
return nil, fmt.Errorf("getting %s node: %v", driverType, err)
}
Expand All @@ -1147,16 +1160,13 @@ func getDriverConfig(ctx context.Context,
}, nil
}

// reconcileReverseProxy - deploy reverse proxy server
func (r *ContainerStorageModuleReconciler) reconcileReverseProxy(ctx context.Context, isDeleting bool, op utils.OperatorConfig, cr csmv1.ContainerStorageModule, ctrlClient client.Client) error {
// reconcileReverseProxyServer - deploy reverse proxy server
func (r *ContainerStorageModuleReconciler) reconcileReverseProxyServer(ctx context.Context, isDeleting bool, op utils.OperatorConfig, cr csmv1.ContainerStorageModule, ctrlClient client.Client) error {
log := logger.GetLogger(ctx)
log.Infow("Reconcile reverseproxy proxy")
if err := modules.ReverseProxyServer(ctx, isDeleting, op, cr, ctrlClient); err != nil {
return fmt.Errorf("unable to reconcile reverse-proxy server: %v", err)
}
if err := modules.ReverseProxyStartService(ctx, isDeleting, op, cr, ctrlClient); err != nil {
return fmt.Errorf("unable to reconcile reverse-proxy service: %v", err)
}
return nil
}

Expand Down Expand Up @@ -1244,7 +1254,7 @@ func (r *ContainerStorageModuleReconciler) removeDriver(ctx context.Context, ins
log := logger.GetLogger(ctx)

// Get Driver resources
driverConfig, err := getDriverConfig(ctx, instance, operatorConfig)
driverConfig, err := getDriverConfig(ctx, instance, operatorConfig, r.Client)
if err != nil {
log.Error("error in getDriverConfig")
return err
Expand Down Expand Up @@ -1281,6 +1291,12 @@ func (r *ContainerStorageModuleReconciler) removeDriver(ctx context.Context, ins
}
}

if instance.GetDriverType() == csmv1.PowerMax && modules.IsReverseProxySidecar() {
log.Info("Removing CSI ReverseProxy Service")
if err := modules.ReverseProxyStartService(ctx, true, operatorConfig, instance, cluster.ClusterCTRLClient); err != nil {
return fmt.Errorf("unable to reconcile reverse-proxy service: %v", err)
}
}
}

return nil
Expand All @@ -1303,9 +1319,9 @@ func (r *ContainerStorageModuleReconciler) removeModule(ctx context.Context, ins
return err
}
}
if reverseproxyEnabled, _ := utils.IsModuleEnabled(ctx, instance, csmv1.ReverseProxy); reverseproxyEnabled {
if reverseproxyEnabled, _ := utils.IsModuleEnabled(ctx, instance, csmv1.ReverseProxy); reverseproxyEnabled && !modules.IsReverseProxySidecar() {
log.Infow("Deleting ReverseProxy")
if err := r.reconcileReverseProxy(ctx, true, operatorConfig, instance, ctrlClient); err != nil {
if err := r.reconcileReverseProxyServer(ctx, true, operatorConfig, instance, ctrlClient); err != nil {
return err
}
}
Expand Down
6 changes: 3 additions & 3 deletions controllers/csm_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func (suite *CSMControllerTestSuite) TestReconcileReverseProxyError() {
csm := shared.MakeCSM(csmName, suite.namespace, shared.PmaxConfigVersion)
csm.Spec.Modules = getReverseProxyModule()
reconciler := suite.createReconciler()
err := reconciler.reconcileReverseProxy(ctx, false, badOperatorConfig, csm, suite.fakeClient)
err := reconciler.reconcileReverseProxyServer(ctx, false, badOperatorConfig, csm, suite.fakeClient)
assert.NotNil(suite.T(), err)
}

Expand All @@ -300,7 +300,7 @@ func (suite *CSMControllerTestSuite) TestReconcileReverseProxyServiceError() {
reconciler := suite.createReconciler()
_ = modules.ReverseProxyPrecheck(ctx, operatorConfig, revProxy[0], csm, reconciler)
revProxy[0].ConfigVersion = ""
err := reconciler.reconcileReverseProxy(ctx, false, badOperatorConfig, csm, suite.fakeClient)
err := reconciler.reconcileReverseProxyServer(ctx, false, badOperatorConfig, csm, suite.fakeClient)
assert.NotNil(suite.T(), err)
}

Expand Down Expand Up @@ -926,7 +926,7 @@ func (suite *CSMControllerTestSuite) TestOldStandAloneModuleCleanup() {
if errorInjector != nil {
*errorInjector = true
}
driverConfig, _ := getDriverConfig(ctx, *csm, operatorConfig)
driverConfig, _ := getDriverConfig(ctx, *csm, operatorConfig, r.Client)
err := r.oldStandAloneModuleCleanup(ctx, csm, operatorConfig, driverConfig)

if expectedErr == "" {
Expand Down
Loading
Loading