Skip to content

Commit e840f08

Browse files
committed
Optimize generated CRD size
1 parent 49adcb9 commit e840f08

File tree

8 files changed

+283
-2296
lines changed

8 files changed

+283
-2296
lines changed

Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ vet: ## Run go vet against code.
5757

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

6262
##@ Build
6363

@@ -110,7 +110,6 @@ $(LOCALBIN):
110110
KUSTOMIZE ?= $(LOCALBIN)/kustomize
111111
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
112112
ENVTEST ?= $(LOCALBIN)/setup-envtest
113-
ETCD_MAX_REQUEST_BYTES=2500000
114113

115114
## Tool Versions
116115
KUSTOMIZE_VERSION ?= v3.8.7

api/v1alpha1/cdapmaster_types.go

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ type CDAPMasterSpec struct {
128128
// Mutations can include adding init containers, tolerations and node selectors to pods. To use mutations,
129129
// the admission control webhook should be enabled in the cdap operator.
130130
MutationConfigs []MutationConfig `json:"mutationConfigs,omitempty"`
131+
// StartupProbe is specification for the startup probe for CDAP system services.
132+
// This is an optional field which ensures that the application is fully initialized
133+
// before it starts receiving traffic.
134+
// To disable the startup probe: either omit or set the field to nil.
135+
// To enable the startup probe: set it to a pointer to a SystemMetricsExporterSpec
136+
// struct (can be an empty struct). CDAPServiceSpec.EnableStartupProbe field also needs
137+
// to be set to true for the deployment services which require startup probe to be enabled.
138+
StartupProbe *StartupProbeSpec `json:"startupProbe,omitempty"`
131139
}
132140

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

184192
// CDAPScalableServiceSpec defines the base specification for master services that can have more than one instance.
@@ -298,6 +306,24 @@ type SystemMetricExporterSpec struct {
298306
CDAPServiceSpec `json:",inline"`
299307
}
300308

309+
type StartupProbeSpec struct {
310+
// For Probe config see:
311+
// https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes.
312+
313+
// Number of seconds after the container has started before probes are initiated.
314+
// Defaults to 0 seconds. Minimum value is 0.
315+
InitialDelaySeconds *int32 `json:"initialDelaySeconds,omitempty"`
316+
// How often (in seconds) to perform the probe.
317+
// Default to 10 seconds. The minimum value is 1.
318+
PeriodSeconds *int32 `json:"periodSeconds,omitempty"`
319+
// Number of seconds after which the probe times out.
320+
// Defaults to 1 second. Minimum value is 1.
321+
TimeoutSeconds *int32 `json:"timeoutSeconds,omitempty"`
322+
// Number of consecutive failures before considering the service not ready.
323+
// Defaults to 3. Minimum value is 1.
324+
FailureThreshold *int32 `json:"failureThreshold,omitempty"`
325+
}
326+
301327
// CDAPMasterStatus defines the observed state of CDAPMaster
302328
type CDAPMasterStatus struct {
303329
status.Meta `json:",inline"`

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 44 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)