Skip to content

Commit 02892b3

Browse files
committed
spec.feastProject & status.applied logic
Signed-off-by: Tommy Hughes <tohughes@redhat.com>
1 parent b5ab6c7 commit 02892b3

File tree

16 files changed

+1236
-41
lines changed

16 files changed

+1236
-41
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Copyright 2024 Feast Community.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package feastversion
18+
19+
// Feast release version
20+
const FeastVersion = "0.40.0"

infra/feast-operator/api/v1alpha1/featurestore_types.go

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,59 @@ import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121
)
2222

23-
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24-
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
23+
const (
24+
// Feast phases:
25+
ReadyPhase = "Ready"
26+
PendingPhase = "Pending"
27+
FailedPhase = "Failed"
28+
29+
// Feast condition types:
30+
ClientReadyType = "Client"
31+
RegistryReadyType = "Registry"
32+
ReadyType = "FeatureStore"
33+
34+
// Feast condition reasons:
35+
ReadyReason = "Ready"
36+
FailedReason = "FeatureStoreFailed"
37+
RegistryFailedReason = "RegistryDeploymentFailed"
38+
ClientFailedReason = "ClientDeploymentFailed"
39+
40+
// Feast condition messages:
41+
ReadyMessage = "FeatureStore installation complete"
42+
RegistryReadyMessage = "Registry installation complete"
43+
ClientReadyMessage = "Client installation complete"
44+
45+
// entity_key_serialization_version
46+
SerializationVersion = 3
47+
)
2548

2649
// FeatureStoreSpec defines the desired state of FeatureStore
2750
type FeatureStoreSpec struct {
2851
// +kubebuilder:validation:Pattern="^[A-Za-z0-9][A-Za-z0-9_]*$"
29-
// FeastProject is the Feast project id. This can be any alphanumeric string with underscores, but it cannot start with an underscore.
52+
// FeastProject is the Feast project id. This can be any alphanumeric string with underscores, but it cannot start with an underscore. Required.
3053
FeastProject string `json:"feastProject"`
3154
}
3255

3356
// FeatureStoreStatus defines the observed state of FeatureStore
3457
type FeatureStoreStatus struct {
35-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
36-
// Important: Run "make" to regenerate code after modifying this file
58+
Applied FeatureStoreSpec `json:"applied,omitempty"`
59+
ClientConfigMap string `json:"clientConfigMap,omitempty"`
60+
Conditions []metav1.Condition `json:"conditions,omitempty"`
61+
FeastVersion string `json:"feastVersion,omitempty"`
62+
Phase string `json:"phase,omitempty"`
63+
ServiceUrls ServiceUrls `json:"serviceUrls,omitempty"`
64+
}
65+
66+
// ServiceUrls
67+
type ServiceUrls struct {
68+
Registry string `json:"registry,omitempty"`
3769
}
3870

3971
//+kubebuilder:object:root=true
4072
//+kubebuilder:subresource:status
73+
//+kubebuilder:resource:shortName=feast
74+
//+kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.phase`
75+
//+kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
4176

4277
// FeatureStore is the Schema for the featurestores API
4378
type FeatureStore struct {

infra/feast-operator/api/v1alpha1/zz_generated.deepcopy.go

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

infra/feast-operator/bundle/manifests/feast-operator.clusterserviceversion.yaml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,15 @@ metadata:
88
"apiVersion": "feast.dev/v1alpha1",
99
"kind": "FeatureStore",
1010
"metadata": {
11-
"labels": {
12-
"app.kubernetes.io/managed-by": "kustomize",
13-
"app.kubernetes.io/name": "feast-operator"
14-
},
15-
"name": "featurestore-sample"
11+
"name": "feast-sample"
1612
},
17-
"spec": null
13+
"spec": {
14+
"feastProject": "my_project"
15+
}
1816
}
1917
]
2018
capabilities: Basic Install
21-
createdAt: "2024-10-09T16:16:53Z"
19+
createdAt: "2024-10-21T14:24:47Z"
2220
operators.operatorframework.io/builder: operator-sdk-v1.37.0
2321
operators.operatorframework.io/project_layout: go.kubebuilder.io/v4
2422
name: feast-operator.v0.40.0
@@ -41,6 +39,29 @@ spec:
4139
spec:
4240
clusterPermissions:
4341
- rules:
42+
- apiGroups:
43+
- apps
44+
resources:
45+
- deployments
46+
verbs:
47+
- create
48+
- delete
49+
- get
50+
- list
51+
- update
52+
- watch
53+
- apiGroups:
54+
- ""
55+
resources:
56+
- configmaps
57+
- services
58+
verbs:
59+
- create
60+
- delete
61+
- get
62+
- list
63+
- update
64+
- watch
4465
- apiGroups:
4566
- feast.dev
4667
resources:

infra/feast-operator/bundle/manifests/feast.dev_featurestores.yaml

Lines changed: 105 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,19 @@ spec:
1111
kind: FeatureStore
1212
listKind: FeatureStoreList
1313
plural: featurestores
14+
shortNames:
15+
- feast
1416
singular: featurestore
1517
scope: Namespaced
1618
versions:
17-
- name: v1alpha1
19+
- additionalPrinterColumns:
20+
- jsonPath: .status.phase
21+
name: Status
22+
type: string
23+
- jsonPath: .metadata.creationTimestamp
24+
name: Age
25+
type: date
26+
name: v1alpha1
1827
schema:
1928
openAPIV3Schema:
2029
description: FeatureStore is the Schema for the featurestores API
@@ -42,14 +51,108 @@ spec:
4251
feastProject:
4352
description: FeastProject is the Feast project id. This can be any
4453
alphanumeric string with underscores, but it cannot start with an
45-
underscore.
54+
underscore. Required.
4655
pattern: ^[A-Za-z0-9][A-Za-z0-9_]*$
4756
type: string
4857
required:
4958
- feastProject
5059
type: object
5160
status:
5261
description: FeatureStoreStatus defines the observed state of FeatureStore
62+
properties:
63+
applied:
64+
description: FeatureStoreSpec defines the desired state of FeatureStore
65+
properties:
66+
feastProject:
67+
description: FeastProject is the Feast project id. This can be
68+
any alphanumeric string with underscores, but it cannot start
69+
with an underscore. Required.
70+
pattern: ^[A-Za-z0-9][A-Za-z0-9_]*$
71+
type: string
72+
required:
73+
- feastProject
74+
type: object
75+
clientConfigMap:
76+
type: string
77+
conditions:
78+
items:
79+
description: "Condition contains details for one aspect of the current
80+
state of this API Resource.\n---\nThis struct is intended for
81+
direct use as an array at the field path .status.conditions. For
82+
example,\n\n\n\ttype FooStatus struct{\n\t // Represents the
83+
observations of a foo's current state.\n\t // Known .status.conditions.type
84+
are: \"Available\", \"Progressing\", and \"Degraded\"\n\t //
85+
+patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t
86+
\ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\"
87+
patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t
88+
\ // other fields\n\t}"
89+
properties:
90+
lastTransitionTime:
91+
description: |-
92+
lastTransitionTime is the last time the condition transitioned from one status to another.
93+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
94+
format: date-time
95+
type: string
96+
message:
97+
description: |-
98+
message is a human readable message indicating details about the transition.
99+
This may be an empty string.
100+
maxLength: 32768
101+
type: string
102+
observedGeneration:
103+
description: |-
104+
observedGeneration represents the .metadata.generation that the condition was set based upon.
105+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
106+
with respect to the current state of the instance.
107+
format: int64
108+
minimum: 0
109+
type: integer
110+
reason:
111+
description: |-
112+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
113+
Producers of specific condition types may define expected values and meanings for this field,
114+
and whether the values are considered a guaranteed API.
115+
The value should be a CamelCase string.
116+
This field may not be empty.
117+
maxLength: 1024
118+
minLength: 1
119+
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
120+
type: string
121+
status:
122+
description: status of the condition, one of True, False, Unknown.
123+
enum:
124+
- "True"
125+
- "False"
126+
- Unknown
127+
type: string
128+
type:
129+
description: |-
130+
type of condition in CamelCase or in foo.example.com/CamelCase.
131+
---
132+
Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be
133+
useful (see .node.status.conditions), the ability to deconflict is important.
134+
The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
135+
maxLength: 316
136+
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
137+
type: string
138+
required:
139+
- lastTransitionTime
140+
- message
141+
- reason
142+
- status
143+
- type
144+
type: object
145+
type: array
146+
feastVersion:
147+
type: string
148+
phase:
149+
type: string
150+
serviceUrls:
151+
description: ServiceUrls
152+
properties:
153+
registry:
154+
type: string
155+
type: object
53156
type: object
54157
type: object
55158
served: true

infra/feast-operator/cmd/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ import (
2525
// to ensure that exec-entrypoint and run can make use of them.
2626
_ "k8s.io/client-go/plugin/pkg/client/auth"
2727

28+
corev1 "k8s.io/api/core/v1"
2829
"k8s.io/apimachinery/pkg/runtime"
2930
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
3031
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
3132
ctrl "sigs.k8s.io/controller-runtime"
33+
"sigs.k8s.io/controller-runtime/pkg/client"
3234
"sigs.k8s.io/controller-runtime/pkg/healthz"
3335
"sigs.k8s.io/controller-runtime/pkg/log/zap"
3436
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
@@ -116,6 +118,13 @@ func main() {
116118
// if you are doing or is intended to do any operation such as perform cleanups
117119
// after the manager stops then its usage might be unsafe.
118120
// LeaderElectionReleaseOnCancel: true,
121+
Client: client.Options{
122+
Cache: &client.CacheOptions{
123+
DisableFor: []client.Object{
124+
&corev1.ConfigMap{},
125+
},
126+
},
127+
},
119128
})
120129
if err != nil {
121130
setupLog.Error(err, "unable to start manager")

0 commit comments

Comments
 (0)