Skip to content

Commit

Permalink
Merge pull request ceph#8 from red-hat-storage/sync_us--main
Browse files Browse the repository at this point in the history
Syncing latest changes from upstream main for ceph-csi-operator
  • Loading branch information
openshift-merge-bot[bot] authored Aug 6, 2024
2 parents 5074691 + 204ddfa commit 3366295
Show file tree
Hide file tree
Showing 610 changed files with 71,052 additions and 24,377 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ jobs:
go-version-file: go.mod
- name: run make build
run: make build
- name: Check for uncommitted changes
run: make check-all-committed
- name: Show the uncommitted "git diff"
if: ${{ failure() }}
run: git diff ; false
14 changes: 14 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,17 @@ jobs:
check-latest: true
- name: govulncheck
uses: golang/govulncheck-action@v1

shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
severity: warning
check_together: 'yes'
ignore_paths: 'vendor'
disable_matcher: false
format: gcc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: setup-ceph-cluster
name: test-ceph-csi-operator
on:
pull_request:
branches:
Expand All @@ -16,7 +16,7 @@ concurrency:
cancel-in-progress: true

jobs:
ceph-cluster:
test:
runs-on: ubuntu-latest
steps:
- name: checkout
Expand Down Expand Up @@ -50,3 +50,6 @@ jobs:

- name: create ceph cluster
run: test/scripts/github-action-helper.sh deploy_rook

- name: test ceph-csi-operator
run: test/scripts/test-ceph-csi-operator.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ go.work.sum
*.orig
*.patch
*.rej

# Locally generated install files
dist/
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.21 AS builder
FROM golang:1.22 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand All @@ -15,6 +15,7 @@ RUN go mod download
COPY cmd/main.go cmd/main.go
COPY api/ api/
COPY internal/controller/ internal/controller/
COPY internal/utils/ internal/utils/

# Build
# the GOARCH has not a default value to allow the binary be built according to the host where the command
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ envtest: $(ENVTEST) ## Download setup-envtest locally if necessary.
$(ENVTEST): $(LOCALBIN)
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest,$(ENVTEST_VERSION))

.PHONY: check-all-committed
check-all-committed: ## Fail in case there are uncommitted changes
test -z "$(shell git status --short)" || (echo "files were modified: " ; git status --short ; false)

.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
Expand Down
15 changes: 12 additions & 3 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,27 @@ resources:
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ceph.io
group: csi
kind: CephCluster
controller: true
kind: CephConnection
path: github.com/ceph/ceph-csi-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
domain: ceph.io
group: csi
kind: ClientProfile
path: github.com/ceph/ceph-csi-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ceph.io
group: csi
kind: Config
kind: ClientProfileMapping
path: github.com/ceph/ceph-csi-operator/api/v1alpha1
version: v1alpha1
version: "3"
Original file line number Diff line number Diff line change
Expand Up @@ -22,41 +22,50 @@ import (

// ReadAffinitySpec capture Ceph CSI read affinity settings
type ReadAffinitySpec struct {
//+kubebuilder:validation:Required
//+kubebuilder:validation:MinItems:=1
CrushLocationLabels []string `json:"crushLocationLabels,omitempty"`
}

// CephClusterSpec defines the desired state of CephCluster
type CephClusterSpec struct {
Monitors []string `json:"monitors"`
ReadAffinity ReadAffinitySpec `json:"readAffinity,omitempty"`
RbdMirrorDaemonCount int `json:"rbdMirrorDaemonCount,omitempty"`
// CephConnectionSpec defines the desired state of CephConnection
type CephConnectionSpec struct {
//+kubebuilder:validation:Required
//+kubebuilder:validation:MinItems:=1
Monitors []string `json:"monitors"`

//+kubebuilder:validation:Optional
ReadAffinity *ReadAffinitySpec `json:"readAffinity,omitempty"`

//+kubebuilder:validation:Optional
//+kubebuilder:validation:Minimum:=1
RbdMirrorDaemonCount int `json:"rbdMirrorDaemonCount,omitempty"`
}

// CephClusterStatus defines the observed state of CephCluster
type CephClusterStatus struct {
// CephConnectionStatus defines the observed state of CephConnection
type CephConnectionStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// CephCluster is the Schema for the cephclusters API
type CephCluster struct {
// CephConnection is the Schema for the cephconnections API
type CephConnection struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CephClusterSpec `json:"spec,omitempty"`
Status CephClusterStatus `json:"status,omitempty"`
Spec CephConnectionSpec `json:"spec,omitempty"`
Status CephConnectionStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// CephClusterList contains a list of CephCluster
type CephClusterList struct {
// CephConnectionList contains a list of CephConnections
type CephConnectionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CephCluster `json:"items"`
Items []CephConnection `json:"items"`
}

func init() {
SchemeBuilder.Register(&CephCluster{}, &CephClusterList{})
SchemeBuilder.Register(&CephConnection{}, &CephConnectionList{})
}
93 changes: 93 additions & 0 deletions api/v1alpha1/clientprofile_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
Copyright 2024.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// CephFsConfigSpec defines the desired CephFs configuration
type CephFsConfigSpec struct {
//+kubebuilder:validation:Optional
SubVolumeGroup string `json:"subVolumeGroup,omitempty"`

//+kubebuilder:validation:Optional
KernelMountOptions map[string]string `json:"kernelMountOptions,omitempty"`

//+kubebuilder:validation:Optional
FuseMountOptions map[string]string `json:"fuseMountOptions,omitempty"`
}

// RbdConfigSpec defines the desired RBD configuration
type RbdConfigSpec struct {
//+kubebuilder:validation:Optional
RadosNamespace string `json:"radosNamespace,omitempty"`
}

// NfsConfigSpec cdefines the desired NFS configuration
type NfsConfigSpec struct {
}

// ClientProfileSpec defines the desired state of Ceph CSI
// configuration for volumes and snapshots configured to use
// this profile
type ClientProfileSpec struct {
//+kubebuilder:validation:Required
//+kubebuilder:validation:XValidation:rule=self.name != "",message="'.name' cannot be empty"
CephConnectionRef corev1.LocalObjectReference `json:"cephConnectionRef"`

//+kubebuilder:validation:Optional
CephFs *CephFsConfigSpec `json:"cephFs,omitempty"`

//+kubebuilder:validation:Optional
Rbd *RbdConfigSpec `json:"rbd,omitempty"`

//+kubebuilder:validation:Optional
Nfs *NfsConfigSpec `json:"nfs,omitempty"`
}

// ClientProfileStatus defines the observed state of Ceph CSI
// configuration for volumes and snapshots configured to use
// this profile
type ClientProfileStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// ClientProfile is the Schema for the clientprofiles API
type ClientProfile struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ClientProfileSpec `json:"spec,omitempty"`
Status ClientProfileStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ClientProfileList contains a list of ClientProfile
type ClientProfileList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClientProfile `json:"items"`
}

func init() {
SchemeBuilder.Register(&ClientProfile{}, &ClientProfileList{})
}
75 changes: 75 additions & 0 deletions api/v1alpha1/clientprofilemapping_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
Copyright 2024.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// BlockPoolRefSpec identify a blockpool - client profile pair
type BlockPoolRefSpec struct {
//+kubebuilder:validation:Required
ClientProfileName string `json:"clientProfileName,omitempty"`

//+kubebuilder:validation:Required
//+kubebuilder:validation:Minimum:=0
PoolId int `json:"poolId,omitempty"`
}

// BlockPoolMappingSpec define a mapiing between a local and remote block pools
type BlockPoolMappingSpec struct {
//+kubebuilder:validation:Required
Local BlockPoolRefSpec `json:"local,omitempty"`

//+kubebuilder:validation:Required
Remote BlockPoolRefSpec `json:"remote,omitempty"`
}

// ClientProfileMappingSpec defines the desired state of ClientProfileMapping
type ClientProfileMappingSpec struct {
//+kubebuilder:validation:Optional
BlockPoolMapping []BlockPoolMappingSpec `json:"blockPoolMapping,omitempty"`
}

// ClientProfileMappingStatus defines the observed state of ClientProfileMapping
type ClientProfileMappingStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// ClientProfileMapping is the Schema for the clientprofilemappings API
type ClientProfileMapping struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ClientProfileMappingSpec `json:"spec,omitempty"`
Status ClientProfileMappingStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ClientProfileMappingList contains a list of ClientProfileMapping
type ClientProfileMappingList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClientProfileMapping `json:"items"`
}

func init() {
SchemeBuilder.Register(&ClientProfileMapping{}, &ClientProfileMappingList{})
}
Loading

0 comments on commit 3366295

Please sign in to comment.