Skip to content

Commit 6812440

Browse files
committed
Add Function Status
1 parent 5e985ac commit 6812440

File tree

11 files changed

+603
-24
lines changed

11 files changed

+603
-24
lines changed

operator/api/v1alpha1/function_types.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,16 @@ type PulsarSinkSpec struct {
8383

8484
// FunctionStatus defines the observed state of Function
8585
type FunctionStatus struct {
86-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
87-
// Important: Run "make" to regenerate code after modifying this file
86+
// Number of available pods (ready for at least minReadySeconds)
87+
AvailableReplicas int32 `json:"availableReplicas,omitempty"`
88+
// Total number of ready pods
89+
ReadyReplicas int32 `json:"readyReplicas,omitempty"`
90+
// Total number of non-terminated pods targeted by this deployment
91+
Replicas int32 `json:"replicas,omitempty"`
92+
// Total number of updated pods
93+
UpdatedReplicas int32 `json:"updatedReplicas,omitempty"`
94+
// Most recent generation observed for this Function
95+
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
8896
}
8997

9098
// +kubebuilder:object:root=true

operator/api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 87 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

operator/cmd/main.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ func main() {
6363
var probeAddr string
6464
var secureMetrics bool
6565
var enableHTTP2 bool
66+
var pulsarServiceUrl string
67+
var pulsarAuthPlugin string
68+
var pulsarAuthParams string
6669
var tlsOpts []func(*tls.Config)
6770
flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+
6871
"Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.")
@@ -81,12 +84,23 @@ func main() {
8184
flag.StringVar(&metricsCertKey, "metrics-cert-key", "tls.key", "The name of the metrics server key file.")
8285
flag.BoolVar(&enableHTTP2, "enable-http2", false,
8386
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
87+
// Pulsar CLI flags
88+
flag.StringVar(&pulsarServiceUrl, "pulsar-service-url", os.Getenv("PULSAR_SERVICE_URL"), "Pulsar service URL")
89+
flag.StringVar(&pulsarAuthPlugin, "pulsar-auth-plugin", os.Getenv("PULSAR_AUTH_PLUGIN"), "Pulsar auth plugin")
90+
flag.StringVar(&pulsarAuthParams, "pulsar-auth-params", os.Getenv("PULSAR_AUTH_PARAMS"), "Pulsar auth params")
8491
opts := zap.Options{
8592
Development: true,
8693
}
8794
opts.BindFlags(flag.CommandLine)
8895
flag.Parse()
8996

97+
// Build Config struct (no need to set env)
98+
config := controller.Config{
99+
PulsarServiceURL: pulsarServiceUrl,
100+
PulsarAuthPlugin: pulsarAuthPlugin,
101+
PulsarAuthParams: pulsarAuthParams,
102+
}
103+
90104
ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
91105

92106
// if the enable-http2 flag is false (the default), http/2 should be disabled
@@ -212,6 +226,7 @@ func main() {
212226
if err = (&controller.FunctionReconciler{
213227
Client: mgr.GetClient(),
214228
Scheme: mgr.GetScheme(),
229+
Config: config,
215230
}).SetupWithManager(mgr); err != nil {
216231
setupLog.Error(err, "unable to create controller", "controller", "Function")
217232
os.Exit(1)

operator/config/crd/bases/fs.functionstream.github.io_functions.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,28 @@ spec:
112112
type: object
113113
status:
114114
description: FunctionStatus defines the observed state of Function
115+
properties:
116+
availableReplicas:
117+
description: Number of available pods (ready for at least minReadySeconds)
118+
format: int32
119+
type: integer
120+
observedGeneration:
121+
description: Most recent generation observed for this Function
122+
format: int64
123+
type: integer
124+
readyReplicas:
125+
description: Total number of ready pods
126+
format: int32
127+
type: integer
128+
replicas:
129+
description: Total number of non-terminated pods targeted by this
130+
deployment
131+
format: int32
132+
type: integer
133+
updatedReplicas:
134+
description: Total number of updated pods
135+
format: int32
136+
type: integer
115137
type: object
116138
type: object
117139
served: true

operator/deploy/crds/fs.functionstream.github.io_functions.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,28 @@ spec:
114114
type: object
115115
status:
116116
description: FunctionStatus defines the observed state of Function
117+
properties:
118+
availableReplicas:
119+
description: Number of available pods (ready for at least minReadySeconds)
120+
format: int32
121+
type: integer
122+
observedGeneration:
123+
description: Most recent generation observed for this Function
124+
format: int64
125+
type: integer
126+
readyReplicas:
127+
description: Total number of ready pods
128+
format: int32
129+
type: integer
130+
replicas:
131+
description: Total number of non-terminated pods targeted by this
132+
deployment
133+
format: int32
134+
type: integer
135+
updatedReplicas:
136+
description: Total number of updated pods
137+
format: int32
138+
type: integer
117139
type: object
118140
type: object
119141
served: true

0 commit comments

Comments
 (0)