Skip to content

Commit

Permalink
Merge pull request #19 from RomanBednar/rebase-v1.9.0
Browse files Browse the repository at this point in the history
Rebase to v1.9.0 for OCP 4.10
  • Loading branch information
openshift-merge-robot committed Dec 16, 2021
2 parents 48f08b8 + 23ceb12 commit 3d79d39
Show file tree
Hide file tree
Showing 1,008 changed files with 62,907 additions and 34,635 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/trivy.yaml
@@ -0,0 +1,32 @@
name: Trivy vulnerability scanner
on:
push:
branches:
- master
pull_request:
jobs:
build:
name: Build
runs-on: ubuntu-18.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Build an image from Dockerfile
run: |
export PUBLISH=true
export REGISTRY=test
export IMAGE_VERSION=latest
export DOCKER_CLI_EXPERIMENTAL=enabled
make container
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'test/azuredisk-csi:latest'
format: 'table'
exit-code: '1'
ignore-unfixed: true
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH,MEDIUM,LOW,UNKNOWN'

2 changes: 1 addition & 1 deletion .github/workflows/windows.yml
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
# start the CSI Proxy before running tests on windows
Start-Job -Name CSIProxy -ScriptBlock {
Invoke-WebRequest https://github.com/andyzhangx/demo/raw/master/windows/csi-proxy-v1.0.0-rc.1.tar.gz -OutFile csi-proxy.tar.gz;
Invoke-WebRequest https://acs-mirror.azureedge.net/csi-proxy/v1.0.2/binaries/csi-proxy-v1.0.2.tar.gz -OutFile csi-proxy.tar.gz;
tar -xvf csi-proxy.tar.gz
.\bin\csi-proxy.exe --kubelet-path $pwd
};
Expand Down
30 changes: 18 additions & 12 deletions Makefile
Expand Up @@ -17,9 +17,9 @@ GIT_COMMIT ?= $(shell git rev-parse HEAD)
REGISTRY ?= andyzhangx
REGISTRY_NAME ?= $(shell echo $(REGISTRY) | sed "s/.azurecr.io//g")
IMAGE_NAME ?= azuredisk-csi
ifndef BUILD_V2
ifneq ($(BUILD_V2), true)
PLUGIN_NAME = azurediskplugin
IMAGE_VERSION ?= v1.5.0
IMAGE_VERSION ?= v1.9.0
CHART_VERSION ?= latest
else
PLUGIN_NAME = azurediskpluginv2
Expand All @@ -40,7 +40,7 @@ REV = $(shell git describe --long --tags --dirty)
BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ")
ENABLE_TOPOLOGY ?= false
LDFLAGS ?= "-X ${PKG}/pkg/azuredisk.driverVersion=${IMAGE_VERSION} -X ${PKG}/pkg/azuredisk.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/azuredisk.buildDate=${BUILD_DATE} -extldflags "-static"" ${GOTAGS}
E2E_HELM_OPTIONS ?= --set image.azuredisk.repository=$(REGISTRY)/$(IMAGE_NAME) --set image.azuredisk.tag=$(IMAGE_VERSION) --set image.azuredisk.pullPolicy=Always
E2E_HELM_OPTIONS ?= --set image.azuredisk.repository=$(REGISTRY)/$(IMAGE_NAME) --set image.azuredisk.tag=$(IMAGE_VERSION) --set image.azuredisk.pullPolicy=Always --set driver.userAgentSuffix="e2e-test"
E2E_HELM_OPTIONS += ${EXTRA_HELM_OPTIONS}
GINKGO_FLAGS = -ginkgo.v
ifeq ($(ENABLE_TOPOLOGY), true)
Expand All @@ -59,14 +59,14 @@ ALL_OS = linux windows
ALL_ARCH.linux = amd64 arm64
ALL_OS_ARCH.linux = $(foreach arch, ${ALL_ARCH.linux}, linux-$(arch))
ALL_ARCH.windows = amd64
ALL_OSVERSIONS.windows := 1809 1903 1909 2004
ALL_OSVERSIONS.windows := 1809 1903 1909 2004 20H2 ltsc2022
ALL_OS_ARCH.windows = $(foreach arch, $(ALL_ARCH.windows), $(foreach osversion, ${ALL_OSVERSIONS.windows}, windows-${osversion}-${arch}))
ALL_OS_ARCH = $(foreach os, $(ALL_OS), ${ALL_OS_ARCH.${os}})

# The current context of image building
# The architecture of the image
ARCH ?= amd64
# OS Version for the Windows images: 1809, 1903, 1909, 2004
# OS Version for the Windows images: 1809, 1903, 1909, 2004, ltsc2022
OSVERSION ?= 1809
# Output type of docker buildx build
OUTPUT_TYPE ?= registry
Expand Down Expand Up @@ -137,27 +137,27 @@ e2e-teardown:

.PHONY: azuredisk
azuredisk:
CGO_ENABLED=0 GOOS=linux go build -a -ldflags ${LDFLAGS} -mod vendor -o _output/${ARCH}/${PLUGIN_NAME} ./pkg/azurediskplugin
CGO_ENABLED=0 GOOS=linux GOARCH=$(ARCH) go build -a -ldflags ${LDFLAGS} -mod vendor -o _output/${ARCH}/${PLUGIN_NAME} ./pkg/azurediskplugin

.PHONY: azuredisk-v2
azuredisk-v2:
BUILD_V2=1 $(MAKE) azuredisk
BUILD_V2=true $(MAKE) azuredisk

.PHONY: azuredisk-windows
azuredisk-windows:
CGO_ENABLED=0 GOOS=windows go build -a -ldflags ${LDFLAGS} -mod vendor -o _output/${ARCH}/${PLUGIN_NAME}.exe ./pkg/azurediskplugin

.PHONY: azuredisk-windows-v2
azuredisk-windows-v2:
BUILD_V2=1 $(MAKE) azuredisk
BUILD_V2=true $(MAKE) azuredisk

.PHONY: azuredisk-darwin
azuredisk-darwin:
CGO_ENABLED=0 GOOS=darwin go build -a -ldflags ${LDFLAGS} -mod vendor -o _output/${ARCH}/${PLUGIN_NAME}.exe ./pkg/azurediskplugin

.PHONY: container
container: azuredisk
docker build --no-cache -t $(IMAGE_TAG) -f ./pkg/azurediskplugin/dev.Dockerfile .
docker build --no-cache -t $(IMAGE_TAG) --output=type=docker -f ./pkg/azurediskplugin/Dockerfile .

.PHONY: container-linux
container-linux:
Expand Down Expand Up @@ -206,19 +206,25 @@ push-manifest:
docker manifest create --amend $(IMAGE_TAG) $(foreach osarch, $(ALL_OS_ARCH), $(IMAGE_TAG)-${osarch})
# add "os.version" field to windows images (based on https://github.com/kubernetes/kubernetes/blob/master/build/pause/Makefile)
set -x; \
registry_prefix=$(shell (echo ${REGISTRY} | grep -Eq ".*[\/\.].*") && echo "" || echo "docker.io/"); \
manifest_image_folder=`echo "$${registry_prefix}${IMAGE_TAG}" | sed "s|/|_|g" | sed "s/:/-/"`; \
for arch in $(ALL_ARCH.windows); do \
for osversion in $(ALL_OSVERSIONS.windows); do \
BASEIMAGE=mcr.microsoft.com/windows/nanoserver:$${osversion}; \
full_version=`docker manifest inspect $${BASEIMAGE} | jq -r '.manifests[0].platform["os.version"]'`; \
sed -i -r "s/(\"os\"\:\"windows\")/\0,\"os.version\":\"$${full_version}\"/" "${HOME}/.docker/manifests/$${manifest_image_folder}/$${manifest_image_folder}-windows-$${osversion}-$${arch}"; \
docker manifest annotate --os windows --arch $${arch} --os-version $${full_version} $(IMAGE_TAG) $(IMAGE_TAG)-windows-$${osversion}-$${arch}; \
done; \
done
docker manifest push --purge $(IMAGE_TAG)
docker manifest inspect $(IMAGE_TAG)
ifdef PUBLISH
docker manifest create $(IMAGE_TAG_LATEST) $(foreach osarch, $(ALL_OS_ARCH), $(IMAGE_TAG)-${osarch})
set -x; \
for arch in $(ALL_ARCH.windows); do \
for osversion in $(ALL_OSVERSIONS.windows); do \
BASEIMAGE=mcr.microsoft.com/windows/nanoserver:$${osversion}; \
full_version=`docker manifest inspect $${BASEIMAGE} | jq -r '.manifests[0].platform["os.version"]'`; \
docker manifest annotate --os windows --arch $${arch} --os-version $${full_version} $(IMAGE_TAG_LATEST) $(IMAGE_TAG)-windows-$${osversion}-$${arch}; \
done; \
done
docker manifest inspect $(IMAGE_TAG_LATEST)
endif

Expand Down
119 changes: 80 additions & 39 deletions README.md
@@ -1,76 +1,117 @@
# Azure Disk CSI driver for Kubernetes

[![Travis](https://travis-ci.org/kubernetes-sigs/azuredisk-csi-driver.svg)](https://travis-ci.org/kubernetes-sigs/azuredisk-csi-driver)
[![Coverage Status](https://coveralls.io/repos/github/kubernetes-sigs/azuredisk-csi-driver/badge.svg?branch=master)](https://coveralls.io/github/kubernetes-sigs/azuredisk-csi-driver?branch=master)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fkubernetes-sigs%2Fazuredisk-csi-driver.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fkubernetes-sigs%2Fazuredisk-csi-driver?ref=badge_shield)

### About

This driver allows Kubernetes to use [Azure Disk](https://azure.microsoft.com/en-us/services/storage/disks/) volume, csi plugin name: `disk.csi.azure.com`

### Project status: GA
### Project status

V1: GA

V2: Preview

### Container Images & Kubernetes Compatibility
|Driver Version |Image | supported k8s version |
|----------------|------------------------------------------------|-----------------------|
|master branch |mcr.microsoft.com/k8s/csi/azuredisk-csi:latest | 1.18+ |
|v1.5.1 |mcr.microsoft.com/k8s/csi/azuredisk-csi:v1.5.1 | 1.18+ |
|v1.4.0 |mcr.microsoft.com/k8s/csi/azuredisk-csi:v1.4.0 | 1.18+ |
|v1.2.0 |mcr.microsoft.com/k8s/csi/azuredisk-csi:v1.2.0 | 1.17+ |

#### V1

|Driver Version |Image | supported k8s version |
|----------------|----------------------------------------------------------|-----------------------|
|`master` branch |mcr.microsoft.com/k8s/csi/azuredisk-csi:latest | 1.19+ |
|v1.9.0 |mcr.microsoft.com/oss/kubernetes-csi/azuredisk-csi:v1.9.0 | 1.19+ |
|v1.8.0 |mcr.microsoft.com/oss/kubernetes-csi/azuredisk-csi:v1.8.0 | 1.18+ |
|v1.7.0 |mcr.microsoft.com/oss/kubernetes-csi/azuredisk-csi:v1.7.0 | 1.18+ |

#### V2

|Driver Version |Image | supported k8s version |
|----------------|-----------------------------------------------------------------|-----------------------|
|`main_v2` branch| | 1.21+ |
|v2.0.0-alpha.1 |mcr.microsoft.com/oss/kubernetes-csi/azuredisk-csi:v2.0.0-alpha.1| 1.21+ |

### Driver parameters

Please refer to [`disk.csi.azure.com` driver parameters](./docs/driver-parameters.md)
> storage class `disk.csi.azure.com` parameters are compatible with built-in [azuredisk](https://kubernetes.io/docs/concepts/storage/volumes/#azuredisk) plugin
> storage class `disk.csi.azure.com` parameters are compatible with built-in [azuredisk](https://kubernetes.io/docs/concepts/storage/volumes/#azuredisk) plugin
### Set up CSI driver on AKS cluster (only for AKS users)

follow guide [here](./docs/install-driver-on-aks.md)

### Prerequisite
- The driver depends on [cloud provider config file](https://kubernetes-sigs.github.io/cloud-provider-azure/install/configs/#setting-azure-cloud-provider-from-kubernetes-secrets), usually it's `/etc/kubernetes/azure.json` on all kubernetes nodes deployed by [AKS](https://docs.microsoft.com/en-us/azure/aks/) or [aks-engine](https://github.com/Azure/aks-engine), here is [azure.json example](./deploy/example/azure.json).
> To specify a different cloud provider config file, create `azure-cred-file` configmap before driver installation, e.g. for OpenShift, it's `/etc/kubernetes/cloud.conf` (make sure config file path is in the `volumeMounts.mountPath`)
> ```console
> kubectl create configmap azure-cred-file --from-literal=path="/etc/kubernetes/cloud.conf" --from-literal=path-windows="C:\\k\\cloud.conf" -n kube-system
> ```
- This driver also supports [read cloud config from kuberenetes secret](./docs/read-from-secret.md).
- If cluster identity is [Managed Service Identity(MSI)](https://docs.microsoft.com/en-us/azure/aks/use-managed-identity), make sure user assigned identity has `Contributor` role on node resource group
- [Set up CSI driver on Azure RedHat OpenShift(ARO)](https://github.com/ezYakaEagle442/aro-pub-storage/blob/master/setup-store-CSI-driver-azure-disk.md)

- The driver depends on [cloud provider config file](https://kubernetes-sigs.github.io/cloud-provider-azure/install/configs/#setting-azure-cloud-provider-from-kubernetes-secrets), usually it's `/etc/kubernetes/azure.json` on all kubernetes nodes deployed by [AKS](https://docs.microsoft.com/en-us/azure/aks/) or [aks-engine](https://github.com/Azure/aks-engine), here is [azure.json example](./deploy/example/azure.json).
> To specify a different cloud provider config file, create `azure-cred-file` configmap before driver installation, e.g. for OpenShift, it's `/etc/kubernetes/cloud.conf` (make sure config file path is in the `volumeMounts.mountPath`)
>
> ```console
> kubectl create configmap azure-cred-file --from-literal=path="/etc/kubernetes/cloud.conf" --from-literal=path-windows="C:\\k\\cloud.conf" -n kube-system
> ```
>
- This driver also supports [read cloud config from kuberenetes secret](./docs/read-from-secret.md).
- If cluster identity is [Managed Service Identity(MSI)](https://docs.microsoft.com/en-us/azure/aks/use-managed-identity), make sure user assigned identity has `Contributor` role on node resource group
- When installing side-by-side with an earlier version of the driver on an AKS cluster, ensure the agentpool service principal or managed service identity is assigned to the `Contributor` role on the resource groups used to store managed disks.
- [Set up CSI driver on Azure RedHat OpenShift(ARO)](https://github.com/ezYakaEagle442/aro-pub-storage/blob/master/setup-store-CSI-driver-azure-disk.md)
### Install driver on a Kubernetes cluster
- install via [kubectl](./docs/install-azuredisk-csi-driver.md) on public Azure (please use helm for Azure Stack, RedHat/CentOS)
- install via [helm charts](./charts) on public Azure, Azure Stack, RedHat/CentOS
- install via [kubectl](./docs/install-azuredisk-csi-driver.md) on public Azure (please use helm for Azure Stack, RedHat/CentOS)
- install via [helm charts](./charts) on public Azure, Azure Stack, RedHat/CentOS
### Install Azure Disk CSI Driver V2 on a Kubernetes cluster (Preview)
- install via [helm charts](./charts)
### Examples
- [Basic usage](./deploy/example/e2e_usage.md)
- [Basic usage](./deploy/example/e2e_usage.md)
### Features
- [Topology(Availability Zone)](./deploy/example/topology)
- [ZRS disk support(Preview)](./deploy/example/topology#zrs-disk-support)
- [Snapshot](./deploy/example/snapshot)
- [Volume Cloning](./deploy/example/cloning)
- [Volume Expansion](./deploy/example/resize)
- [Raw Block Volume](./deploy/example/rawblock)
- [Windows](./deploy/example/windows)
- [Shared Disk](./deploy/example/sharedisk)
- [Volume Limits](./deploy/example/volumelimits)
- [fsGroupPolicy](./deploy/example/fsgroup)
- [Topology (Availability Zone)](./deploy/example/topology)
- [ZRS disk support](./deploy/example/topology#zrs-disk-support)
- [Snapshot](./deploy/example/snapshot)
- [Volume Cloning](./deploy/example/cloning)
- [Volume Expansion](./deploy/example/resize)
- [Raw Block Volume](./deploy/example/rawblock)
- [Windows](./deploy/example/windows)
- [Shared Disk](./deploy/example/sharedisk)
- [Volume Limits](./deploy/example/volumelimits)
- [fsGroupPolicy](./deploy/example/fsgroup)
- [Tune disk performance on Linux](./docs/enhancements/feat-add-ability-to-tune-azuredisk-performance-parameters.md)
#### New in V2
- [Attachments Replicas for Faster Pod Failover (Preview)](./docs/design-v2.md)
- See [pod failover demo](./deploy/example/failover/README.md) for example configuration.
- [Advanced disk performance tuning (Preview)](./docs/perf-profiles.md)
### Troubleshooting
- [CSI driver troubleshooting guide](./docs/csi-debug.md)
- [CSI driver troubleshooting guide](./docs/csi-debug.md)
### Support
- Please see our [support policy][support-policy]
- Please see our [support policy][support-policy]
### Limitations
- Please refer to [Azure Disk CSI Driver Limitations](./docs/limitations.md)
- Please refer to [Azure Disk CSI Driver Limitations](./docs/limitations.md)
## Kubernetes Development
- Please refer to [development guide](./docs/csi-dev.md)
- Please refer to [development guide](./docs/csi-dev.md)
### View CI Results
- Check testgrid [provider-azure-azuredisk-csi-driver](https://testgrid.k8s.io/provider-azure-azuredisk-csi-driver) dashboard.
- Check testgrid [provider-azure-azuredisk-csi-driver](https://testgrid.k8s.io/provider-azure-azuredisk-csi-driver) dashboard.
### Links
- [Kubernetes CSI Documentation](https://kubernetes-csi.github.io/docs/)
- [CSI Drivers](https://github.com/kubernetes-csi/drivers)
- [Container Storage Interface (CSI) Specification](https://github.com/container-storage-interface/spec)
- [Kubernetes CSI Documentation](https://kubernetes-csi.github.io/docs/)
- [CSI Drivers](https://github.com/kubernetes-csi/drivers)
- [Container Storage Interface (CSI) Specification](https://github.com/container-storage-interface/spec)
[support-policy]: support.md

0 comments on commit 3d79d39

Please sign in to comment.