Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameters to customize the service created by an an Experiment #4010

Open
ernestovm-st opened this issue Dec 18, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@ernestovm-st
Copy link

Summary

During the creation of an Experiment, is possible to create a service just passing the service name in the template of each pod to be created. Example:

apiVersion: argoproj.io/v1alpha1
kind: Experiment
metadata:
  name: my-experiment
  namespace: default
spec:
  
  duration: 30m
  progressDeadlineSeconds: 300
  templates:
    - name: pod-experiment-a
      replicas: 1
      service:
        name: pod-experiment-a
      selector:
        matchLabels:
          app: pod-experiment-a
      template:
        metadata:
          labels:
            app: pod-experiment-a
        spec:
          containers:
            - name: pod-experiment-a
              image: my-artifacts.dev/docker/pod-experiment:versiona
              imagePullPolicy: Always
              ports:
                - name: flask
                  containerPort: 5000
                  protocol: TCP
    - name: pod-experiment-b
      replicas: 1
      service:
        name: pod-experiment-b
      selector:
        matchLabels:
          app: pod-experiment-b
      template:
        metadata:
          labels:
            app: pod-experiment-b
        spec:
          containers:
            - name: pod-experiment-b
              image: my-artifacts.dev/docker/pod-experiment:versionb
              imagePullPolicy: Always
              ports:
                - name: flask
                  containerPort: 5000
                  protocol: TCP
  # List of AnalysisTemplate references to perform during the experiment
  analyses:
    - name: version-a
      templateName: pods-experiment
      args:
        - name: job
          value: version-a
        - name: namespace
          value: default
    - name: version-b
      templateName: pods-experiment
      args:
        - name: job
          value: version-b
        - name: namespace
          value: default

When the experiment is created, the services created looks like this (I'll just show just one):

apiVersion: v1
kind: Service
metadata:
  annotations:
    experiment.argoproj.io/name: my-experiment
    experiment.argoproj.io/template-name: pod-experiment-a
  creationTimestamp: "2024-12-18T13:01:03Z"
  name: pod-experiment-a
  namespace: default
  ownerReferences:
  - apiVersion: argoproj.io/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: Experiment
    name: my-experiment
    uid: 76456f57-b8a1-45ce-979c-07f5761fe878
  resourceVersion: "78448930"
  uid: 4c3f15b0-9fbc-4fba-b235-e3e6ec88903a
spec:
  clusterIP: x.x.x.x
  clusterIPs:
  - x.x.x.x
  internalTrafficPolicy: Cluster
  ipFamilies:
  - IPv4
  ipFamilyPolicy: SingleStack
  ports:
  - name: flask
    port: 5000
    protocol: TCP
    targetPort: 5000
  selector:
    rollouts-pod-template-hash: 89456c669
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

As showed above, the selector used by the service is rollouts-pod-template-hash, instead of the labels applied to the pod template. Additionally, cannot be configured in a different kind of service (i.e. LoadBalancer, Port, NodePort...)

Use Cases

Customize the service can be used for

  • Select an appropriate kind of service (useful when you are in a Kubernetes provider)
  • Do not reconfigure scrapping configuration in monitoring / observability tools (i.e. Prometheus) in order to gather metrics exposed by experiment's pods
  • Add pods into the service out of the scope of the experiment. I.E. you want to mix some pods running in production under the same experiment service.

Message from the maintainers:

Impacted by this bug? Give it a 👍. We prioritize the issues with the most 👍.

@ernestovm-st ernestovm-st added the enhancement New feature or request label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant