(c *Controller)
| 276 | } |
| 277 | |
| 278 | func 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 | |
| 309 | func ServiceObjectKey(c *Controller) client.ObjectKey { |
| 310 | name := c.GetServiceName(c.Req.Name) |
nothing calls this directly
no outgoing calls
no test coverage detected