Skip to content

Commit

Permalink
Optimize generated CRD size
Browse files Browse the repository at this point in the history
  • Loading branch information
vsethi09 committed Jan 17, 2025
1 parent 49adcb9 commit 573da7e
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 2,295 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ vet: ## Run go vet against code.

.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" ETCD_MAX_REQUEST_BYTES=2500000 go test ./... -coverprofile cover.out
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... -coverprofile cover.out

##@ Build

Expand Down
25 changes: 22 additions & 3 deletions api/v1alpha1/cdapmaster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ type CDAPMasterSpec struct {
// Mutations can include adding init containers, tolerations and node selectors to pods. To use mutations,
// the admission control webhook should be enabled in the cdap operator.
MutationConfigs []MutationConfig `json:"mutationConfigs,omitempty"`
// StartupProbe is specification for the startup probe for CDAP system services.
// This is an optional field which ensures that the application is fully initialized
// before it starts receiving traffic.
// To disable the startup probe: either omit or set the field to nil.
// To enable the startup probe: set it to a pointer to a SystemMetricsExporterSpec
// struct (can be an empty struct). CDAPServiceSpec.EnableStartupProbe field also needs
// to be set to true for the deployment services which require startup probe to be enabled.
StartupProbe *StartupProbeSpec `json:"startupProbe,omitempty"`
}

// CDAPServiceSpec defines the base set of specifications applicable to all master services.
Expand Down Expand Up @@ -176,9 +184,9 @@ type CDAPServiceSpec struct {
Lifecycle *corev1.Lifecycle `json:"lifecycle,omitempty"`
// Affinity describes node affinity scheduling rules for the service.
Affinity *corev1.Affinity `json:"affinity,omitempty"`
// StartupProbe describes the startupProbe to indicates that the Pod has
// successfully initialized.
StartupProbe *corev1.Probe `json:"startupProbe,omitempty"`
// EnableStartupProbe is an optional field to indicate if StatusProbe should
// be enabled for the container.
EnableStartupProbe *bool `json:"enableStartupProbe,omitempty"`
}

// CDAPScalableServiceSpec defines the base specification for master services that can have more than one instance.
Expand Down Expand Up @@ -298,6 +306,17 @@ type SystemMetricExporterSpec struct {
CDAPServiceSpec `json:",inline"`
}

type StartupProbeSpec struct {
// Number of consecutive failures before considering the service not ready.
FailureThreshold int32 `json:"failureThreshold,omitempty"`
// How often to perform the probe (in seconds).
PeriodSeconds int32 `json:"periodSeconds,omitempty"`
// Number of consecutive successes before considering the service ready.
SuccessThreshold int32 `json:"successThreshold,omitempty"`
// Number of seconds after which the probe times out.
TimeoutSeconds int32 `json:"timeoutSeconds,omitempty"`
}

// CDAPMasterStatus defines the observed state of CDAPMaster
type CDAPMasterStatus struct {
status.Meta `json:",inline"`
Expand Down
28 changes: 24 additions & 4 deletions api/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 573da7e

Please sign in to comment.