Skip to content

Instantly share code, notes, and snippets.

View ddebroy's full-sized avatar

Deep Debroy ddebroy

View GitHub Profile
@ddebroy
ddebroy / iscsi-flex-setup
Last active May 21, 2019 18:50
iscsi-flexvolume setup
On Windows hosts:
# disable firewall completely or Get-NetFirewallServiceFilter -Service msiscsi | Get-NetFirewallRule | Enable-NetFirewallRule | Out-Null
Set-Service -Name msiscsi -StartupType Automatic
Start-service msiscsi
# download the iSCSI flexvolume plugins
Invoke-WebRequest https://github.com/Microsoft/K8s-Storage-Plugins/releases/download/v0.0.2/flexvolume-windows.zip -OutFile flex.zip
# install flex volume plugins under a microsoft.com directory in the volumeplugins path configured in kubelet.exe
@ddebroy
ddebroy / flexvol-iscsi-sc.yaml
Created May 21, 2019 18:42
Flexvolume iSCSI storage class
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: iscsi-targetd-win1
provisioner: iscsi-targetd
parameters:
# this id where the iscsi server is running
targetPortal: 10.240.0.96:3260
# file system type for Windows
@ddebroy
ddebroy / iscsi-targetd.yaml
Created May 21, 2019 18:36
iSCSI targetd external provisioner deployment for Windows
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: iscsi-provisioner-runner
rules:
- apiGroups: [""]
resources: ["persistentvolumes"]
verbs: ["get", "list", "watch", "create", "delete"]
- apiGroups: [""]
resources: ["persistentvolumeclaims"]
@ddebroy
ddebroy / targetd-extprov.diff
Created May 21, 2019 18:34
external provisioner for targetd that returns Microsoft iSCSI flexvolume PV source
diff --git a/iscsi/targetd/provisioner/iscsi-provisioner.go b/iscsi/targetd/provisioner/iscsi-provisioner.go
index b3f2c97a..1c1264da 100644
--- a/iscsi/targetd/provisioner/iscsi-provisioner.go
+++ b/iscsi/targetd/provisioner/iscsi-provisioner.go
@@ -126,11 +126,6 @@ func (p *iscsiProvisioner) Provision(options controller.VolumeOptions) (*v1.Pers
annotations["pool"] = pool
annotations["initiators"] = options.Parameters["initiators"]
- var portals []string
- if len(options.Parameters["portals"]) > 0 {
@ddebroy
ddebroy / iscsi-flex-patch.diff
Created May 21, 2019 18:26
Flexvolume iSCSI diskpart patch
diff --git a/flexvolume/windows/plugins/microsoft.com~iscsi.cmd/disk_utils.ps1 b/flexvolume/windows/plugins/microsoft.com~iscsi.cmd/disk_utils.ps1
index fcf6da9..c99d470 100644
--- a/flexvolume/windows/plugins/microsoft.com~iscsi.cmd/disk_utils.ps1
+++ b/flexvolume/windows/plugins/microsoft.com~iscsi.cmd/disk_utils.ps1
@@ -8,7 +8,32 @@ Function RegetDisk($disk)
Function GetVolumesForDisk($disk)
{
- return @($disk | get-partition | get-volume)
+ # Write-Host "disk: $disk.Number"
@ddebroy
ddebroy / node-windows-yaml
Created May 18, 2019 18:55
Diffs for GCE PD daemonset for Windows
diff --git a/deploy/kubernetes/base/node.yaml b/deploy/kubernetes/base/node.yaml
index 5195b34..80d6ea5 100644
--- a/deploy/kubernetes/base/node.yaml
+++ b/deploy/kubernetes/base/node.yaml
@@ -13,17 +13,20 @@ spec:
app: gcp-compute-persistent-disk-csi-driver
spec:
serviceAccountName: csi-node-sa
+ tolerations:
+ - key: "node.kubernetes.io/os"
# Source: http://frippery.org/busybox/
# This Dockerfile builds a (32-bit) busybox images which is suitable for
# running many of the integration-cli tests for Docker against a Windows
# daemon. It will not run on nanoserver as that is 64-bit only.
#
# John Howard (IRC jhowardmsft, Email [email protected])
#
# To build: docker build -t busybox .
# To publish: Needs someone with publishing rights
#
diff --git a/pkg/apis/storage/v1/zz_generated.conversion.go b/pkg/apis/storage/v1/zz_generated.conversion.go
index 436a862..18fbc36 100644
--- a/pkg/apis/storage/v1/zz_generated.conversion.go
+++ b/pkg/apis/storage/v1/zz_generated.conversion.go
@@ -211,7 +211,17 @@ func Convert_storage_VolumeAttachment_To_v1_VolumeAttachment(in *storage.VolumeA
func autoConvert_v1_VolumeAttachmentList_To_storage_VolumeAttachmentList(in *v1.VolumeAttachmentList, out *storage.VolumeAttachmentList, s conversion.Scope) error
{
out.ListMeta = in.ListMeta
- out.Items = *(*[]storage.VolumeAttachment)(unsafe.Pointer(&in.Items))
@ddebroy
ddebroy / sock-cli.go
Created April 5, 2019 17:27
socket client for Windows
package main
import (
"io"
"log"
"net"
// "time"
)
func reader(r io.Reader) {
@ddebroy
ddebroy / sock-server.go
Created April 5, 2019 17:26
Windows socket server
package main
import (
"log"
"net"
"os"
"io/ioutil"
"os/signal"
"syscall"
)