Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ help: ## Display this help.

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:maxDescLen=0 webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down
10 changes: 10 additions & 0 deletions api/v1alpha1/cdapmaster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ type CDAPMasterSpec struct {
// collection of system metrics. Services which have CDAPServiceSpec.EnableSystemMetrics as nil, missing or set to false,
// will have metrics sidecar container disabled.
SystemMetricsExporter *SystemMetricExporterSpec `json:"systemMetricsExporter,omitempty"`
// TaskManager is specification for the CDAP Task Manager / Netty Proxy service.
// This is an optional service and may not be required for CDAP to be operational.
// To disable this service: either omit or set the field to nil
// To enable this service: set it to a pointer to a TaskManagerSpec struct (can be an empty struct).
TaskManager *TaskManagerSpec `json:"taskManager,omitempty"`
// SecurityContext defines the security context for all pods for all services.
SecurityContext *SecurityContext `json:"securityContext,omitempty"`
// AdditionalVolumes defines a list of additional volumes for all services.
Expand Down Expand Up @@ -307,6 +312,11 @@ type SystemMetricExporterSpec struct {
CDAPServiceSpec `json:",inline"`
}

// TaskManagerSpec defines the specification for the Task Manager / Netty Proxy service.
type TaskManagerSpec struct {
CDAPServiceSpec `json:",inline"`
}

// StartupProbe defines the fields for setting corev1.Probe for the main containers in the service pods.
// For Probe config see:
// https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes.
Expand Down
21 changes: 21 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

25,550 changes: 1,337 additions & 24,213 deletions config/crd/bases/cdap.cdap.io_cdapmasters.yaml

Large diffs are not rendered by default.

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
3 changes: 3 additions & 0 deletions controllers/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ const (
// serviceUserInterface defines the service type for user interface
serviceUserInterface ServiceName = "UserInterface"

// serviceTaskManager defines the service type for task manager / netty proxy service
serviceTaskManager ServiceName = "TaskManager"

// serviceSystemMetricsExporter defines the service type for sidecar metrics collection service
serviceSystemMetricsExporter ServiceName = "SystemMetricsExporter"
)
Expand Down
5 changes: 3 additions & 2 deletions controllers/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func (d *DeploymentPlan) Init() {
"metadata": {serviceMetadata},
"router": {serviceRouter},
"userinterface": {serviceUserInterface},
"taskmanager": {serviceTaskManager},
},
networkService: map[NetworkServiceName]ServiceName{
"router": serviceRouter,
Expand Down Expand Up @@ -333,9 +334,9 @@ func startupProbeSpec(serviceSpec *v1alpha1.CDAPServiceSpec, service string) (*c
serviceName := strings.ToLower(service)
var endpoint string
if serviceName == "router" || serviceName == "userinterface" {
endpoint = fmt.Sprintf("http://localhost:%d/status", port)
endpoint = fmt.Sprintf("http://localhost:%d/status", port)
} else {
endpoint = fmt.Sprintf("https://localhost:%d/v3/system/services/%s/status", port, serviceName)
endpoint = fmt.Sprintf("https://localhost:%d/v3/system/services/%s/status", port, serviceName)
}

return &corev1.Probe{
Expand Down
3 changes: 2 additions & 1 deletion controllers/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ var _ = Describe("Controller Suite", func() {
It("k8s objs for just essential services", func() {
master.Spec.Runtime = nil
master.Spec.Messaging = nil
numOptionalServices := 2
master.Spec.TaskManager = nil
numOptionalServices := 3

emptyLabels := make(map[string]string)
spec, err := buildDeploymentPlanSpec(master, emptyLabels)
Expand Down
11 changes: 11 additions & 0 deletions controllers/testdata/cdap_master_cr.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,17 @@
}
}
},
"taskManager": {
"metadata": {
"creationTimestamp": null
},
"resources": {
"requests": {
"cpu": "100m",
"memory": "100Mi"
}
}
},
"securitySecret": "cdap-secret",
"serviceAccountName": "cdap",
"userInterface": {
Expand Down
Loading
Loading