-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrading ibm libs and enabling ibm file (#6007)
* Updating ibm libs to the latest * ibm libs renamed all function names refactoring our code with new function names also modifing client default configs * removing Skips, Renaming functions * removing Skips and changing correct tets config * actually remocing Skips and comments * one more rename * Enabling IBMFile Tests * Enabling ibm file (#6011) * adding SLFile into kio getter * Enabling ibm-file snapshots * Adding SoftlayerFile type into blockstore * adding Authorized Hosts to volume * Post merge cleanups
- Loading branch information
Ilya Kislenko
authored
Jul 11, 2019
1 parent
be5b48a
commit 59f2678
Showing
7 changed files
with
106 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package ibmutils | ||
|
||
// IBM Cloud utils | ||
|
||
import ( | ||
"context" | ||
|
||
ibmprov "github.com/IBM/ibmcloud-storage-volume-lib/lib/provider" | ||
"github.com/pkg/errors" | ||
"k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
"github.com/kanisterio/kanister/pkg/kube" | ||
) | ||
|
||
// AuthorizeSoftLayerFileHosts some of volumes are required post creation authorization to be mounted | ||
func AuthorizeSoftLayerFileHosts(ctx context.Context, vol *ibmprov.Volume, slCli ibmprov.Session) error { | ||
k8scli, err := kube.NewClient() | ||
if err != nil { | ||
return errors.Wrap(err, "Failed to created k8s client.") | ||
} | ||
|
||
nodes, err := k8scli.CoreV1().Nodes().List(metav1.ListOptions{}) | ||
if err != nil { | ||
return errors.Wrap(err, "Failed to list nodes") | ||
} | ||
|
||
nodeips := []string{} | ||
|
||
for _, node := range nodes.Items { | ||
for _, ip := range node.Status.Addresses { | ||
if ip.Type == v1.NodeInternalIP { | ||
nodeips = append(nodeips, ip.Address) | ||
} | ||
} | ||
} | ||
|
||
return slCli.AuthorizeVolume(ibmprov.VolumeAuthorization{ | ||
Volume: *vol, | ||
HostIPs: nodeips, | ||
}) | ||
} |