Skip to content

Commit

Permalink
Change labels to match ODH v2 component name
Browse files Browse the repository at this point in the history
  • Loading branch information
ruivieira committed Sep 27, 2023
1 parent c5d7489 commit 6988f71
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 18 deletions.
3 changes: 3 additions & 0 deletions config/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ resources:
- ../rbac
- ../manager

commonLabels:
app.kubernetes.io/part-of: trustyai

patchesStrategicMerge:
- manager_auth_proxy_patch.yaml

Expand Down
14 changes: 14 additions & 0 deletions controllers/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package controllers

const (
defaultImage = string("quay.io/trustyai/trustyai-service")
defaultTag = string("latest")
containerName = "trustyai-service"
componentName = "trustyai"
serviceMonitorName = "trustyai-metrics"
finalizerName = "trustyai.opendatahub.io.trustyai.opendatahub.io/finalizer"
payloadProcessorName = "MM_PAYLOAD_PROCESSORS"
modelMeshLabelKey = "modelmesh-service"
modelMeshLabelValue = "modelmesh-serving"
volumeMountName = "volume"
)
4 changes: 2 additions & 2 deletions controllers/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func generateServiceMonitorSpecCentral(deploymentNamespace string) *monitoringv1
},
Selector: metav1.LabelSelector{
MatchLabels: map[string]string{
"app.kubernetes.io/part-of": serviceType,
"app.kubernetes.io/part-of": componentName,
},
},
},
Expand Down Expand Up @@ -117,7 +117,7 @@ func generateServiceMonitorSpecLocal(deploymentNamespace string, serviceName str
},
Selector: metav1.LabelSelector{
MatchLabels: map[string]string{
"app.kubernetes.io/part-of": serviceType,
"app.kubernetes.io/part-of": componentName,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ var _ = Describe("TrustyAI operator", func() {
Expect(deployment.Labels["app"]).Should(Equal(name))
Expect(deployment.Labels["app.kubernetes.io/name"]).Should(Equal(name))
Expect(deployment.Labels["app.kubernetes.io/instance"]).Should(Equal(name))
Expect(deployment.Labels["app.kubernetes.io/part-of"]).Should(Equal(serviceType))
Expect(deployment.Labels["app.kubernetes.io/part-of"]).Should(Equal(componentName))
Expect(deployment.Labels["app.kubernetes.io/version"]).Should(Equal("0.1.0"))

Expect(deployment.Spec.Template.Spec.Containers[0].Image).Should(Equal("quay.io/trustyai/trustyai-service:latest"))
Expand Down Expand Up @@ -298,7 +298,7 @@ var _ = Describe("TrustyAI operator", func() {
Expect(deployment.Labels["app"]).Should(Equal(name))
Expect(deployment.Labels["app.kubernetes.io/name"]).Should(Equal(name))
Expect(deployment.Labels["app.kubernetes.io/instance"]).Should(Equal(name))
Expect(deployment.Labels["app.kubernetes.io/part-of"]).Should(Equal(serviceType))
Expect(deployment.Labels["app.kubernetes.io/part-of"]).Should(Equal(componentName))
Expect(deployment.Labels["app.kubernetes.io/version"]).Should(Equal("0.1.0"))

Expect(deployment.Spec.Template.Spec.Containers[0].Image).Should(Equal("quay.io/trustyai/trustyai-service:latest"))
Expand Down
15 changes: 1 addition & 14 deletions controllers/trustyaiservice_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,6 @@ import (

var ErrPVCNotReady = goerrors.New("PVC is not ready")

const (
defaultImage = string("quay.io/trustyai/trustyai-service")
defaultTag = string("latest")
containerName = "trustyai-service"
serviceMonitorName = "trustyai-metrics"
finalizerName = "trustyai.opendatahub.io.trustyai.opendatahub.io/finalizer"
payloadProcessorName = "MM_PAYLOAD_PROCESSORS"
modelMeshLabelKey = "modelmesh-service"
modelMeshLabelValue = "modelmesh-serving"
volumeMountName = "volume"
serviceType = "trustyai-service"
)

// TrustyAIServiceReconciler reconciles a TrustyAIService object
type TrustyAIServiceReconciler struct {
client.Client
Expand Down Expand Up @@ -80,7 +67,7 @@ func getCommonLabels(serviceName string) map[string]string {
"app": serviceName,
"app.kubernetes.io/name": serviceName,
"app.kubernetes.io/instance": serviceName,
"app.kubernetes.io/part-of": serviceType,
"app.kubernetes.io/part-of": componentName,
"app.kubernetes.io/version": "0.1.0",
}
}
Expand Down

0 comments on commit 6988f71

Please sign in to comment.