MCPcopy Create free account
hub / github.com/PaddlePaddle/PaddleCloud / SourceSecretObjectKey

Function SourceSecretObjectKey

pkg/sampleset/ctrls/base_controller.go:278–307  ·  view source on GitHub ↗
(c *Controller)

Source from the content-addressed store, hash-verified

276}
277
278func SourceSecretObjectKey(c *Controller) client.ObjectKey {
279 // under SampleSet controller
280 if sampleSet, ok := c.Sample.(*v1alpha1.SampleSet); ok {
281 name := sampleSet.Spec.SecretRef.Name
282 namespace := c.Req.Namespace
283 if sampleSet.Spec.SecretRef.Namespace != "" {
284 namespace = sampleSet.Spec.SecretRef.Namespace
285 }
286 // if source secret is not nil then use it
287 if sampleSet.Spec.Source != nil && sampleSet.Spec.Source.SecretRef != nil {
288 if sampleSet.Spec.Source.SecretRef.Name != "" {
289 name = sampleSet.Spec.Source.SecretRef.Name
290 }
291 if sampleSet.Spec.Source.SecretRef.Namespace != "" {
292 namespace = sampleSet.Spec.Source.SecretRef.Namespace
293 }
294 }
295 return client.ObjectKey{Name: name, Namespace: namespace}
296 }
297 // under SampleJob Controller
298 if sampleJob, ok := c.Sample.(*v1alpha1.SampleJob); ok {
299 name := sampleJob.Spec.SecretRef.Name
300 namespace := c.Req.Namespace
301 if sampleJob.Spec.SecretRef.Namespace != "" {
302 namespace = sampleJob.Spec.SecretRef.Namespace
303 }
304 return client.ObjectKey{Name: name, Namespace: namespace}
305 }
306 panic(fmt.Errorf("%s is not register in SourceSecretObjectKey", c.Sample.GetObjectKind().GroupVersionKind().String()))
307}
308
309func ServiceObjectKey(c *Controller) client.ObjectKey {
310 name := c.GetServiceName(c.Req.Name)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected