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

2.12 nfs #1273

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
1523837
Update version to 2.12
Aug 3, 2022
7fa4980
PWX-26049: Vendor updated px-object-controller to fix cache initializ…
pp511 Aug 5, 2022
22d2b7d
PWX-26225: Error in starting px-object-controller should not throw fa…
pp511 Aug 10, 2022
0d688b8
PWX-26330: Disable px-object-controller by default.
pp511 Aug 17, 2022
b0facdc
Force full backup on specified day in daily schedule
Aug 29, 2022
c488643
Log when stork takes a forceful snapshot
adityadani Aug 30, 2022
096e5ca
PWX-26033: Dont include FA/FB device for migration
Aug 1, 2022
520c010
PWX-24976: Register ResourceTransformation CR api
Aug 1, 2022
90c3f2e
Register and handle Resource Transformation events via controller
Aug 9, 2022
8a6c502
PWX-24851: Enhance UX experience for setting up clusterpair for async…
Aug 1, 2022
d0bade8
pwx-24979: integrate transform resource api with migration path
Aug 18, 2022
c26a117
Add transformation rule handler in resourcecollector
Aug 18, 2022
65e7637
Allow enable/disable resource transformation controller
Aug 24, 2022
0060ffb
Dry-run resource transformation validation during migration prechecks
Aug 24, 2022
f773ff6
Ensure to re-run transformation validation before each migration run
Aug 26, 2022
73589e8
Vendor updates - sched-ops
Aug 30, 2022
f49f714
codegen for new schema definations
Aug 30, 2022
bf76c32
pwx-26151: skip collecting endpoints for headless service
Aug 27, 2022
2119fe0
Update google SDK to version 399
adityadani Sep 1, 2022
e555076
pb-3002: call v1 version CRD API for k8s 1.22 or more.
lalat-das Aug 10, 2022
a687fec
pb-3000: Added debug statement in GetObjLockInfo api
Aug 6, 2022
cf6d846
Added changes to fix integration test container build failure
px-kesavan Sep 22, 2022
2574558
pb-3005: Added fix to include the CRDs even if CR is are present.
Aug 31, 2022
e511a31
pb-3025: Added support to take backup of webhook
Sep 6, 2022
0ef7c37
pb--3113: Added error handling for netapp object store for getting ob…
Sep 21, 2022
c15469b
pb-3132: Added logic to call post exec rule after volume backup, if it
Oct 2, 2022
f7d1820
PWX-26900: Set the resource migration finish timestamp once pruning i…
adityadani Sep 19, 2022
e5d5856
Start the controller manager before starting any kubernetes watches
adityadani Sep 20, 2022
91ff6bb
pb-3131: Added load balancer service type as well to reset the nodepo…
Oct 1, 2022
a85d994
PWX-27136: Do not collect VirtualMachineInstanceMigration CR.
adityadani Oct 3, 2022
85a7478
PWX-26934: Handle panic for SkipDeletedNamespace flag
Sep 23, 2022
b4250e4
Update migration resources with resource transformation events
Sep 30, 2022
ed7df1a
PWX-26882 update k8s libs to 1.21.5 to fix CVEs
Oct 6, 2022
9fe387d
PWX-27273: Only set the ResourceMigrationFinishTs after purging the r…
adityadani Oct 6, 2022
5480343
Set QPS and BURST rate for sched-ops client
Sep 20, 2022
65e65f9
vendor updates sched-ops
Oct 10, 2022
1eb63a2
pb-3124: updated the storageclass and storage provisioner annotation,…
Oct 6, 2022
a183b90
pb-3138: Resetting the serviceAccountUID annotation in the secret.
Oct 5, 2022
ff6299d
pb-3122: Added logic to include clusterRole, if it is bind to a
Oct 7, 2022
b3440c4
pb-3123: Added logic to trim the group name, if crds have last three
Oct 6, 2022
5c84d81
pb-3124: Added check for both beta and v1 version of StorageProvisioner
Oct 11, 2022
6c001bd
pb-3124: vendor changes for k8s component-helpers
Oct 12, 2022
43643d4
Snapshotter: implement find snapshot api for portworx driver
Sep 19, 2022
c2244f9
vendor updates - external snapshotter
Oct 12, 2022
5dd8796
pb-3157: Added fixes to add proper storage class and provisioner name
Oct 14, 2022
9230c88
PWX-27094: Dont suppress transformation failure msg
Oct 18, 2022
0ff5f95
PB-3150: Handle GCE snapshot NotFound error in DeleteBackup implement…
adityadani Oct 14, 2022
191ecb7
Update golang version to 1.17.11
adityadani Oct 19, 2022
4374fed
pb-3162: Resetting secret token data for service account token before…
Oct 18, 2022
6336f00
Handle len check for keypair resource transformation value
Oct 20, 2022
96850c0
pb-3174: Added csi section in the case portworx volume restore.
Oct 20, 2022
87df606
ptx-13566: updating the destination namespace from the namespace mapp…
Oct 26, 2022
65abc8c
Changes required in backuplocation CR definition of NFS type.
Nov 3, 2022
79207db
vendor kdmp from 1.2.3 branch and sched-ops from nfs-ea branch
Nov 6, 2022
0b38680
pb-2939: enable NFS type backuplocation
lalat-das Jul 27, 2022
5267c6e
Initializing resource export controller
prashanthpx Sep 12, 2022
dee3466
pb-3062: Added code to create resource export CR for nfs resource
Sep 13, 2022
70a43d8
pb-3093: Setting nfs as type while creating ResourceExport CR
prashanthpx Sep 14, 2022
38e6416
PB-3111: Support for nfs backuplocation in restore resources in appli…
diptiranjanpx Sep 20, 2022
f477b06
pb-3109: moved the const definition and api between kdmp driver and a…
Sep 24, 2022
03441f9
fixed the issue in accessing Resources from Status of the resourceExp…
Sep 26, 2022
d2ff8da
pb-3100: Enable Generic backup for NFS based backuplocation
lalat-das Oct 3, 2022
0779be7
Temporarily disabling namespace creation in vol restore path
prashanthpx Oct 10, 2022
bb614f8
PB-3155: Updating the success status in application restore CR from r…
diptiranjanpx Oct 12, 2022
295578d
commented out the namespace related api temporarily
Oct 20, 2022
201228a
PB-3144: Not creating namespaces for nfs backuplocation type in contr…
diptiranjanpx Oct 20, 2022
6a65494
Uncommented the definition of namespaceRestoreAllowed and verifyNames…
Nov 2, 2022
1244729
fixed compilation error came as part of merger and rebase
Nov 2, 2022
680ba0c
NFS volume restore implementation
prashanthpx Oct 26, 2022
ee5959d
PB-3211: Mapping nfs restore statuses to stork restore statuses and u…
diptiranjanpx Nov 3, 2022
fb72129
Populating NFS backup size, appended nfs to job names
prashanthpx Nov 4, 2022
ef6c7ea
pb-3100: Added check to take kdmp backup, if it is PX volume and NFS
Nov 5, 2022
692bbf6
vendor kdmp from 1.2.3 branch and sched-ops from nfs-ea branch
Nov 6, 2022
f313b1b
pb-3213: Send the triggeredFrom values to nfs specific CRs
lalat-das Nov 6, 2022
407d0d0
Delete how ed4bac3825565902733b151138c32367231e48b3
lalat-das Nov 7, 2022
9bdd7f1
Prashanth - Addressing review comments
prashanthpx Nov 7, 2022
0e12732
travis file change for 2.12-nfs branch
Nov 7, 2022
899660f
vendor latest kdmp branch from 1.2.3 branch
Nov 7, 2022
ed82856
Vendoring 1.2.3 kdmp latest.
diptiranjanpx Nov 8, 2022
9779f9a
vendor kdmp repo from 1.2.3 branch
Nov 8, 2022
4f396e0
vendor latest kdmp from 1.2.3 branch
Nov 9, 2022
aba5b9f
vendor in kdmp 1.2.3 branch
px-kesavan Nov 10, 2022
dd80df8
pb-3258: Added TriggeredFromxxx field for resourceExport as well
Nov 11, 2022
5dab55d
pb3206: Not returning error if the storageclass is missing on destina…
Nov 3, 2022
9eb8da8
Appended restore backup with nfs for jobs
prashanthpx Nov 11, 2022
8593f9a
vendor latest kdmp from 1.2.3 branch
Nov 12, 2022
b8e8bb1
pb-3306: Removing setting of CR status to success before checking for
prashanthpx Nov 17, 2022
3b00af2
vendor kdmp from 1.2.3 release branch.
Nov 20, 2022
dc5220e
pb-3312: Added steps to delete the resourceexport CR, when restore fails
Nov 19, 2022
d538c1e
PB-3316: Removing storageprovisioner annotation along with beta versi…
diptiranjanpx Nov 21, 2022
d4a7af9
fixed error message in restore
px-kesavan Nov 16, 2022
6f6ce84
pb-3320: Enforce kdmp backup for all cloud provisioner for NFS BL
lalat-das Nov 23, 2022
82fd21d
vendor latest changes from 1.2.3 kdmp branch
Nov 24, 2022
5883fa1
pb-3347: Make CSI volumes to use kdmp driver for NFS BL
lalat-das Nov 30, 2022
29d09ff
vendored latest kdmp from 1.2.3 branch
May 23, 2023
ae34027
updating kdmp version from 1.2.3 to 1.2.3-dev
May 23, 2023
b57a1c2
formatting changes
May 23, 2023
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
12 changes: 6 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ sudo: required
dist: xenial
language: go
go:
- 1.17.3
- 1.17.11
before_install:
- sudo apt-get update -yq
- sudo apt-get update -yq || true
- sudo apt-get install go-md2man -y
- sudo apt-get install -y awscli
cache:
directories:
- $HOME/.cache/go-build
script:
- |
if [ "${TRAVIS_BRANCH}" == "master" ]; then
export DOCKER_HUB_STORK_TAG=master
export DOCKER_HUB_STORK_TEST_TAG=latest
export DOCKER_HUB_CMD_EXECUTOR_TAG=master
if [ "${TRAVIS_BRANCH}" == "2.12-nfs" ]; then
export DOCKER_HUB_STORK_TAG="${TRAVIS_BRANCH}"-dev
export DOCKER_HUB_STORK_TEST_TAG="${TRAVIS_BRANCH}"-dev
export DOCKER_HUB_CMD_EXECUTOR_TAG="${TRAVIS_BRANCH}"-dev
else
export DOCKER_HUB_STORK_TAG=`git rev-parse --short HEAD`
export DOCKER_HUB_STORK_TEST_TAG=`git rev-parse --short HEAD`
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN python3 -m pip install awscli && python3 -m pip install rsa --upgrade
RUN curl -q -o /usr/local/bin/aws-iam-authenticator https://amazon-eks.s3-us-west-2.amazonaws.com/1.10.3/2018-07-26/bin/linux/amd64/aws-iam-authenticator && \
chmod +x /usr/local/bin/aws-iam-authenticator

ARG GCLOUD_SDK=google-cloud-sdk-269.0.0-linux-x86_64.tar.gz
ARG GCLOUD_SDK=google-cloud-sdk-399.0.0-linux-x86_64.tar.gz
# Remove the test directories
# Also don't need gsutil
RUN curl -q -o $GCLOUD_SDK https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/$GCLOUD_SDK && \
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ifeq ($(BUILD_TYPE),debug)
BUILDFLAGS += -gcflags "-N -l"
endif

RELEASE_VER := 2.7.0
RELEASE_VER := 2.12.0
BASE_DIR := $(shell git rev-parse --show-toplevel)
GIT_SHA := $(shell git rev-parse --short HEAD)
BIN :=$(BASE_DIR)/bin
Expand Down
58 changes: 44 additions & 14 deletions cmd/stork/stork.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
"github.com/libopenstorage/stork/pkg/k8sutils"
"github.com/libopenstorage/stork/pkg/metrics"
"github.com/libopenstorage/stork/pkg/migration"
"github.com/libopenstorage/stork/pkg/migration/controllers"
"github.com/libopenstorage/stork/pkg/monitor"
"github.com/libopenstorage/stork/pkg/objectcontroller"
"github.com/libopenstorage/stork/pkg/pvcwatcher"
Expand All @@ -41,9 +42,11 @@ import (
"github.com/libopenstorage/stork/pkg/webhookadmission"
kdmpapi "github.com/portworx/kdmp/pkg/apis/kdmp/v1alpha1"
"github.com/portworx/kdmp/pkg/controllers/dataexport"
"github.com/portworx/kdmp/pkg/controllers/resourceexport"
"github.com/portworx/kdmp/pkg/drivers"
"github.com/portworx/kdmp/pkg/jobratelimit"
kdmpversion "github.com/portworx/kdmp/pkg/version"
"github.com/portworx/sched-ops/k8s/common"
schedops "github.com/portworx/sched-ops/k8s/core"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -143,7 +146,7 @@ func main() {
Name: "application-controller",
Usage: "Start the controllers for managing applications (default: true)",
},
cli.BoolTFlag{
cli.BoolFlag{
Name: "px-object-controller",
Usage: "Start the px object controller.",
},
Expand Down Expand Up @@ -184,12 +187,12 @@ func main() {
},
cli.IntFlag{
Name: "k8s-api-qps",
Value: 100,
Value: 1000,
Usage: "Restrict number of k8s api requests from stork (default: 100 QPS)",
},
cli.IntFlag{
Name: "k8s-api-burst",
Value: 100,
Value: 2000,
Usage: "Restrict number of k8s api requests from stork (default: 100 Burst)",
},
cli.BoolTFlag{
Expand All @@ -201,6 +204,10 @@ func main() {
Value: 4,
Usage: "Max threads for apply resources during migration (default: 4)",
},
cli.BoolTFlag{
Name: controllers.ResourceTransformationControllerName,
Usage: "Start the resource transformation controller (default: true)",
},
}

if err := app.Run(os.Args); err != nil {
Expand Down Expand Up @@ -285,6 +292,18 @@ func run(c *cli.Context) {
eventBroadcaster.StartRecordingToSink(&core_v1.EventSinkImpl{Interface: k8sClient.CoreV1().Events("")})
recorder := eventBroadcaster.NewRecorder(scheme.Scheme, api_v1.EventSource{Component: eventComponentName})

// Create operator-sdk manager that will manage all controllers.
// Setup the controller manager before starting any watches / other controllers
mgr, err := manager.New(config, manager.Options{})
if err != nil {
log.Fatalf("Setup controller manager: %v", err)
}

// Setup scheme for all stork resources
if err := apis.AddToScheme(mgr.GetScheme()); err != nil {
log.Fatalf("Setup scheme failed for stork resources: %v", err)
}

var d volume.Driver
if driverName != "" {
log.Infof("Using driver %v", driverName)
Expand Down Expand Up @@ -333,16 +352,6 @@ func run(c *cli.Context) {
}
}
}
// Create operator-sdk manager that will manage all controllers.
mgr, err := manager.New(config, manager.Options{})
if err != nil {
log.Fatalf("Setup controller manager: %v", err)
}

// Setup scheme for all stork resources
if err := apis.AddToScheme(mgr.GetScheme()); err != nil {
log.Fatalf("Setup scheme failed for stork resources: %v", err)
}

runFunc := func(context.Context) {
runStork(mgr, d, recorder, c)
Expand Down Expand Up @@ -413,6 +422,12 @@ func runStork(mgr manager.Manager, d volume.Driver, recorder record.EventRecorde
if err := resourceCollector.Init(nil); err != nil {
log.Fatalf("Error initializing ResourceCollector: %v", err)
}
if err := os.Setenv(common.BurstRate, strconv.Itoa(burst)); err != nil {
log.Fatalf("Error setting Burst Rate: %v", err)
}
if err := os.Setenv(common.QPSRate, strconv.Itoa(qps)); err != nil {
log.Fatalf("Error setting Burst Rate: %v", err)
}
adminNamespace := c.String("admin-namespace")
if adminNamespace == "" {
adminNamespace = c.String("migration-admin-namespace")
Expand Down Expand Up @@ -468,6 +483,13 @@ func runStork(mgr manager.Manager, d volume.Driver, recorder record.EventRecorde
}
}

if c.Bool(controllers.ResourceTransformationControllerName) {
rt := controllers.NewResourceTransformation(mgr, d, recorder, resourceCollector)
if err := rt.Init(mgr); err != nil {
log.Fatalf("Error initializing resource transformation controller: %v", err)
}
}

if c.Bool("cluster-domain-controllers") {
clusterDomains := clusterdomains.ClusterDomains{
Driver: d,
Expand All @@ -493,7 +515,7 @@ func runStork(mgr manager.Manager, d volume.Driver, recorder record.EventRecorde
if c.Bool("px-object-controller") {
objectController := &objectcontroller.ObjectController{}
if err := objectController.Init(); err != nil {
log.Fatalf("Error initializing px-object-controller : %v", err)
log.Warnf("Error initializing px-object-controller : %v", err)
}
}
if c.Bool("kdmp-controller") {
Expand All @@ -508,6 +530,14 @@ func runStork(mgr manager.Manager, d volume.Driver, recorder record.EventRecorde
if err := dataexport.Init(mgr); err != nil {
log.Fatalf("Error initializing kdmp controller: %v", err)
}
resourceexport, err := resourceexport.NewController(mgr)
if err != nil {
log.Fatalf("Error initializing resource export controller: %v", err)
}

if err := resourceexport.Init(mgr); err != nil {
log.Fatalf("Error initializing resource export controller manager: %v", err)
}
}
ctx := context.Background()

Expand Down
7 changes: 7 additions & 0 deletions drivers/volume/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,17 @@ func (a *aws) OwnsPVCForBackup(
pvc *v1.PersistentVolumeClaim,
cmBackupType string,
crBackupType string,
blType storkapi.BackupLocationType,
) bool {
if cmBackupType == storkapi.ApplicationBackupGeneric {
// If user has forced the backupType in config map, default to generic always
return false
}
// For AWS volume and backuplocation type is NFS, we will not own.
// It will default to kdmp
if blType == storkapi.BackupLocationNFS {
return false
}
return a.OwnsPVC(coreOps, pvc)
}

Expand Down Expand Up @@ -397,6 +403,7 @@ func (a *aws) DeleteBackup(backup *storkapi.ApplicationBackup) (bool, error) {
func (a *aws) UpdateMigratedPersistentVolumeSpec(
pv *v1.PersistentVolume,
vInfo *storkapi.ApplicationRestoreVolumeInfo,
namespaceMapping map[string]string,
) (*v1.PersistentVolume, error) {
if pv.Spec.CSI != nil {
pv.Spec.CSI.VolumeHandle = pv.Name
Expand Down
7 changes: 7 additions & 0 deletions drivers/volume/azure/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,17 @@ func (a *azure) OwnsPVCForBackup(
pvc *v1.PersistentVolumeClaim,
cmBackupType string,
crBackupType string,
blType storkapi.BackupLocationType,
) bool {
if cmBackupType == storkapi.ApplicationBackupGeneric {
// If user has forced the backupType in config map, default to generic always
return false
}
// For Azure based volume and backuplocation type is NFS, we will not own.
// It will default to kdmp
if blType == storkapi.BackupLocationNFS {
return false
}
return a.OwnsPVC(coreOps, pvc)
}

Expand Down Expand Up @@ -408,6 +414,7 @@ func (a *azure) DeleteBackup(backup *storkapi.ApplicationBackup) (bool, error) {
func (a *azure) UpdateMigratedPersistentVolumeSpec(
pv *v1.PersistentVolume,
vInfo *storkapi.ApplicationRestoreVolumeInfo,
namespaceMapping map[string]string,
) (*v1.PersistentVolume, error) {
disk, err := a.diskClient.Get(context.TODO(), a.resourceGroup, pv.Name)
if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion drivers/volume/csi/csi.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ type BackupObjectv1beta1Csi struct {
V1SnapshotRequired bool
}

// GetVolumeSnapshotContent retrieves a backed up volume snapshot
// GetVolumeSnapshotContent retrieves a backed up volume snapshot
func (cbo *csiBackupObject) GetVolumeSnapshot(snapshotID string) (interface{}, error) {
var vs interface{}
var ok bool
Expand Down Expand Up @@ -309,7 +309,12 @@ func (c *csi) OwnsPVCForBackup(
pvc *v1.PersistentVolumeClaim,
cmBackupType string,
crBackupType string,
blType storkapi.BackupLocationType,
) bool {
// For CSI volume and backuplocation type is NFS, It will default to kdmp
if blType == storkapi.BackupLocationNFS {
return false
}
if cmBackupType == storkapi.ApplicationBackupGeneric || crBackupType == storkapi.ApplicationBackupGeneric {
// If user has forced the backupType in config map or applicationbackup CR, default to generic always
return false
Expand Down Expand Up @@ -1170,6 +1175,7 @@ func (c *csi) DeleteBackup(backup *storkapi.ApplicationBackup) (bool, error) {
func (c *csi) UpdateMigratedPersistentVolumeSpec(
pv *v1.PersistentVolume,
vInfo *storkapi.ApplicationRestoreVolumeInfo,
namespaceMapping map[string]string,
) (*v1.PersistentVolume, error) {
return pv, nil
}
Expand Down
13 changes: 13 additions & 0 deletions drivers/volume/gcp/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,17 @@ func (g *gcp) OwnsPVCForBackup(
pvc *v1.PersistentVolumeClaim,
cmBackupType string,
crBackupType string,
blType storkapi.BackupLocationType,
) bool {
if cmBackupType == storkapi.ApplicationBackupGeneric {
// If user has forced the backupType in config map, default to generic always
return false
}
// For gcp volume and backuplocation type is NFS, we will not own.
// It will default to kdmp
if blType == storkapi.BackupLocationNFS {
return false
}
return g.OwnsPVC(coreOps, pvc)
}

Expand Down Expand Up @@ -347,6 +353,12 @@ func (g *gcp) DeleteBackup(backup *storkapi.ApplicationBackup) (bool, error) {
}
_, err := service.Snapshots.Delete(vInfo.Options["projectID"], vInfo.BackupID).Do()
if err != nil {
if gceErr, ok := err.(*googleapi.Error); ok {
if gceErr.Code == http.StatusNotFound {
// snapshot is already deleted
continue
}
}
return true, err
}
}
Expand All @@ -356,6 +368,7 @@ func (g *gcp) DeleteBackup(backup *storkapi.ApplicationBackup) (bool, error) {
func (g *gcp) UpdateMigratedPersistentVolumeSpec(
pv *v1.PersistentVolume,
vInfo *storkapi.ApplicationRestoreVolumeInfo,
namespaceMapping map[string]string,
) (*v1.PersistentVolume, error) {
if pv.Spec.CSI != nil {
key, err := common.VolumeIDToKey(pv.Spec.CSI.VolumeHandle)
Expand Down
Loading