From 7789d851f12fd380fa880b4aa6f024231fa65653 Mon Sep 17 00:00:00 2001 From: Divyansh Kamboj Date: Sat, 27 Jul 2024 10:27:27 +0530 Subject: [PATCH 1/2] api: make apis into a seperate package Signed-off-by: Divyansh Kamboj --- api/go.mod | 28 + api/go.sum | 105 ++ go.mod | 3 + .../api/v1alpha1/cephconnection_types.go | 71 ++ .../api/v1alpha1/clientprofile_types.go | 93 ++ .../v1alpha1/clientprofilemapping_types.go | 75 ++ .../api/v1alpha1/driver_types.go | 394 +++++++ .../api/v1alpha1/groupversion_info.go | 36 + .../api/v1alpha1/operatorconfig_types.go | 69 ++ .../api/v1alpha1/zz_generated.deepcopy.go | 1049 +++++++++++++++++ vendor/modules.txt | 4 + 11 files changed, 1927 insertions(+) create mode 100644 api/go.mod create mode 100644 api/go.sum create mode 100644 vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/cephconnection_types.go create mode 100644 vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofile_types.go create mode 100644 vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofilemapping_types.go create mode 100644 vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/driver_types.go create mode 100644 vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/groupversion_info.go create mode 100644 vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/operatorconfig_types.go create mode 100644 vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/zz_generated.deepcopy.go diff --git a/api/go.mod b/api/go.mod new file mode 100644 index 00000000..7d0def76 --- /dev/null +++ b/api/go.mod @@ -0,0 +1,28 @@ +module github.com/ceph/ceph-csi-operator/api + +go 1.22.0 + +toolchain go1.22.5 + +require ( + k8s.io/api v0.30.3 + k8s.io/apimachinery v0.30.3 + sigs.k8s.io/controller-runtime v0.18.4 +) + +require ( + github.com/go-logr/logr v1.4.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + golang.org/x/net v0.23.0 // indirect + golang.org/x/text v0.14.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + k8s.io/klog/v2 v2.120.1 // indirect + k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect +) diff --git a/api/go.sum b/api/go.sum new file mode 100644 index 00000000..d97807fc --- /dev/null +++ b/api/go.sum @@ -0,0 +1,105 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= +github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8= +github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= +github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk= +github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= +github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= +golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.30.3 h1:ImHwK9DCsPA9uoU3rVh4QHAHHK5dTSv1nxJUapx8hoQ= +k8s.io/api v0.30.3/go.mod h1:GPc8jlzoe5JG3pb0KJCSLX5oAFIW3/qNJITlDj8BH04= +k8s.io/apimachinery v0.30.3 h1:q1laaWCmrszyQuSQCfNB8cFgCuDAoPszKY4ucAjDwHc= +k8s.io/apimachinery v0.30.3/go.mod h1:iexa2somDaxdnj7bha06bhb43Zpa6eWH8N8dbqVjTUc= +k8s.io/klog/v2 v2.120.1 h1:QXU6cPEOIslTGvZaXvFWiP9VKyeet3sawzTOvdXb4Vw= +k8s.io/klog/v2 v2.120.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b h1:sgn3ZU783SCgtaSJjpcVVlRqd6GSnlTLKgpAAttJvpI= +k8s.io/utils v0.0.0-20230726121419-3b25d923346b/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/controller-runtime v0.18.4 h1:87+guW1zhvuPLh1PHybKdYFLU0YJp4FhJRmiHvm5BZw= +sigs.k8s.io/controller-runtime v0.18.4/go.mod h1:TVoGrfdpbA9VRFaRnKgk9P5/atA0pMwq+f+msb9M8Sg= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1 h1:150L+0vs/8DA78h1u02ooW1/fFq/Lwr+sGiqlzvrtq4= +sigs.k8s.io/structured-merge-diff/v4 v4.4.1/go.mod h1:N8hJocpFajUSSeSJ9bOZ77VzejKZaXsTtZo4/u7Io08= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/go.mod b/go.mod index f68832f4..47438971 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.22.0 toolchain go1.22.5 require ( + github.com/ceph/ceph-csi-operator/api v0.0.0-00010101000000-000000000000 github.com/go-logr/logr v1.4.2 github.com/onsi/ginkgo/v2 v2.19.1 github.com/onsi/gomega v1.34.1 @@ -72,3 +73,5 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect sigs.k8s.io/yaml v1.4.0 // indirect ) + +replace github.com/ceph/ceph-csi-operator/api => ./api diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/cephconnection_types.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/cephconnection_types.go new file mode 100644 index 00000000..26e16cf9 --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/cephconnection_types.go @@ -0,0 +1,71 @@ +/* +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" +) + +// ReadAffinitySpec capture Ceph CSI read affinity settings +type ReadAffinitySpec struct { + //+kubebuilder:validation:Required + //+kubebuilder:validation:MinItems:=1 + CrushLocationLabels []string `json:"crushLocationLabels,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"` +} + +// CephConnectionStatus defines the observed state of CephConnection +type CephConnectionStatus struct { +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +// CephConnection is the Schema for the cephconnections API +type CephConnection struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec CephConnectionSpec `json:"spec,omitempty"` + Status CephConnectionStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// CephConnectionList contains a list of CephConnections +type CephConnectionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []CephConnection `json:"items"` +} + +func init() { + SchemeBuilder.Register(&CephConnection{}, &CephConnectionList{}) +} diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofile_types.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofile_types.go new file mode 100644 index 00000000..8f196e85 --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofile_types.go @@ -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{}) +} diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofilemapping_types.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofilemapping_types.go new file mode 100644 index 00000000..8263ff5e --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/clientprofilemapping_types.go @@ -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{}) +} diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/driver_types.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/driver_types.go new file mode 100644 index 00000000..bb58b0d1 --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/driver_types.go @@ -0,0 +1,394 @@ +/* +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 ( + appsv1 "k8s.io/api/apps/v1" + corev1 "k8s.io/api/core/v1" + storagev1 "k8s.io/api/storage/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type PeriodicityType string + +const ( + HourlyPeriod PeriodicityType = "hourly" + DailyPeriod PeriodicityType = "daily" + WeeklyPeriod PeriodicityType = "weekly" + MonthlyPeriod PeriodicityType = "monthly" +) + +type LogRotationSpec struct { + // MaxFiles is the number of logrtoate files + //+kubebuilder:validation:Optional + MaxFiles int `json:"maxFiles,omitempty"` + + // MaxLogSize is the maximum size of the log file per csi pods + //+kubebuilder:validation:Optional + MaxLogSize resource.Quantity `json:"maxLogSize,omitempty"` + + // Periodicity is the periodicity of the log rotation. + //+kubebuilder:validation:Optional + //+kubebuilder:validation:Enum:=hourly;daily;weekly;monthly + Periodicity PeriodicityType `json:"periodicity,omitempty"` + + // LogHostPath is the prefix directory path for the csi log files + //+kubebuilder:validation:Optional + LogHostPath string `json:"logHostPath,omitempty"` +} + +type LogSpec struct { + // Log verbosity level for driver pods, + // Supported values from 0 to 5. 0 for general useful logs (the default), 5 for trace level verbosity. + // Default to 0 + //+kubebuilder:validation:Minimum=0 + //+kubebuilder:validation:Maximum=5 + //+kubebuilder:validation:Optional + Verbosity int `json:"verbosity,omitempty"` + + // log rotation for csi pods + //+kubebuilder:validation:Optional + Rotation *LogRotationSpec `json:"rotation,omitempty"` +} + +type SnapshotPolicyType string + +const ( + // Disables the feature and remove the snapshotter sidercar + NoneSnapshotPolicy SnapshotPolicyType = "none" + + // Enable the volumegroupsnapshot feature (will results in deployment of a snapshotter sidecar) + VolumeGroupSnapshotPolicy SnapshotPolicyType = "volumeGroupSnapshot" + + // Enable the volumesnapshot feature (will results in deployment of a snapshotter sidecar) + VolumeSnapshotSnapshotPolicy SnapshotPolicyType = "volumeSnapshot" +) + +type EncryptionSpec struct { + //+kubebuilder:validation:Required + //+kubebuilder:validation:XValidation:rule=self.name != "",message="'.name' cannot be empty" + ConfigMapRef corev1.LocalObjectReference `json:"configMapName,omitempty"` +} + +type VolumeSpec struct { + //+kubebuilder:validation:Required + Volume corev1.Volume `json:"volume,omitempty"` + + //+kubebuilder:validation:Required + Mount corev1.VolumeMount `json:"mount,omitempty"` +} + +type PodCommonSpec struct { + // Service account name to be used for driver's pods + //+kubebuilder:validation:Optional + ServiceAccountName *string `json:"serviceAccountName,omitempty"` + + // Pod's user defined priority class name + //+kubebuilder:validation:Optional + PrioritylClassName *string `json:"priorityClassName,omitempty"` + + // Pod's labels + //+kubebuilder:validation:Optional + Labels map[string]string `json:"labels,omitempty"` + + // Pod's annotations + //+kubebuilder:validation:Optional + Annotations map[string]string `json:"annotations,omitempty"` + + // Pod's affinity settings + //+kubebuilder:validation:Optional + Affinity *corev1.Affinity `json:"affinity,omitempty"` + + // Pod's tolerations list + //+kubebuilder:validation:Optional + //+kubebuilder:validation:minItems:=1 + Tolerations []corev1.Toleration `json:"tolerations,omitempty"` + + // Volume and volume mount definitions to attach to the pod + //+kubebuilder:validation:Optional + //+kubebuilder:validation:minItems:=1 + Volumes []VolumeSpec `json:"volumes,omitempty"` + + // To indicate the image pull policy to be applied to all the containers in the csi driver pods. + //+kubebuilder:validation:Optional + ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy"` +} + +type NodePluginResourcesSpec struct { + //+kubebuilder:validation:Optional + Registrar *corev1.ResourceRequirements `json:"registrar,omitempty"` + + //+kubebuilder:validation:Optional + Liveness *corev1.ResourceRequirements `json:"liveness,omitempty"` + + //+kubebuilder:validation:Optional + Addons *corev1.ResourceRequirements `json:"addons,omitempty"` + + //+kubebuilder:validation:Optional + LogRotator *corev1.ResourceRequirements `json:"logRotator,omitempty"` + + //+kubebuilder:validation:Optional + Plugin *corev1.ResourceRequirements `json:"plugin,omitempty"` +} + +// TopologySpec defines the topology settings for the plugin pods +type TopologySpec struct { + // Domain labels define which node labels to use as domains for CSI nodeplugins to advertise their domains + //+kubebuilder:validation:Required + DomainLabels []string `json:"domainLabels,omitempty"` +} +type NodePluginSpec struct { + // Embedded common pods spec + PodCommonSpec `json:",inline"` + + // Driver's plugin daemonset update strategy, supported values are OnDelete and RollingUpdate. + // Default value is RollingUpdate with MaxAvailabile set to 1 + //+kubebuilder:validation:Optional + UpdateStrategy *appsv1.DaemonSetUpdateStrategy `json:"updateStrategy,omitempty"` + + // Resource requirements for plugin's containers + //+kubebuilder:validation:Optional + Resources NodePluginResourcesSpec `json:"resources,omitempty"` + + // kubelet directory path, if kubelet configured to use other than /var/lib/kubelet path. + //+kubebuilder:validation:Optional + KubeletDirPath string `json:"kubeletDirPath,omitempty"` + + // Control the host mount of /etc/selinux for csi plugin pods. Defaults to false + //+kubebuilder:validation:Optional + EnableSeLinuxHostMount *bool `json:"EnableSeLinuxHostMount,omitempty"` + // Topology settings for the plugin pods + //+kubebuilder:validation:Optional + Topology *TopologySpec `json:"topology,omitempty"` +} + +type ControllerPluginResourcesSpec struct { + //+kubebuilder:validation:Optional + Attacher *corev1.ResourceRequirements `json:"attacher,omitempty"` + + //+kubebuilder:validation:Optional + Snapshotter *corev1.ResourceRequirements `json:"snapshotter,omitempty"` + + //+kubebuilder:validation:Optional + Resizer *corev1.ResourceRequirements `json:"resizer,omitempty"` + + //+kubebuilder:validation:Optional + Provisioner *corev1.ResourceRequirements `json:"provisioner,omitempty"` + + //+kubebuilder:validation:Optional + OMapGenerator *corev1.ResourceRequirements `json:"omapGenerator,omitempty"` + + //+kubebuilder:validation:Optional + Liveness *corev1.ResourceRequirements `json:"liveness,omitempty"` + + //+kubebuilder:validation:Optional + Addons *corev1.ResourceRequirements `json:"addons,omitempty"` + + //+kubebuilder:validation:Optional + LogRotator *corev1.ResourceRequirements `json:"logRotator,omitempty"` + + //+kubebuilder:validation:Optional + Plugin *corev1.ResourceRequirements `json:"plugin,omitempty"` +} + +type ControllerPluginSpec struct { + // Embedded common pods spec + PodCommonSpec `json:",inline"` + + // Set replicas for controller plugin's deployment. Defaults to 2 + //+kubebuilder:validation:Optional + //+kubebuilder:validation:Minimum:=1 + Replicas *int32 `json:"replicas,omitempty"` + + // Resource requirements for controller plugin's containers + //+kubebuilder:validation:Optional + Resources ControllerPluginResourcesSpec `json:"resources,omitempty"` + + // To enable logrotation for csi pods, + // Some platforms require controller plugin to run privileged, + // For example, OpenShift with SELinux restrictions requires the pod to be privileged to write to hostPath. + //+kubebuilder:validation:Optional + Privileged *bool `json:"privileged,omitempty"` +} + +type LivenessSpec struct { + // Port to expose liveness metrics + //+kubebuilder:validation:Required + //+kubebuilder:validation:Minimum:=1024 + //+kubebuilder:validation:Maximum:=65535 + MetricsPort int `json:"metricsPort,omitempty"` +} + +type LeaderElectionSpec struct { + // Duration in seconds that non-leader candidates will wait to force acquire leadership. + // Default to 137 seconds. + //+kubebuilder:validation:Optional + //+kubebuilder:validation:Minimum:=0 + LeaseDuration int `json:"leaseDuration,omitempty"` + + // Deadline in seconds that the acting leader will retry refreshing leadership before giving up. + // Defaults to 107 seconds. + //+kubebuilder:validation:Optional + //+kubebuilder:validation:Minimum:=0 + RenewDeadline int `json:"renewDeadline,omitempty"` + + // Retry Period in seconds the LeaderElector clients should wait between tries of actions. + // Defaults to 26 seconds. + //+kubebuilder:validation:Optional + //+kubebuilder:validation:Minimum:=0 + RetryPeriod int `json:"retryPeriod,omitempty"` +} + +type CephFsClientType string + +const ( + AutoDetectCephFsClient CephFsClientType = "autodetect" + KernelCephFsClient CephFsClientType = "kernel" + + // Ceph CSI does not allow us to force Fuse client at this point + // FuseCephFsClient CephFsClientType = "fuse" +) + +// DriverSpec defines the desired state of Driver +type DriverSpec struct { + // Logging configuration for driver's pods + //+kubebuilder:validation:Optional + Log *LogSpec `json:"log,omitempty"` + + // A reference to a ConfigMap resource holding image overwrite for deployed + // containers + //+kubebuilder:validation:Optional + //+kubebuilder:validation:XValidation:rule=self.?name.orValue("") != "",message="'.name' cannot be empty" + ImageSet *corev1.LocalObjectReference `json:"imageSet,omitempty"` + + // Cluster name identifier to set as metadata on the CephFS subvolume and RBD images. This will be useful in cases + // when two container orchestrator clusters (Kubernetes/OCP) are using a single ceph cluster. + //+kubebuilder:validation:Optional + ClusterName *string `json:"clusterName,omitempty"` + + // Set to true to enable adding volume metadata on the CephFS subvolumes and RBD images. + // Not all users might be interested in getting volume/snapshot details as metadata on CephFS subvolume and RBD images. + // Hence enable metadata is false by default. + //+kubebuilder:validation:Optional + EnableMetadata *bool `json:"enableMetadata,omitempty"` + + // Set the gRPC timeout for gRPC call issued by the driver components + //+kubebuilder:validation:Optional + //+kubebuilder:validation:Minimum:=0 + GRpcTimeout int `json:"grpcTimeout,omitempty"` + + // Select a policy for snapshot behavior: none, autodetect, snapshot, sanpshotGroup + //+kubebuilder:validation:Optional + //+kubebuilder:validation:Enum:=none;autodetect;volumegroupsnapshot;volumesnapshot + SnapshotPolicy SnapshotPolicyType `json:"snapshotPolicy,omitempty"` + + // OMAP generator will generate the omap mapping between the PV name and the RBD image. + // Need to be enabled when we are using rbd mirroring feature. + // By default OMAP generator sidecar is deployed with Csi controller plugin pod, to disable + // it set it to false. + //+kubebuilder:validation:Optional + GenerateOMapInfo *bool `json:"generateOMapInfo,omitempty"` + + // Policy for modifying a volume's ownership or permissions when the PVC is being mounted. + // supported values are documented at https://kubernetes-csi.github.io/docs/support-fsgroup.html + //+kubebuilder:validation:Optional + FsGroupPolicy storagev1.FSGroupPolicy `json:"fsGroupPolicy,omitempty"` + + // Driver's encryption settings + //+kubebuilder:validation:Optional + Encryption *EncryptionSpec `json:"encryption,omitempty"` + + // Driver's plugin configuration + //+kubebuilder:validation:Optional + NodePlugin *NodePluginSpec `json:"nodePlugin,omitempty"` + + // Driver's controller plugin configuration + //+kubebuilder:validation:Optional + ControllerPlugin *ControllerPluginSpec `json:"controllerPlugin,omitempty"` + + // Whether to skip any attach operation altogether for CephCsi PVCs. + // See more details [here](https://kubernetes-csi.github.io/docs/skip-attach.html#skip-attach-with-csi-driver-object). + // If set to false it skips the volume attachments and makes the creation of pods using the CephCsi PVC fast. + // **WARNING** It's highly discouraged to use this for RWO volumes. for RBD PVC it can cause data corruption, + // csi-addons operations like Reclaimspace and PVC Keyrotation will also not be supported if set to false + // since we'll have no VolumeAttachments to determine which node the PVC is mounted on. + // Refer to this [issue](https://github.com/kubernetes/kubernetes/issues/103305) for more details. + //+kubebuilder:validation:Optional + AttachRequired *bool `json:"attachRequired,omitempty"` + + // Liveness metrics configuration. + // disabled by default. + //+kubebuilder:validation:Optional + Liveness *LivenessSpec `json:"liveness,omitempty"` + + // Leader election setting + //+kubebuilder:validation:Optional + LeaderElection *LeaderElectionSpec `json:"leaderElection,omitempty"` + + // TODO: do we want Csi addon specific field? or should we generalize to + // a list of additional sidecars? + //+kubebuilder:validation:Optional + DeployCsiAddons *bool `json:"deployCsiAddons,omitempty"` + + // Select between between cephfs kernel driver and ceph-fuse + // If you select a non-kernel client, your application may be disrupted during upgrade. + // See the upgrade guide: https://rook.io/docs/rook/latest/ceph-upgrade.html + // NOTE! cephfs quota is not supported in kernel version < 4.17 + //+kubebuilder:validation:Optional + //+kubebuilder:validation:Enum:=autodetect;kernel + CephFsClientType CephFsClientType `json:"cephFsClientType,omitempty"` + + // Set mount options to use https://docs.ceph.com/en/latest/man/8/mount.ceph/#options + // Set to "ms_mode=secure" when connections.encrypted is enabled in Ceph + //+kubebuilder:validation:Optional + KernelMountOptions map[string]string `json:"kernelMountOptions,omitempty"` + + // Set mount options to use when using the Fuse client + //+kubebuilder:validation:Optional + FuseMountOptions map[string]string `json:"fuseMountOptions,omitempty"` +} + +// DriverStatus defines the observed state of Driver +type DriverStatus struct { +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +// +kubebuilder:validation:XValidation:rule=self.metadata.name.matches('^(.+\\.)?(rbd|cephfs|nfs)?\\.csi\\.ceph\\.com$'),message=".metadata.name must match: '[.](rbd|cephfs|nfs).csi.ceph.com'" +// Driver is the Schema for the drivers API +type Driver struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec DriverSpec `json:"spec,omitempty"` + Status DriverStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// DriverList contains a list of Driver +type DriverList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Driver `json:"items"` +} + +func init() { + SchemeBuilder.Register(&Driver{}, &DriverList{}) +} diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/groupversion_info.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/groupversion_info.go new file mode 100644 index 00000000..4802b002 --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/groupversion_info.go @@ -0,0 +1,36 @@ +/* +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 contains API Schema definitions for the csi v1alpha1 API group +// +kubebuilder:object:generate=true +// +groupName=csi.ceph.io +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "csi.ceph.io", Version: "v1alpha1"} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/operatorconfig_types.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/operatorconfig_types.go new file mode 100644 index 00000000..5280a9be --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/operatorconfig_types.go @@ -0,0 +1,69 @@ +/* +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" +) + +// OperatorLogSpec provide log related settings for the operator +type OperatorLogSpec struct { + // Operator's log level + //+kubebuilder:validation:Optional + //+kubebuilder:validation:Minimum=0 + //+kubebuilder:validation:Maximum=3 + Verbosity int `json:"verbosity,omitempty"` +} + +// OperatorConfigSpec defines the desired state of OperatorConfig +type OperatorConfigSpec struct { + //+kubebuilder:validation:Optional + Log *OperatorLogSpec `json:"log,omitempty"` + + // Allow overwrite of hardcoded defaults for any driver managed by this operator + //+kubebuilder:validation:Optional + DriverSpecDefaults *DriverSpec `json:"driverSpecDefaults,omitempty"` +} + +// OperatorConfigStatus defines the observed state of OperatorConfig +type OperatorConfigStatus struct { +} + +//+kubebuilder:object:root=true +//+kubebuilder:subresource:status + +// OperatorConfig is the Schema for the operatorconfigs API +type OperatorConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec OperatorConfigSpec `json:"spec,omitempty"` + Status OperatorConfigStatus `json:"status,omitempty"` +} + +//+kubebuilder:object:root=true + +// OperatorConfigList contains a list of OperatorConfig +type OperatorConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []OperatorConfig `json:"items"` +} + +func init() { + SchemeBuilder.Register(&OperatorConfig{}, &OperatorConfigList{}) +} diff --git a/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/zz_generated.deepcopy.go b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000..38349493 --- /dev/null +++ b/vendor/github.com/ceph/ceph-csi-operator/api/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,1049 @@ +//go:build !ignore_autogenerated + +/* +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. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + appsv1 "k8s.io/api/apps/v1" + "k8s.io/api/core/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlockPoolMappingSpec) DeepCopyInto(out *BlockPoolMappingSpec) { + *out = *in + out.Local = in.Local + out.Remote = in.Remote +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockPoolMappingSpec. +func (in *BlockPoolMappingSpec) DeepCopy() *BlockPoolMappingSpec { + if in == nil { + return nil + } + out := new(BlockPoolMappingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *BlockPoolRefSpec) DeepCopyInto(out *BlockPoolRefSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockPoolRefSpec. +func (in *BlockPoolRefSpec) DeepCopy() *BlockPoolRefSpec { + if in == nil { + return nil + } + out := new(BlockPoolRefSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CephConnection) DeepCopyInto(out *CephConnection) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CephConnection. +func (in *CephConnection) DeepCopy() *CephConnection { + if in == nil { + return nil + } + out := new(CephConnection) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CephConnection) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CephConnectionList) DeepCopyInto(out *CephConnectionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]CephConnection, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CephConnectionList. +func (in *CephConnectionList) DeepCopy() *CephConnectionList { + if in == nil { + return nil + } + out := new(CephConnectionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *CephConnectionList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CephConnectionSpec) DeepCopyInto(out *CephConnectionSpec) { + *out = *in + if in.Monitors != nil { + in, out := &in.Monitors, &out.Monitors + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.ReadAffinity != nil { + in, out := &in.ReadAffinity, &out.ReadAffinity + *out = new(ReadAffinitySpec) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CephConnectionSpec. +func (in *CephConnectionSpec) DeepCopy() *CephConnectionSpec { + if in == nil { + return nil + } + out := new(CephConnectionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CephConnectionStatus) DeepCopyInto(out *CephConnectionStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CephConnectionStatus. +func (in *CephConnectionStatus) DeepCopy() *CephConnectionStatus { + if in == nil { + return nil + } + out := new(CephConnectionStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CephFsConfigSpec) DeepCopyInto(out *CephFsConfigSpec) { + *out = *in + if in.KernelMountOptions != nil { + in, out := &in.KernelMountOptions, &out.KernelMountOptions + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.FuseMountOptions != nil { + in, out := &in.FuseMountOptions, &out.FuseMountOptions + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CephFsConfigSpec. +func (in *CephFsConfigSpec) DeepCopy() *CephFsConfigSpec { + if in == nil { + return nil + } + out := new(CephFsConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientProfile) DeepCopyInto(out *ClientProfile) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientProfile. +func (in *ClientProfile) DeepCopy() *ClientProfile { + if in == nil { + return nil + } + out := new(ClientProfile) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClientProfile) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientProfileList) DeepCopyInto(out *ClientProfileList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClientProfile, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientProfileList. +func (in *ClientProfileList) DeepCopy() *ClientProfileList { + if in == nil { + return nil + } + out := new(ClientProfileList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClientProfileList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientProfileMapping) DeepCopyInto(out *ClientProfileMapping) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientProfileMapping. +func (in *ClientProfileMapping) DeepCopy() *ClientProfileMapping { + if in == nil { + return nil + } + out := new(ClientProfileMapping) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClientProfileMapping) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientProfileMappingList) DeepCopyInto(out *ClientProfileMappingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]ClientProfileMapping, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientProfileMappingList. +func (in *ClientProfileMappingList) DeepCopy() *ClientProfileMappingList { + if in == nil { + return nil + } + out := new(ClientProfileMappingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *ClientProfileMappingList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientProfileMappingSpec) DeepCopyInto(out *ClientProfileMappingSpec) { + *out = *in + if in.BlockPoolMapping != nil { + in, out := &in.BlockPoolMapping, &out.BlockPoolMapping + *out = make([]BlockPoolMappingSpec, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientProfileMappingSpec. +func (in *ClientProfileMappingSpec) DeepCopy() *ClientProfileMappingSpec { + if in == nil { + return nil + } + out := new(ClientProfileMappingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientProfileMappingStatus) DeepCopyInto(out *ClientProfileMappingStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientProfileMappingStatus. +func (in *ClientProfileMappingStatus) DeepCopy() *ClientProfileMappingStatus { + if in == nil { + return nil + } + out := new(ClientProfileMappingStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientProfileSpec) DeepCopyInto(out *ClientProfileSpec) { + *out = *in + out.CephConnectionRef = in.CephConnectionRef + if in.CephFs != nil { + in, out := &in.CephFs, &out.CephFs + *out = new(CephFsConfigSpec) + (*in).DeepCopyInto(*out) + } + if in.Rbd != nil { + in, out := &in.Rbd, &out.Rbd + *out = new(RbdConfigSpec) + **out = **in + } + if in.Nfs != nil { + in, out := &in.Nfs, &out.Nfs + *out = new(NfsConfigSpec) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientProfileSpec. +func (in *ClientProfileSpec) DeepCopy() *ClientProfileSpec { + if in == nil { + return nil + } + out := new(ClientProfileSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ClientProfileStatus) DeepCopyInto(out *ClientProfileStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClientProfileStatus. +func (in *ClientProfileStatus) DeepCopy() *ClientProfileStatus { + if in == nil { + return nil + } + out := new(ClientProfileStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControllerPluginResourcesSpec) DeepCopyInto(out *ControllerPluginResourcesSpec) { + *out = *in + if in.Attacher != nil { + in, out := &in.Attacher, &out.Attacher + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Snapshotter != nil { + in, out := &in.Snapshotter, &out.Snapshotter + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Resizer != nil { + in, out := &in.Resizer, &out.Resizer + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Provisioner != nil { + in, out := &in.Provisioner, &out.Provisioner + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.OMapGenerator != nil { + in, out := &in.OMapGenerator, &out.OMapGenerator + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Liveness != nil { + in, out := &in.Liveness, &out.Liveness + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Addons != nil { + in, out := &in.Addons, &out.Addons + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.LogRotator != nil { + in, out := &in.LogRotator, &out.LogRotator + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Plugin != nil { + in, out := &in.Plugin, &out.Plugin + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControllerPluginResourcesSpec. +func (in *ControllerPluginResourcesSpec) DeepCopy() *ControllerPluginResourcesSpec { + if in == nil { + return nil + } + out := new(ControllerPluginResourcesSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ControllerPluginSpec) DeepCopyInto(out *ControllerPluginSpec) { + *out = *in + in.PodCommonSpec.DeepCopyInto(&out.PodCommonSpec) + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + in.Resources.DeepCopyInto(&out.Resources) + if in.Privileged != nil { + in, out := &in.Privileged, &out.Privileged + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControllerPluginSpec. +func (in *ControllerPluginSpec) DeepCopy() *ControllerPluginSpec { + if in == nil { + return nil + } + out := new(ControllerPluginSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Driver) DeepCopyInto(out *Driver) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Driver. +func (in *Driver) DeepCopy() *Driver { + if in == nil { + return nil + } + out := new(Driver) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Driver) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DriverList) DeepCopyInto(out *DriverList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Driver, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DriverList. +func (in *DriverList) DeepCopy() *DriverList { + if in == nil { + return nil + } + out := new(DriverList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *DriverList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DriverSpec) DeepCopyInto(out *DriverSpec) { + *out = *in + if in.Log != nil { + in, out := &in.Log, &out.Log + *out = new(LogSpec) + (*in).DeepCopyInto(*out) + } + if in.ImageSet != nil { + in, out := &in.ImageSet, &out.ImageSet + *out = new(v1.LocalObjectReference) + **out = **in + } + if in.ClusterName != nil { + in, out := &in.ClusterName, &out.ClusterName + *out = new(string) + **out = **in + } + if in.EnableMetadata != nil { + in, out := &in.EnableMetadata, &out.EnableMetadata + *out = new(bool) + **out = **in + } + if in.GenerateOMapInfo != nil { + in, out := &in.GenerateOMapInfo, &out.GenerateOMapInfo + *out = new(bool) + **out = **in + } + if in.Encryption != nil { + in, out := &in.Encryption, &out.Encryption + *out = new(EncryptionSpec) + **out = **in + } + if in.NodePlugin != nil { + in, out := &in.NodePlugin, &out.NodePlugin + *out = new(NodePluginSpec) + (*in).DeepCopyInto(*out) + } + if in.ControllerPlugin != nil { + in, out := &in.ControllerPlugin, &out.ControllerPlugin + *out = new(ControllerPluginSpec) + (*in).DeepCopyInto(*out) + } + if in.AttachRequired != nil { + in, out := &in.AttachRequired, &out.AttachRequired + *out = new(bool) + **out = **in + } + if in.Liveness != nil { + in, out := &in.Liveness, &out.Liveness + *out = new(LivenessSpec) + **out = **in + } + if in.LeaderElection != nil { + in, out := &in.LeaderElection, &out.LeaderElection + *out = new(LeaderElectionSpec) + **out = **in + } + if in.DeployCsiAddons != nil { + in, out := &in.DeployCsiAddons, &out.DeployCsiAddons + *out = new(bool) + **out = **in + } + if in.KernelMountOptions != nil { + in, out := &in.KernelMountOptions, &out.KernelMountOptions + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.FuseMountOptions != nil { + in, out := &in.FuseMountOptions, &out.FuseMountOptions + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DriverSpec. +func (in *DriverSpec) DeepCopy() *DriverSpec { + if in == nil { + return nil + } + out := new(DriverSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DriverStatus) DeepCopyInto(out *DriverStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DriverStatus. +func (in *DriverStatus) DeepCopy() *DriverStatus { + if in == nil { + return nil + } + out := new(DriverStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *EncryptionSpec) DeepCopyInto(out *EncryptionSpec) { + *out = *in + out.ConfigMapRef = in.ConfigMapRef +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EncryptionSpec. +func (in *EncryptionSpec) DeepCopy() *EncryptionSpec { + if in == nil { + return nil + } + out := new(EncryptionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LeaderElectionSpec) DeepCopyInto(out *LeaderElectionSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LeaderElectionSpec. +func (in *LeaderElectionSpec) DeepCopy() *LeaderElectionSpec { + if in == nil { + return nil + } + out := new(LeaderElectionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LivenessSpec) DeepCopyInto(out *LivenessSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LivenessSpec. +func (in *LivenessSpec) DeepCopy() *LivenessSpec { + if in == nil { + return nil + } + out := new(LivenessSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LogRotationSpec) DeepCopyInto(out *LogRotationSpec) { + *out = *in + out.MaxLogSize = in.MaxLogSize.DeepCopy() +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogRotationSpec. +func (in *LogRotationSpec) DeepCopy() *LogRotationSpec { + if in == nil { + return nil + } + out := new(LogRotationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *LogSpec) DeepCopyInto(out *LogSpec) { + *out = *in + if in.Rotation != nil { + in, out := &in.Rotation, &out.Rotation + *out = new(LogRotationSpec) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LogSpec. +func (in *LogSpec) DeepCopy() *LogSpec { + if in == nil { + return nil + } + out := new(LogSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NfsConfigSpec) DeepCopyInto(out *NfsConfigSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NfsConfigSpec. +func (in *NfsConfigSpec) DeepCopy() *NfsConfigSpec { + if in == nil { + return nil + } + out := new(NfsConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodePluginResourcesSpec) DeepCopyInto(out *NodePluginResourcesSpec) { + *out = *in + if in.Registrar != nil { + in, out := &in.Registrar, &out.Registrar + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Liveness != nil { + in, out := &in.Liveness, &out.Liveness + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Addons != nil { + in, out := &in.Addons, &out.Addons + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.LogRotator != nil { + in, out := &in.LogRotator, &out.LogRotator + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } + if in.Plugin != nil { + in, out := &in.Plugin, &out.Plugin + *out = new(v1.ResourceRequirements) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePluginResourcesSpec. +func (in *NodePluginResourcesSpec) DeepCopy() *NodePluginResourcesSpec { + if in == nil { + return nil + } + out := new(NodePluginResourcesSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NodePluginSpec) DeepCopyInto(out *NodePluginSpec) { + *out = *in + in.PodCommonSpec.DeepCopyInto(&out.PodCommonSpec) + if in.UpdateStrategy != nil { + in, out := &in.UpdateStrategy, &out.UpdateStrategy + *out = new(appsv1.DaemonSetUpdateStrategy) + (*in).DeepCopyInto(*out) + } + in.Resources.DeepCopyInto(&out.Resources) + if in.EnableSeLinuxHostMount != nil { + in, out := &in.EnableSeLinuxHostMount, &out.EnableSeLinuxHostMount + *out = new(bool) + **out = **in + } + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = new(TopologySpec) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodePluginSpec. +func (in *NodePluginSpec) DeepCopy() *NodePluginSpec { + if in == nil { + return nil + } + out := new(NodePluginSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorConfig) DeepCopyInto(out *OperatorConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + out.Status = in.Status +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorConfig. +func (in *OperatorConfig) DeepCopy() *OperatorConfig { + if in == nil { + return nil + } + out := new(OperatorConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OperatorConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorConfigList) DeepCopyInto(out *OperatorConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]OperatorConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorConfigList. +func (in *OperatorConfigList) DeepCopy() *OperatorConfigList { + if in == nil { + return nil + } + out := new(OperatorConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *OperatorConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorConfigSpec) DeepCopyInto(out *OperatorConfigSpec) { + *out = *in + if in.Log != nil { + in, out := &in.Log, &out.Log + *out = new(OperatorLogSpec) + **out = **in + } + if in.DriverSpecDefaults != nil { + in, out := &in.DriverSpecDefaults, &out.DriverSpecDefaults + *out = new(DriverSpec) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorConfigSpec. +func (in *OperatorConfigSpec) DeepCopy() *OperatorConfigSpec { + if in == nil { + return nil + } + out := new(OperatorConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorConfigStatus) DeepCopyInto(out *OperatorConfigStatus) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorConfigStatus. +func (in *OperatorConfigStatus) DeepCopy() *OperatorConfigStatus { + if in == nil { + return nil + } + out := new(OperatorConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OperatorLogSpec) DeepCopyInto(out *OperatorLogSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OperatorLogSpec. +func (in *OperatorLogSpec) DeepCopy() *OperatorLogSpec { + if in == nil { + return nil + } + out := new(OperatorLogSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PodCommonSpec) DeepCopyInto(out *PodCommonSpec) { + *out = *in + if in.ServiceAccountName != nil { + in, out := &in.ServiceAccountName, &out.ServiceAccountName + *out = new(string) + **out = **in + } + if in.PrioritylClassName != nil { + in, out := &in.PrioritylClassName, &out.PrioritylClassName + *out = new(string) + **out = **in + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.Affinity != nil { + in, out := &in.Affinity, &out.Affinity + *out = new(v1.Affinity) + (*in).DeepCopyInto(*out) + } + if in.Tolerations != nil { + in, out := &in.Tolerations, &out.Tolerations + *out = make([]v1.Toleration, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Volumes != nil { + in, out := &in.Volumes, &out.Volumes + *out = make([]VolumeSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodCommonSpec. +func (in *PodCommonSpec) DeepCopy() *PodCommonSpec { + if in == nil { + return nil + } + out := new(PodCommonSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RbdConfigSpec) DeepCopyInto(out *RbdConfigSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RbdConfigSpec. +func (in *RbdConfigSpec) DeepCopy() *RbdConfigSpec { + if in == nil { + return nil + } + out := new(RbdConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReadAffinitySpec) DeepCopyInto(out *ReadAffinitySpec) { + *out = *in + if in.CrushLocationLabels != nil { + in, out := &in.CrushLocationLabels, &out.CrushLocationLabels + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReadAffinitySpec. +func (in *ReadAffinitySpec) DeepCopy() *ReadAffinitySpec { + if in == nil { + return nil + } + out := new(ReadAffinitySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TopologySpec) DeepCopyInto(out *TopologySpec) { + *out = *in + if in.DomainLabels != nil { + in, out := &in.DomainLabels, &out.DomainLabels + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TopologySpec. +func (in *TopologySpec) DeepCopy() *TopologySpec { + if in == nil { + return nil + } + out := new(TopologySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VolumeSpec) DeepCopyInto(out *VolumeSpec) { + *out = *in + in.Volume.DeepCopyInto(&out.Volume) + in.Mount.DeepCopyInto(&out.Mount) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSpec. +func (in *VolumeSpec) DeepCopy() *VolumeSpec { + if in == nil { + return nil + } + out := new(VolumeSpec) + in.DeepCopyInto(out) + return out +} diff --git a/vendor/modules.txt b/vendor/modules.txt index f7ce4633..fc807a91 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,6 +1,9 @@ # github.com/beorn7/perks v1.0.1 ## explicit; go 1.11 github.com/beorn7/perks/quantile +# github.com/ceph/ceph-csi-operator/api v0.0.0-00010101000000-000000000000 => ./api +## explicit; go 1.22.0 +github.com/ceph/ceph-csi-operator/api/v1alpha1 # github.com/cespare/xxhash/v2 v2.2.0 ## explicit; go 1.11 github.com/cespare/xxhash/v2 @@ -650,3 +653,4 @@ sigs.k8s.io/structured-merge-diff/v4/value ## explicit; go 1.12 sigs.k8s.io/yaml sigs.k8s.io/yaml/goyaml.v2 +# github.com/ceph/ceph-csi-operator/api => ./api From df4399992b62a6814796566e43b68f86cba21f4c Mon Sep 17 00:00:00 2001 From: Divyansh Kamboj Date: Sat, 27 Jul 2024 11:24:22 +0530 Subject: [PATCH 2/2] api: export default SecurityContextConstraints in OCP clusters this commit exports SecurityContextConstraints to let the user deploy the ceph-csi-operator in OCP clusters Signed-off-by: Divyansh Kamboj --- api/go.mod | 6 ++++++ api/go.sum | 2 ++ api/ocp/scc.go | 36 ++++++++++++++++++++++++++++++++++++ api/ocp/scc.yaml | 38 ++++++++++++++++++++++++++++++++++++++ api/ocp/scc_test.go | 26 ++++++++++++++++++++++++++ 5 files changed, 108 insertions(+) create mode 100644 api/ocp/scc.go create mode 100644 api/ocp/scc.yaml create mode 100644 api/ocp/scc_test.go diff --git a/api/go.mod b/api/go.mod index 7d0def76..b04649c3 100644 --- a/api/go.mod +++ b/api/go.mod @@ -5,22 +5,28 @@ go 1.22.0 toolchain go1.22.5 require ( + github.com/openshift/api v0.0.0-20240724184751-84047ef4a2ce + github.com/stretchr/testify v1.8.4 k8s.io/api v0.30.3 k8s.io/apimachinery v0.30.3 sigs.k8s.io/controller-runtime v0.18.4 + sigs.k8s.io/yaml v1.3.0 ) require ( + github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect golang.org/x/net v0.23.0 // indirect golang.org/x/text v0.14.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/klog/v2 v2.120.1 // indirect k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect diff --git a/api/go.sum b/api/go.sum index d97807fc..dfe9344d 100644 --- a/api/go.sum +++ b/api/go.sum @@ -32,6 +32,8 @@ github.com/onsi/ginkgo/v2 v2.17.1 h1:V++EzdbhI4ZV4ev0UTIj0PzhzOcReJFyJaLjtSF55M8 github.com/onsi/ginkgo/v2 v2.17.1/go.mod h1:llBI3WDLL9Z6taip6f33H76YcWtJv+7R3HigUjbIBOs= github.com/onsi/gomega v1.32.0 h1:JRYU78fJ1LPxlckP6Txi/EYqJvjtMrDC04/MM5XRHPk= github.com/onsi/gomega v1.32.0/go.mod h1:a4x4gW6Pz2yK1MAmvluYme5lvYTn61afQ2ETw/8n4Lg= +github.com/openshift/api v0.0.0-20240724184751-84047ef4a2ce h1:AR9XMlwc7akIN13KDx4L0tI04zHf8jEZ1z1RMRbz1J0= +github.com/openshift/api v0.0.0-20240724184751-84047ef4a2ce/go.mod h1:OOh6Qopf21pSzqNVCB5gomomBXb8o5sGKZxG2KNpaXM= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= diff --git a/api/ocp/scc.go b/api/ocp/scc.go new file mode 100644 index 00000000..bfff79b8 --- /dev/null +++ b/api/ocp/scc.go @@ -0,0 +1,36 @@ +package ocp + +import ( + _ "embed" + "fmt" + "strings" + + secv1 "github.com/openshift/api/security/v1" + "sigs.k8s.io/yaml" +) + +//go:embed scc.yaml +var sccYAMLTemplate string + +// NewSecurityContextConstraints loads the embedded SCC YAML template, replaces the namespace, +// and returns it as a SecurityContextConstraints object +func NewSecurityContextConstraints(name string, namespace string) (*secv1.SecurityContextConstraints, error) { + scc := &secv1.SecurityContextConstraints{} + err := yaml.Unmarshal([]byte(sccYAMLTemplate), scc) + if err != nil { + return nil, fmt.Errorf("error unmarshaling YAML: %v", err) + } + scc.Name = name + scc.Namespace = namespace + var users []string + for _, user := range scc.Users { + serviceAccount := strings.Split(user, ":") + if len(serviceAccount) != 4 { + return nil, fmt.Errorf("invalid service account name") + } + serviceAccount[2] = namespace + users = append(users, strings.Join(serviceAccount, ":")) + } + scc.Users = users + return scc, nil +} diff --git a/api/ocp/scc.yaml b/api/ocp/scc.yaml new file mode 100644 index 00000000..ebaa7789 --- /dev/null +++ b/api/ocp/scc.yaml @@ -0,0 +1,38 @@ +kind: SecurityContextConstraints +metadata: + name: csi-scc + namespace: ceph-csi-operator-system +allowHostDirVolumePlugin: true +allowHostIPC: true +allowHostNetwork: false +allowHostPID: true +allowHostPorts: true +allowPrivilegedContainer: true +allowedCapabilities: + - SYS_ADMIN +apiVersion: security.openshift.io/v1 +defaultAddCapabilities: [] +fsGroup: + type: RunAsAny +priority: +readOnlyRootFilesystem: false +requiredDropCapabilities: + - ALL +runAsUser: + type: RunAsAny +seLinuxContext: + type: RunAsAny +supplementalGroups: + type: RunAsAny +users: + - system:serviceaccount:ceph-csi-operator-system:csi-rbd-ctrlplugin-sa + - system:serviceaccount:ceph-csi-operator-system:csi-cephfs-ctrlplugin-sa + - system:serviceaccount:ceph-csi-operator-system:csi-nfs-ctrlplugin-sa + - system:serviceaccount:ceph-csi-operator-system:csi-rbd-nodeplugin-sa + - system:serviceaccount:ceph-csi-operator-system:csi-cephfs-nodeplugin-sa + - system:serviceaccount:ceph-csi-operator-system:csi-nfs-nodeplugin-sa +volumes: + - configMap + - emptyDir + - hostPath + - projected diff --git a/api/ocp/scc_test.go b/api/ocp/scc_test.go new file mode 100644 index 00000000..1ae74afa --- /dev/null +++ b/api/ocp/scc_test.go @@ -0,0 +1,26 @@ +package ocp + +import ( + "strings" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestNewSecurityContextConstraints(t *testing.T) { + testNamespace := "test-namespace" + testName := "test" + scc, err := NewSecurityContextConstraints(testName, testNamespace) + require.NoError(t, err, "NewSecurityContextConstraints should not return an error") + assert.NotNil(t, scc, "SCC should not be nil") + + assert.Equal(t, scc.Name, testName) + assert.NotEmpty(t, scc.Users, "Users should not be empty") + for _, user := range scc.Users { + assert.True(t, strings.Contains(user, testNamespace), + "Each user should contain the specified namespace") + assert.False(t, strings.Contains(user, "{{.Namespace}}"), + "Template placeholders should be replaced") + } +}