Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 2248450: Fusion HCI integration changes for OCS client operator [4.14 Backport] #41

Merged
merged 15 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ["1.18", "1.19"]
go: ["1.20", "1.21"]
steps:
- uses: actions/setup-go@v2
with:
Expand All @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ["1.18", "1.19"]
go: ["1.20", "1.21"]
steps:
- uses: actions/setup-go@v2
with:
Expand All @@ -48,7 +48,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ["1.18", "1.19"]
go: ["1.20", "1.21"]
steps:
- uses: actions/setup-go@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ["1.18", "1.19"]
go: ["1.20", "1.21"]
steps:
- uses: actions/setup-go@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.18 as builder
FROM golang:1.20 as builder

WORKDIR /workspace

Expand Down
18 changes: 18 additions & 0 deletions bundle/manifests/ocs-client-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,14 @@ spec:
- get
- list
- update
- apiGroups:
- config.openshift.io
resources:
- clusterversions
verbs:
- get
- list
- watch
serviceAccountName: ocs-client-operator-status-reporter
deployments:
- label:
Expand Down Expand Up @@ -886,6 +894,16 @@ spec:
verbs:
- create
serviceAccountName: ocs-client-operator-csi-rbd-provisioner-sa
- rules:
- apiGroups:
- operators.coreos.com
resources:
- clusterserviceversions
verbs:
- get
- list
- watch
serviceAccountName: ocs-client-operator-status-reporter
strategy: deployment
installModes:
- supported: true
Expand Down
2 changes: 2 additions & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ resources:
- status-reporter-sa.yaml
- status-reporter-clusterrole.yaml
- status-reporter-clusterrole_binding.yaml
- status-reporter-role.yaml
- status-reporter-role_binding.yaml
# CSI RBAC
- csi_cephfs_plugin_clusterrole.yaml
- csi_cephfs_plugin_clusterrole_binding.yaml
Expand Down
8 changes: 8 additions & 0 deletions config/rbac/status-reporter-clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@ rules:
- get
- list
- update
- apiGroups:
- config.openshift.io
resources:
- clusterversions
verbs:
- get
- list
- watch
15 changes: 15 additions & 0 deletions config/rbac/status-reporter-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
creationTimestamp: null
name: status-reporter
rules:
- apiGroups:
- operators.coreos.com
resources:
- clusterserviceversions
verbs:
- get
- list
- watch
12 changes: 12 additions & 0 deletions config/rbac/status-reporter-role_binding.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: status-reporter
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: status-reporter
subjects:
- kind: ServiceAccount
name: status-reporter
namespace: system
8 changes: 5 additions & 3 deletions controllers/clusterversion_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"
)

//go:embed pvc-rules.yaml
Expand Down Expand Up @@ -93,7 +92,7 @@ func (c *ClusterVersionReconciler) SetupWithManager(mgr ctrl.Manager) error {
)
// Reconcile the ClusterVersion object when the operator config map is updated
enqueueClusterVersionRequest := handler.EnqueueRequestsFromMapFunc(
func(client client.Object) []reconcile.Request {
func(_ context.Context, client client.Object) []reconcile.Request {
return []reconcile.Request{{
NamespacedName: types.NamespacedName{
Name: clusterVersionName,
Expand All @@ -104,7 +103,7 @@ func (c *ClusterVersionReconciler) SetupWithManager(mgr ctrl.Manager) error {

return ctrl.NewControllerManagedBy(mgr).
For(&configv1.ClusterVersion{}, clusterVersionPredicates).
Watches(&source.Kind{Type: &corev1.ConfigMap{}}, enqueueClusterVersionRequest, configMapPredicates).
Watches(&corev1.ConfigMap{}, enqueueClusterVersionRequest, configMapPredicates).
Complete(c)
}

Expand Down Expand Up @@ -423,7 +422,10 @@ func (c *ClusterVersionReconciler) ensureConsolePlugin() error {

consolePlugin := console.GetConsolePlugin(c.ConsolePort, c.OperatorNamespace)
err = c.createOrUpdate(consolePlugin, func() error {
// preserve the resourceVersion of the consolePlugin
resourceVersion := consolePlugin.ResourceVersion
console.GetConsolePlugin(c.ConsolePort, c.OperatorNamespace).DeepCopyInto(consolePlugin)
consolePlugin.ResourceVersion = resourceVersion
return nil
})

Expand Down
7 changes: 3 additions & 4 deletions controllers/storageclassclaim_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ import (
ctrllog "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/predicate"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"
)

const (
Expand All @@ -69,7 +68,7 @@ type StorageClassClaimReconciler struct {
// SetupWithManager sets up the controller with the Manager.
func (r *StorageClassClaimReconciler) SetupWithManager(mgr ctrl.Manager) error {
enqueueStorageConsumerRequest := handler.EnqueueRequestsFromMapFunc(
func(obj client.Object) []reconcile.Request {
func(_ context.Context, obj client.Object) []reconcile.Request {
annotations := obj.GetAnnotations()
if _, found := annotations[storageClassClaimAnnotation]; found {
return []reconcile.Request{{
Expand All @@ -84,8 +83,8 @@ func (r *StorageClassClaimReconciler) SetupWithManager(mgr ctrl.Manager) error {
For(&v1alpha1.StorageClassClaim{}, builder.WithPredicates(
predicate.GenerationChangedPredicate{},
)).
Watches(&source.Kind{Type: &storagev1.StorageClass{}}, enqueueStorageConsumerRequest).
Watches(&source.Kind{Type: &snapapi.VolumeSnapshotClass{}}, enqueueStorageConsumerRequest).
Watches(&storagev1.StorageClass{}, enqueueStorageConsumerRequest).
Watches(&snapapi.VolumeSnapshotClass{}, enqueueStorageConsumerRequest).
Complete(r)
}

Expand Down
15 changes: 12 additions & 3 deletions controllers/storageclient_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/handler"
"sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/reconcile"
"sigs.k8s.io/controller-runtime/pkg/source"
)

const (
Expand Down Expand Up @@ -88,7 +87,7 @@ func (s *StorageClientReconciler) SetupWithManager(mgr ctrl.Manager) error {
return res
})
enqueueStorageClientRequest := handler.EnqueueRequestsFromMapFunc(
func(obj client.Object) []reconcile.Request {
func(_ context.Context, obj client.Object) []reconcile.Request {
annotations := obj.GetAnnotations()
if _, found := annotations[storageClassClaimAnnotation]; found {
return []reconcile.Request{{
Expand All @@ -102,7 +101,7 @@ func (s *StorageClientReconciler) SetupWithManager(mgr ctrl.Manager) error {
s.recorder = utils.NewEventReporter(mgr.GetEventRecorderFor("controller_storageclient"))
return ctrl.NewControllerManagedBy(mgr).
For(&v1alpha1.StorageClient{}).
Watches(&source.Kind{Type: &v1alpha1.StorageClassClaim{}}, enqueueStorageClientRequest).
Watches(&v1alpha1.StorageClassClaim{}, enqueueStorageClientRequest).
Complete(s)
}

Expand Down Expand Up @@ -434,14 +433,24 @@ func (s *StorageClientReconciler) reconcileClientStatusReporterJob(instance *v1a
cronJob.Namespace = s.OperatorNamespace
addLabel(cronJob, storageClientNameLabel, instance.Name)
addLabel(cronJob, storageClientNamespaceLabel, instance.Namespace)
var podDeadLineSeconds int64 = 120
jobDeadLineSeconds := podDeadLineSeconds + 35
var keepJobResourceSeconds int32 = 600
var reducedKeptSuccecsful int32 = 1


_, err := controllerutil.CreateOrUpdate(s.ctx, s.Client, cronJob, func() error {
cronJob.Spec = batchv1.CronJobSpec{
Schedule: "* * * * *",
ConcurrencyPolicy: batchv1.ForbidConcurrent,
SuccessfulJobsHistoryLimit: &reducedKeptSuccecsful,
JobTemplate: batchv1.JobTemplateSpec{
Spec: batchv1.JobSpec{
ActiveDeadlineSeconds: &jobDeadLineSeconds,
TTLSecondsAfterFinished: &keepJobResourceSeconds,
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
ActiveDeadlineSeconds: &podDeadLineSeconds,
Containers: []corev1.Container{
{
Name: "heartbeat",
Expand Down
4 changes: 2 additions & 2 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"github.com/red-hat-storage/ocs-client-operator/api/v1alpha1"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/ginkgo" //nolint:revive // ginkgo initialization
. "github.com/onsi/gomega" //nolint:revive // gomega initialization
"k8s.io/client-go/kubernetes/scheme"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
Expand Down
93 changes: 46 additions & 47 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,91 +1,90 @@
module github.com/red-hat-storage/ocs-client-operator

go 1.18
go 1.20

replace (
github.com/portworx/sched-ops => github.com/portworx/sched-ops v0.20.4-openstorage-rc3 // required by Rook v1.12
k8s.io/client-go => k8s.io/client-go v0.26.4
vbom.ml/util => github.com/fvbommel/util v0.0.0-20180919145318-efcd4e0f9787
)

exclude github.com/kubernetes-incubator/external-storage v0.20.4-openstorage-rc2

require (
github.com/go-logr/logr v1.2.3
github.com/go-logr/logr v1.2.4
github.com/kubernetes-csi/external-snapshotter/client/v6 v6.2.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.27.1
github.com/openshift/api v0.0.0-20230217170555-ab002e9c06da
github.com/onsi/gomega v1.27.9
github.com/openshift/api v0.0.0-20231010191030-1f9525271dda
github.com/operator-framework/api v0.17.7-0.20230626210316-aa3e49803e7b
github.com/pkg/errors v0.9.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.63.0
github.com/red-hat-storage/ocs-operator/v4 v4.0.0-20230720152055-bdf5b8abb7c0
github.com/stretchr/testify v1.8.2
google.golang.org/grpc v1.53.0
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.67.1
github.com/red-hat-storage/ocs-operator/v4 v4.0.0-20231031112628-5ea7bff99378
github.com/stretchr/testify v1.8.4
google.golang.org/grpc v1.56.2
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.26.4
k8s.io/apimachinery v0.26.4
k8s.io/client-go v12.0.0+incompatible
k8s.io/klog/v2 v2.90.0
k8s.io/utils v0.0.0-20230209194617-a36077c30491
sigs.k8s.io/controller-runtime v0.14.5
k8s.io/api v0.28.2
k8s.io/apimachinery v0.28.2
k8s.io/client-go v0.28.2
k8s.io/klog/v2 v2.100.1
k8s.io/utils v0.0.0-20230726121419-3b25d923346b
sigs.k8s.io/controller-runtime v0.15.2
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.7.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logr/zapr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-logr/zapr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.40.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.13.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230320184635-7606e756e683 // indirect
google.golang.org/protobuf v1.29.1 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.26.4 // indirect
k8s.io/component-base v0.26.4 // indirect
k8s.io/kube-openapi v0.0.0-20230217203603-ff9a8e8fa21d // indirect
k8s.io/apiextensions-apiserver v0.28.2 // indirect
k8s.io/component-base v0.28.2 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

Expand Down
Loading
Loading