File size: 2,958 Bytes
447ebeb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
suite: Service Configuration Tests
templates:
  - service.yaml
tests:
  - it: should create a default ClusterIP service
    template: service.yaml
    asserts:
      - isKind:
          of: Service
      - equal:
          path: spec.type
          value: ClusterIP
      - equal:
          path: spec.ports[0].port
          value: 4000
      - equal:
          path: spec.ports[0].targetPort
          value: http
      - equal:
          path: spec.ports[0].protocol
          value: TCP
      - equal:
          path: spec.ports[0].name
          value: http
      - isNull:
          path: spec.loadBalancerClass

  - it: should create a NodePort service when specified
    template: service.yaml
    set:
      service.type: NodePort
    asserts:
      - isKind:
          of: Service
      - equal:
          path: spec.type
          value: NodePort
      - isNull:
          path: spec.loadBalancerClass

  - it: should create a LoadBalancer service when specified
    template: service.yaml
    set:
      service.type: LoadBalancer
    asserts:
      - isKind:
          of: Service
      - equal:
          path: spec.type
          value: LoadBalancer
      - isNull:
          path: spec.loadBalancerClass

  - it: should add loadBalancerClass when specified with LoadBalancer type
    template: service.yaml
    set:
      service.type: LoadBalancer
      service.loadBalancerClass: tailscale
    asserts:
      - isKind:
          of: Service
      - equal:
          path: spec.type
          value: LoadBalancer
      - equal:
          path: spec.loadBalancerClass
          value: tailscale

  - it: should not add loadBalancerClass when specified with ClusterIP type
    template: service.yaml
    set:
      service.type: ClusterIP
      service.loadBalancerClass: tailscale
    asserts:
      - isKind:
          of: Service
      - equal:
          path: spec.type
          value: ClusterIP
      - isNull:
          path: spec.loadBalancerClass

  - it: should use custom port when specified
    template: service.yaml
    set:
      service.port: 8080
    asserts:
      - equal:
          path: spec.ports[0].port
          value: 8080

  - it: should add service annotations when specified
    template: service.yaml
    set:
      service.annotations:
        cloud.google.com/load-balancer-type: "Internal"
        service.beta.kubernetes.io/aws-load-balancer-internal: "true"
    asserts:
      - isKind:
          of: Service
      - equal:
          path: metadata.annotations
          value:
            cloud.google.com/load-balancer-type: "Internal"
            service.beta.kubernetes.io/aws-load-balancer-internal: "true"

  - it: should use the correct selector labels
    template: service.yaml
    asserts:
      - isNotNull:
          path: spec.selector
      - equal:
          path: spec.selector
          value:
            app.kubernetes.io/name: litellm
            app.kubernetes.io/instance: RELEASE-NAME