Skip to content

Commit

Permalink
Make messaging spec a pointer reference
Browse files Browse the repository at this point in the history
  • Loading branch information
sidhdirenge committed Jan 15, 2025
1 parent 5ed7d5c commit aa3be13
Show file tree
Hide file tree
Showing 11 changed files with 18,568 additions and 20,025 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha1/cdapmaster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type CDAPMasterSpec struct {
// Logs is specification for the CDAP logging service.
Logs LogsSpec `json:"logs,omitempty"`
// Messaging is specification for the CDAP messaging service.
Messaging MessagingSpec `json:"messaging,omitempty"`
Messaging *MessagingSpec `json:"messaging,omitempty"`
// Metadata is specification for the CDAP metadata service.
Metadata MetadataSpec `json:"metadata,omitempty"`
// Metrics is specification for the CDAP metrics service.
Expand Down
7 changes: 5 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38,420 changes: 18,497 additions & 19,923 deletions config/crd/bases/cdap.cdap.io_cdapmasters.yaml

Large diffs are not rendered by default.

26 changes: 1 addition & 25 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: manager-role
rules:
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- services
verbs:
- create
Expand All @@ -34,6 +21,7 @@ rules:
- apps
resources:
- deployments
- statefulsets
verbs:
- create
- delete
Expand All @@ -50,18 +38,6 @@ rules:
- get
- patch
- update
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- batch
resources:
Expand Down
18 changes: 9 additions & 9 deletions controllers/cdapmaster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ func ApplyDefaults(resource interface{}) {
finalizer.EnsureStandard(r)
}

/////////////////////////////////////////////////////////
///// Handling reconciling ConfigMapHandler objects /////
/////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////
// /// Handling reconciling ConfigMapHandler objects /////
// ///////////////////////////////////////////////////////
type ConfigMapHandler struct{}

func (h *ConfigMapHandler) Observables(rsrc interface{}, labels map[string]string, dependent []reconciler.Object) []reconciler.Observable {
Expand Down Expand Up @@ -257,9 +257,9 @@ func buildConfigMapObject(spec *ConfigMapSpec) reconciler.Object {
return obj
}

///////////////////////////////////////////////////////////
///// Handling reconciling deployment of all services /////
///////////////////////////////////////////////////////////
// /////////////////////////////////////////////////////////
// /// Handling reconciling deployment of all services /////
// /////////////////////////////////////////////////////////
type ServiceHandler struct{}

func (h *ServiceHandler) Observables(rsrc interface{}, labels map[string]string, dependent []reconciler.Object) []reconciler.Observable {
Expand Down Expand Up @@ -337,9 +337,9 @@ func CopyNodePortIfAny(expected, observed []reconciler.Object) {
}
}

///////////////////////////////////////////////////////
///// Handler for image version upgrade/downgrade /////
///////////////////////////////////////////////////////
// /////////////////////////////////////////////////////
// /// Handler for image version upgrade/downgrade /////
// /////////////////////////////////////////////////////
type VersionUpdateHandler struct{}

func (h *VersionUpdateHandler) Observables(rsrc interface{}, labels map[string]string, dependent []reconciler.Object) []reconciler.Observable {
Expand Down
72 changes: 36 additions & 36 deletions controllers/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,48 @@ var _ = Describe("Controller Suite", func() {
BeforeEach(func() {
master = &v1alpha1.CDAPMaster{}
serviceToSpec = map[string]*v1alpha1.CDAPServiceSpec{
serviceLogs: &master.Spec.Logs.CDAPServiceSpec,
serviceAppFabric: &master.Spec.AppFabric.CDAPServiceSpec,
serviceAppFabricProcessor: &master.Spec.AppFabricProcessor.CDAPServiceSpec,
serviceMetrics: &master.Spec.Metrics.CDAPServiceSpec,
serviceRouter: &master.Spec.Router.CDAPServiceSpec,
serviceMessaging: &master.Spec.Messaging.CDAPServiceSpec,
serviceMetadata: &master.Spec.Metadata.CDAPServiceSpec,
servicePreview: &master.Spec.Preview.CDAPServiceSpec,
serviceUserInterface: &master.Spec.UserInterface.CDAPServiceSpec,
serviceLogs: &master.Spec.Logs.CDAPServiceSpec,
serviceAppFabric: &master.Spec.AppFabric.CDAPServiceSpec,
serviceAppFabricProcessor: &master.Spec.AppFabricProcessor.CDAPServiceSpec,
serviceMetrics: &master.Spec.Metrics.CDAPServiceSpec,
serviceRouter: &master.Spec.Router.CDAPServiceSpec,
serviceMessaging: &master.Spec.Messaging.CDAPServiceSpec,
serviceMetadata: &master.Spec.Metadata.CDAPServiceSpec,
servicePreview: &master.Spec.Preview.CDAPServiceSpec,
serviceUserInterface: &master.Spec.UserInterface.CDAPServiceSpec,
}
serviceToScalableSpec = map[string]*v1alpha1.CDAPScalableServiceSpec{
serviceLogs: nil,
serviceAppFabric: &master.Spec.AppFabric.CDAPScalableServiceSpec,
serviceAppFabricProcessor: nil,
serviceMetrics: nil,
serviceRouter: &master.Spec.Router.CDAPScalableServiceSpec,
serviceMessaging: nil,
serviceMetadata: &master.Spec.Metadata.CDAPScalableServiceSpec,
servicePreview: nil,
serviceUserInterface: &master.Spec.UserInterface.CDAPScalableServiceSpec,
serviceLogs: nil,
serviceAppFabric: &master.Spec.AppFabric.CDAPScalableServiceSpec,
serviceAppFabricProcessor: nil,
serviceMetrics: nil,
serviceRouter: &master.Spec.Router.CDAPScalableServiceSpec,
serviceMessaging: nil,
serviceMetadata: &master.Spec.Metadata.CDAPScalableServiceSpec,
servicePreview: nil,
serviceUserInterface: &master.Spec.UserInterface.CDAPScalableServiceSpec,
}
serviceToStatefulSpec = map[string]*v1alpha1.CDAPStatefulServiceSpec{
serviceLogs: &master.Spec.Logs.CDAPStatefulServiceSpec,
serviceAppFabric: nil,
serviceAppFabricProcessor: &master.Spec.AppFabricProcessor.CDAPStatefulServiceSpec,
serviceMetrics: &master.Spec.Metrics.CDAPStatefulServiceSpec,
serviceRouter: nil,
serviceMessaging: &master.Spec.Messaging.CDAPStatefulServiceSpec,
serviceMetadata: nil,
servicePreview: &master.Spec.Preview.CDAPStatefulServiceSpec,
serviceUserInterface: nil,
serviceLogs: &master.Spec.Logs.CDAPStatefulServiceSpec,
serviceAppFabric: nil,
serviceAppFabricProcessor: &master.Spec.AppFabricProcessor.CDAPStatefulServiceSpec,
serviceMetrics: &master.Spec.Metrics.CDAPStatefulServiceSpec,
serviceRouter: nil,
serviceMessaging: &master.Spec.Messaging.CDAPStatefulServiceSpec,
serviceMetadata: nil,
servicePreview: &master.Spec.Preview.CDAPStatefulServiceSpec,
serviceUserInterface: nil,
}
serviceToExternalSpec = map[string]*v1alpha1.CDAPExternalServiceSpec{
serviceLogs: nil,
serviceAppFabric: nil,
serviceAppFabricProcessor: nil,
serviceMetrics: nil,
serviceRouter: &master.Spec.Router.CDAPExternalServiceSpec,
serviceMessaging: nil,
serviceMetadata: nil,
servicePreview: nil,
serviceUserInterface: &master.Spec.UserInterface.CDAPExternalServiceSpec,
serviceLogs: nil,
serviceAppFabric: nil,
serviceAppFabricProcessor: nil,
serviceMetrics: nil,
serviceRouter: &master.Spec.Router.CDAPExternalServiceSpec,
serviceMessaging: nil,
serviceMetadata: nil,
servicePreview: nil,
serviceUserInterface: &master.Spec.UserInterface.CDAPExternalServiceSpec,
}
})
It("Successfully get pointer to CDAPServiceSpec", func() {
Expand Down
4 changes: 2 additions & 2 deletions controllers/version_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,12 +504,12 @@ func getCurrentTimeMs() int64 {

// The returned name is just the suffix of actual k8s object name, as we prepend it with const string + CR name
func getPreUpgradeJobName(startTimeMs int64) string {
return fmt.Sprintf("pre-upgrade-job-%d", startTimeMs / 1000)
return fmt.Sprintf("pre-upgrade-job-%d", startTimeMs/1000)
}

// The returned name is just the suffix of actual k8s object name, as we prepend it with const string + CR name
func getPostUpgradeJobName(startTimeMs int64) string {
return fmt.Sprintf("post-upgrade-job-%d", startTimeMs / 1000)
return fmt.Sprintf("post-upgrade-job-%d", startTimeMs/1000)
}

// Return pre-upgrade job spec
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aa3be13

Please sign in to comment.