Skip to content

Commit

Permalink
sync with latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
VaishnaviHire committed Nov 27, 2024
1 parent 828f33c commit 9007747
Show file tree
Hide file tree
Showing 23 changed files with 83 additions and 110 deletions.
2 changes: 1 addition & 1 deletion controllers/components/dashboard/dashboard_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error {
componentName := computeComponentName()

_, err := reconciler.ComponentReconcilerFor(mgr, &componentsv1.Dashboard{}).
_, err := reconciler.ReconcilerFor(mgr, &componentsv1.Dashboard{}).
// operands - owned
Owns(&corev1.ConfigMap{}).
Owns(&corev1.Secret{}).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,7 @@ func updateStatus(ctx context.Context, rr *odhtypes.ReconciliationRequest) error
&rl,
client.InNamespace(rr.DSCI.Spec.ApplicationsNamespace),
client.MatchingLabels(map[string]string{
<<<<<<< HEAD
labels.ComponentPartOf: strings.ToLower(componentsv1.DashboardKind),
=======
labels.PlatformPartOf: componentsv1.DashboardInstanceName,
>>>>>>> 51e8117b (Update label to platform.opendatahub.io)
labels.PlatformPartOf: strings.ToLower(componentsv1.DashboardKind),
}),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
)

func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error {
_, err := reconciler.ComponentReconcilerFor(mgr, &componentsv1.DataSciencePipelines{}).
_, err := reconciler.ReconcilerFor(mgr, &componentsv1.DataSciencePipelines{}).
// customized Owns() for Component with new predicates
Owns(&corev1.ConfigMap{}).
Owns(&corev1.Secret{}).
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/kueue/kueue_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import (
)

func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error {
_, err := reconciler.ComponentReconcilerFor(mgr, &componentsv1.Kueue{}).
_, err := reconciler.ReconcilerFor(mgr, &componentsv1.Kueue{}).
// customized Owns() for Component with new predicates
Owns(&corev1.ConfigMap{}).
Owns(&corev1.Secret{}).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
)

func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error {
_, err := reconciler.ComponentReconcilerFor(mgr, &componentsv1.ModelRegistry{}).
_, err := reconciler.ReconcilerFor(mgr, &componentsv1.ModelRegistry{}).
Owns(&corev1.ConfigMap{}).
Owns(&corev1.Secret{}).
Owns(&rbacv1.Role{}).
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/ray/ray_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
)

func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error {
_, err := reconciler.ComponentReconcilerFor(mgr, &componentsv1.Ray{}).
_, err := reconciler.ReconcilerFor(mgr, &componentsv1.Ray{}).
// customized Owns() for Component with new predicates
Owns(&corev1.ConfigMap{}).
Owns(&corev1.Secret{}).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
)

func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error {
_, err := reconciler.ComponentReconcilerFor(mgr, &componentsv1.TrainingOperator{}).
_, err := reconciler.ReconcilerFor(mgr, &componentsv1.TrainingOperator{}).
// customized Owns() for Component with new predicates
Owns(&corev1.ConfigMap{}).
Owns(&promv1.PodMonitor{}).
Expand Down
2 changes: 1 addition & 1 deletion controllers/components/trustyai/trustyai_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
)

func (s *componentHandler) NewComponentReconciler(ctx context.Context, mgr ctrl.Manager) error {
_, err := reconciler.ComponentReconcilerFor(mgr, &componentsv1.TrustyAI{}).
_, err := reconciler.ReconcilerFor(mgr, &componentsv1.TrustyAI{}).
// customized Owns() for Component with new predicates
Owns(&corev1.ConfigMap{}).
Owns(&corev1.ServiceAccount{}).
Expand Down
2 changes: 1 addition & 1 deletion controllers/services/monitoring/monitoring_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const serviceName = "monitoring"

// NewServiceReconciler creates a ServiceReconciler for the Monitoring API.
func NewServiceReconciler(ctx context.Context, mgr ctrl.Manager) error {
_, err := reconciler.ReconcilerFor(mgr, servicesv1.MonitoringInstanceName, &servicesv1.Monitoring{}).
_, err := reconciler.ReconcilerFor(mgr, &servicesv1.Monitoring{}).
// operands - owned
Owns(&corev1.ConfigMap{}).
Owns(&corev1.Secret{}).
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/actions/deploy/action_deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ func (a *Action) deploy(
resources.SetAnnotation(&obj, annotations.PlatformType, string(rr.Release.Name))
resources.SetAnnotation(&obj, annotations.PlatformVersion, rr.Release.Version.String())

if resources.GetLabel(&obj, labels.ComponentPartOf) == "" && fo != "" {
resources.SetLabel(&obj, labels.ComponentPartOf, fo)
if resources.GetLabel(&obj, labels.PlatformPartOf) == "" && fo != "" {
resources.SetLabel(&obj, labels.PlatformPartOf, fo)
}

// backup copy for caching
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/actions/deploy/action_deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestDeployAction(t *testing.T) {
g.Expect(err).ShouldNot(HaveOccurred())

g.Expect(obj1).Should(And(
jq.Match(`.metadata.labels."%s" == "%s"`, labels.ComponentPartOf, strings.ToLower(componentsv1.DashboardKind)),
jq.Match(`.metadata.labels."%s" == "%s"`, labels.PlatformPartOf, strings.ToLower(componentsv1.DashboardKind)),
jq.Match(`.metadata.annotations."%s" == "%s"`, annotations.InstanceGeneration, strconv.FormatInt(rr.Instance.GetGeneration(), 10)),
jq.Match(`.metadata.annotations."%s" == "%s"`, annotations.PlatformVersion, "1.2.3"),
jq.Match(`.metadata.annotations."%s" == "%s"`, annotations.PlatformType, string(cluster.OpenDataHub)),
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/actions/gc/action_gc.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (a *Action) run(ctx context.Context, rr *odhTypes.ReconciliationRequest) er
selector := a.selector
if selector == nil {
selector = labels.SelectorFromSet(map[string]string{
odhLabels.ComponentPartOf: strings.ToLower(kind),
odhLabels.PlatformPartOf: strings.ToLower(kind),
})
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/actions/gc/action_gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ func TestGcAction(t *testing.T) {
l[k] = v
}

l[labels.ComponentPartOf] = strings.ToLower(componentsv1.DashboardKind)
l[labels.PlatformPartOf] = strings.ToLower(componentsv1.DashboardKind)

cm := corev1.ConfigMap{
ObjectMeta: metav1.ObjectMeta{
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/actions/updatestatus/action_update_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ func (a *Action) run(ctx context.Context, rr *types.ReconciliationRequest) error
l[k] = v
}

if l[labels.ComponentPartOf] == "" {
if l[labels.PlatformPartOf] == "" {
kind, err := resources.KindForObject(rr.Client.Scheme(), rr.Instance)
if err != nil {
return err
}

l[labels.ComponentPartOf] = strings.ToLower(kind)
l[labels.PlatformPartOf] = strings.ToLower(kind)
}

obj, ok := rr.Instance.(types.ResourceObject)
Expand Down
20 changes: 10 additions & 10 deletions pkg/controller/actions/updatestatus/action_update_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestUpdateStatusActionNotReady(t *testing.T) {
Name: "my-deployment",
Namespace: ns,
Labels: map[string]string{
labels.ComponentPartOf: ns,
labels.PlatformPartOf: ns,
},
},
Status: appsv1.DeploymentStatus{
Expand All @@ -60,7 +60,7 @@ func TestUpdateStatusActionNotReady(t *testing.T) {
Name: "my-deployment-2",
Namespace: ns,
Labels: map[string]string{
labels.ComponentPartOf: ns,
labels.PlatformPartOf: ns,
},
},
Status: appsv1.DeploymentStatus{
Expand All @@ -73,7 +73,7 @@ func TestUpdateStatusActionNotReady(t *testing.T) {
g.Expect(err).ShouldNot(HaveOccurred())

action := updatestatus.NewAction(
updatestatus.WithSelectorLabel(labels.ComponentPartOf, ns))
updatestatus.WithSelectorLabel(labels.PlatformPartOf, ns))

rr := types.ReconciliationRequest{
Client: cl,
Expand Down Expand Up @@ -114,7 +114,7 @@ func TestUpdateStatusActionReady(t *testing.T) {
Name: "my-deployment",
Namespace: ns,
Labels: map[string]string{
labels.ComponentPartOf: ns,
labels.PlatformPartOf: ns,
},
},
Status: appsv1.DeploymentStatus{
Expand All @@ -131,7 +131,7 @@ func TestUpdateStatusActionReady(t *testing.T) {
Name: "my-deployment-2",
Namespace: ns,
Labels: map[string]string{
labels.ComponentPartOf: ns,
labels.PlatformPartOf: ns,
},
},
Status: appsv1.DeploymentStatus{
Expand All @@ -144,7 +144,7 @@ func TestUpdateStatusActionReady(t *testing.T) {
g.Expect(err).ShouldNot(HaveOccurred())

action := updatestatus.NewAction(
updatestatus.WithSelectorLabel(labels.ComponentPartOf, ns))
updatestatus.WithSelectorLabel(labels.PlatformPartOf, ns))

rr := types.ReconciliationRequest{
Client: cl,
Expand Down Expand Up @@ -185,7 +185,7 @@ func TestUpdateStatusActionReadyAutoSelector(t *testing.T) {
Name: "my-deployment",
Namespace: ns,
Labels: map[string]string{
labels.ComponentPartOf: strings.ToLower(componentsv1.DashboardKind),
labels.PlatformPartOf: strings.ToLower(componentsv1.DashboardKind),
},
},
Status: appsv1.DeploymentStatus{
Expand All @@ -202,7 +202,7 @@ func TestUpdateStatusActionReadyAutoSelector(t *testing.T) {
Name: "my-deployment-2",
Namespace: ns,
Labels: map[string]string{
labels.ComponentPartOf: strings.ToLower(componentsv1.DashboardKind),
labels.PlatformPartOf: strings.ToLower(componentsv1.DashboardKind),
},
},
Status: appsv1.DeploymentStatus{
Expand Down Expand Up @@ -255,7 +255,7 @@ func TestUpdateStatusActionNotReadyNotFound(t *testing.T) {
Name: "my-deployment",
Namespace: ns,
Labels: map[string]string{
labels.ComponentPartOf: ns,
labels.PlatformPartOf: ns,
},
},
Status: appsv1.DeploymentStatus{
Expand All @@ -272,7 +272,7 @@ func TestUpdateStatusActionNotReadyNotFound(t *testing.T) {
Name: "my-deployment-2",
Namespace: ns,
Labels: map[string]string{
labels.ComponentPartOf: ns,
labels.PlatformPartOf: ns,
},
},
Status: appsv1.DeploymentStatus{
Expand Down
Loading

0 comments on commit 9007747

Please sign in to comment.