Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…nto master
  • Loading branch information
shiftstack-merge-bot committed Feb 27, 2023
2 parents af5c48d + a74385e commit 90fdc48
Show file tree
Hide file tree
Showing 47 changed files with 279 additions and 101 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -155,7 +155,7 @@ build-cmd-%: work $(SOURCES)
test: unit functional

check: work
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.46.1 run ./...
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2 run ./...

unit: work
go test -tags=unit $(shell go list ./... | sed -e '/sanity/ { N; d; }' | sed -e '/tests/ {N; d;}') $(TESTARGS)
Expand Down
2 changes: 1 addition & 1 deletion charts/cinder-csi-plugin/Chart.yaml
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
appVersion: latest
description: Cinder CSI Chart for OpenStack
name: openstack-cinder-csi
version: 2.3.0
version: 2.3.1
home: https://github.com/kubernetes/cloud-provider-openstack
icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png
maintainers:
Expand Down
Expand Up @@ -154,3 +154,7 @@ spec:
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
4 changes: 4 additions & 0 deletions charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml
Expand Up @@ -127,3 +127,7 @@ spec:
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
15 changes: 9 additions & 6 deletions charts/cinder-csi-plugin/values.yaml
Expand Up @@ -7,32 +7,32 @@ timeout: 3m
csi:
attacher:
image:
repository: k8s.gcr.io/sig-storage/csi-attacher
repository: registry.k8s.io/sig-storage/csi-attacher
tag: v4.0.0
pullPolicy: IfNotPresent
resources: {}
provisioner:
topology: "true"
image:
repository: k8s.gcr.io/sig-storage/csi-provisioner
repository: registry.k8s.io/sig-storage/csi-provisioner
tag: v3.4.0
pullPolicy: IfNotPresent
resources: {}
snapshotter:
image:
repository: k8s.gcr.io/sig-storage/csi-snapshotter
repository: registry.k8s.io/sig-storage/csi-snapshotter
tag: v6.1.0
pullPolicy: IfNotPresent
resources: {}
resizer:
image:
repository: k8s.gcr.io/sig-storage/csi-resizer
repository: registry.k8s.io/sig-storage/csi-resizer
tag: v1.6.0
pullPolicy: IfNotPresent
resources: {}
livenessprobe:
image:
repository: k8s.gcr.io/sig-storage/livenessprobe
repository: registry.k8s.io/sig-storage/livenessprobe
tag: v2.8.0
pullPolicy: IfNotPresent
failureThreshold: 5
Expand All @@ -42,7 +42,7 @@ csi:
resources: {}
nodeDriverRegistrar:
image:
repository: k8s.gcr.io/sig-storage/csi-node-driver-registrar
repository: registry.k8s.io/sig-storage/csi-node-driver-registrar
tag: v2.6.2
pullPolicy: IfNotPresent
resources: {}
Expand Down Expand Up @@ -139,3 +139,6 @@ storageClass:
clusterID: "kubernetes"

priorityClassName: ""

imagePullSecrets: []
# - name: my-imagepull-secret
8 changes: 4 additions & 4 deletions charts/manila-csi-plugin/values.yaml
Expand Up @@ -55,7 +55,7 @@ nodeplugin:
# csi-node-driver-registrar
registrar:
image:
repository: k8s.gcr.io/sig-storage/csi-node-driver-registrar
repository: registry.k8s.io/sig-storage/csi-node-driver-registrar
tag: v2.4.0
pullPolicy: IfNotPresent
resources: {}
Expand All @@ -75,7 +75,7 @@ controllerplugin:
# CSI external-provisioner container spec
provisioner:
image:
repository: k8s.gcr.io/sig-storage/csi-provisioner
repository: registry.k8s.io/sig-storage/csi-provisioner
tag: v3.0.0
pullPolicy: IfNotPresent
resources: {}
Expand All @@ -84,14 +84,14 @@ controllerplugin:
# CSI external-snapshotter container spec
snapshotter:
image:
repository: k8s.gcr.io/sig-storage/csi-snapshotter
repository: registry.k8s.io/sig-storage/csi-snapshotter
tag: v5.0.1
pullPolicy: IfNotPresent
resources: {}
# CSI external-resizer container spec
resizer:
image:
repository: k8s.gcr.io/sig-storage/csi-resizer
repository: registry.k8s.io/sig-storage/csi-resizer
tag: v1.3.0
pullPolicy: IfNotPresent
resources: {}
Expand Down
2 changes: 1 addition & 1 deletion charts/openstack-cloud-controller-manager/Chart.yaml
Expand Up @@ -4,7 +4,7 @@ description: Openstack Cloud Controller Manager Helm Chart
icon: https://object-storage-ca-ymq-1.vexxhost.net/swift/v1/6e4619c416ff4bd19e1c087f27a43eea/www-images-prod/openstack-logo/OpenStack-Logo-Vertical.png
home: https://github.com/kubernetes/cloud-provider-openstack
name: openstack-cloud-controller-manager
version: 1.4.0
version: 1.5.0
maintainers:
- name: morremeyer
email: kubernetes@maurice-meyer.de
Expand Down
Expand Up @@ -2,6 +2,10 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: system:openstack-cloud-controller-manager
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
- apiGroups:
- coordination.k8s.io
Expand Down
Expand Up @@ -3,6 +3,10 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: system:{{ include "occm.name" . }}:auth-delegate
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
subjects:
- kind: User
name: system:serviceaccount:{{ .Release.Namespace }}:{{ include "occm.name" . }}
Expand Down
Expand Up @@ -2,6 +2,10 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: system:openstack-cloud-controller-manager
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
Expand Up @@ -5,6 +5,10 @@ metadata:
namespace: {{ .Release.Namespace }}
labels:
{{- include "occm.labels" . | nindent 4 }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
selector:
matchLabels:
Expand All @@ -17,6 +21,10 @@ spec:
checksum/config: {{ include "cloudConfig" . | sha256sum }}
labels:
{{- include "occm.controllermanager.labels" . | nindent 8 }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.nodeSelector }}
nodeSelector:
Expand Down
20 changes: 12 additions & 8 deletions charts/openstack-cloud-controller-manager/templates/secret.yaml
Expand Up @@ -2,14 +2,18 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.secret.name | default "cloud-config" }}
namespace: {{ .Release.Namespace }}
name: {{ .Values.secret.name | default "cloud-config" }}
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
type: Opaque
data:
{{ if .Values.cloudConfigContents -}}
cloud.conf: |
{{ .Values.cloudConfigContents | b64enc }}
{{ else -}}
cloud.conf: {{ include "cloudConfig" . | b64enc }}
{{ end -}}
{{ if .Values.cloudConfigContents -}}
cloud.conf: |
{{ .Values.cloudConfigContents | b64enc }}
{{ else -}}
cloud.conf: {{ include "cloudConfig" . | b64enc }}
{{ end -}}
{{- end }}
Expand Up @@ -6,6 +6,10 @@ metadata:
{{- include "occm.labels" . | nindent 4 }}
name: {{ include "occm.name" . }}
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ports:
- name: http
Expand Down
Expand Up @@ -3,3 +3,7 @@ kind: ServiceAccount
metadata:
name: openstack-cloud-controller-manager
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Up @@ -6,6 +6,10 @@ metadata:
{{- include "occm.labels" . | nindent 4 }}
name: {{ include "occm.name" . }}
namespace: {{ .Release.Namespace }}
annotations:
{{- with .Values.commonAnnotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
Expand Down
7 changes: 7 additions & 0 deletions charts/openstack-cloud-controller-manager/values.yaml
Expand Up @@ -2,6 +2,13 @@
#
# Define deployment mode for the controller and provide cloud credentials in cloudConfig at the end of the file
#
## Annotations to apply to all resources
commonAnnotations: {}
# commonAnnotations:
# "helm.sh/hook": pre-install,pre-upgrade
# "helm.sh/hook-weight": "-100"
# "helm.sh/hook-delete-policy": before-hook-creation

# Image repository name and tag
image:
repository: docker.io/k8scloudprovider/openstack-cloud-controller-manager
Expand Down
23 changes: 23 additions & 0 deletions cloudbuild.yaml
@@ -0,0 +1,23 @@
# See https://cloud.google.com/cloud-build/docs/build-config

# this must be specified in seconds. If omitted, defaults to 600s (10 mins)
timeout: 1200s
# this prevents errors if you don't use both _GIT_TAG and _PULL_BASE_REF,
# or any new substitutions added in the future.
options:
substitution_option: ALLOW_LOOSE
steps:
- name: gcr.io/k8s-staging-test-infra/gcb-docker-gcloud:v20220609-2e4c91eb7e
entrypoint: make
env:
- REGISTRY=gcr.io/k8s-staging-cloud-provider-os
- VERSION=$_GIT_TAG
args:
- upload-images
substitutions:
# _GIT_TAG will be filled with a git-based tag for the image, of the form
# vYYYYMMDD-hash, and can be used as a substitution
_GIT_TAG: '12345'
# _PULL_BASE_REF will contain the ref that was pushed to to trigger this
# build - a branch like 'master' or 'release-0.2', or a tag like 'v0.2'.
_PULL_BASE_REF: 'master'
2 changes: 1 addition & 1 deletion cluster/images/cinder-csi-plugin/Dockerfile
Expand Up @@ -13,7 +13,7 @@
ARG DEBIAN_ARCH=amd64
# We not using scratch because we need to keep the basic image information
# from parent image
FROM k8s.gcr.io/build-image/debian-base-${DEBIAN_ARCH}:bullseye-v1.4.2
FROM registry.k8s.io/build-image/debian-base-${DEBIAN_ARCH}:bullseye-v1.4.3

ARG ARCH=amd64

Expand Down
2 changes: 1 addition & 1 deletion cluster/images/cinder-csi-plugin/Dockerfile.build
@@ -1,5 +1,5 @@
ARG DEBIAN_ARCH=amd64
FROM k8s.gcr.io/build-image/debian-base-${DEBIAN_ARCH}:bullseye-v1.4.2
FROM registry.k8s.io/build-image/debian-base-${DEBIAN_ARCH}:bullseye-v1.4.3

ARG ARCH=amd64

Expand Down
13 changes: 7 additions & 6 deletions cmd/cinder-csi-plugin/main.go
Expand Up @@ -32,10 +32,11 @@ import (
)

var (
endpoint string
nodeID string
cloudconfig []string
cluster string
endpoint string
nodeID string
cloudconfig []string
cluster string
httpEndpoint string
)

func main() {
Expand Down Expand Up @@ -88,7 +89,7 @@ func main() {
}

cmd.PersistentFlags().StringVar(&cluster, "cluster", "", "The identifier of the cluster that the plugin is running in.")

cmd.PersistentFlags().StringVar(&httpEndpoint, "http-endpoint", "", "The TCP network address where the HTTP server for diagnostics, including metrics and leader election health check, will listen (example: `:8080`). The default is empty string, which means the server is disabled.")
openstack.AddExtraFlags(pflag.CommandLine)

code := cli.Run(cmd)
Expand All @@ -99,7 +100,7 @@ func handle() {

// Initialize cloud
d := cinder.NewDriver(endpoint, cluster)
openstack.InitOpenStackProvider(cloudconfig)
openstack.InitOpenStackProvider(cloudconfig, httpEndpoint)
cloud, err := openstack.GetOpenStackProvider()
if err != nil {
klog.Warningf("Failed to GetOpenStackProvider: %v", err)
Expand Down
43 changes: 41 additions & 2 deletions docs/cinder-csi-plugin/examples.md
Expand Up @@ -101,9 +101,11 @@ $ mount /dev/vdb /mnt; ls /mnt
index.html lost+found
```

## Deploy app using Inline volumes
## Deploy app using ephemeral volumes

Sample App definition on using Inline volumes can be found at [here](../../examples/cinder-csi-plugin/ephemeral/csi-ephemeral-volumes-example.yaml)
### CSI Ephemeral Volumes

Sample App definition on using CSI ephemeral volumes can be found at [here](../../examples/cinder-csi-plugin/ephemeral/csi-ephemeral-volumes-example.yaml)

Prerequisites:
* Deploy CSI Driver, with both volumeLifecycleModes enabled as specified [here](../../manifests/cinder-csi-plugin/csi-cinder-driver.yaml)
Expand All @@ -130,6 +132,43 @@ Volumes:
```

### Generic Ephemeral Volumes

Sample App definition on using generic ephemeral volumes can be found at [here](../../examples/cinder-csi-plugin/ephemeral/generic-ephemeral-volumes.yaml)

Create a pod with ephemeral volume and storage class

```
# kubectl create -f examples/cinder-csi-plugin/ephemeral/generic-ephemeral-volumes.yaml
storageclass.storage.k8s.io/scratch-storage-class created
pod/ephemeral-example created
```

```
# kubectl get pods -A
NAMESPACE NAME READY STATUS RESTARTS AGE
default ephemeral-example 1/1 Running 0 28s
```

we can find pv/pvc/volumes created just like general volume.

```
# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
ephemeral-example-scratch-volume Bound pvc-9848ed86-8aa1-439b-9839-9ceba6e6f653 1Gi RWO scratch-storage-class 32s
# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-9848ed86-8aa1-439b-9839-9ceba6e6f653 1Gi RWO Delete Bound default/ephemeral-example-scratch-volume scratch-storage-class 35s
# cinder list
+--------------------------------------+-----------+------------------------------------------+------+-------------+----------+--------------------------------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+------------------------------------------+------+-------------+----------+--------------------------------------+
| 7f4a09de-a8a9-4b89-9b70-d01028fcb789 | in-use | pvc-9848ed86-8aa1-439b-9839-9ceba6e6f653 | 1 | lvmdriver-1 | false | d438644c-864e-4b36-8a6e-794d35902f97 |
+--------------------------------------+-----------+------------------------------------------+------+-------------+----------+--------------------------------------+
```

## Volume Expansion Example

Sample App definition for volume resize could be found [here](../../examples/cinder-csi-plugin/resize/example.yaml)
Expand Down

0 comments on commit 90fdc48

Please sign in to comment.