forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testdata.go
83 lines (78 loc) · 1.63 KB
/
testdata.go
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
package test
import (
"github.com/argoproj/argo-cd/common"
appsv1 "k8s.io/api/apps/v1"
apiv1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
)
const (
TestNamespace = "test-namespace"
TestAppInstanceName = "test-app-instance"
)
func DemoService() *apiv1.Service {
return &apiv1.Service{
TypeMeta: metav1.TypeMeta{
APIVersion: "v1",
Kind: "Service",
},
ObjectMeta: metav1.ObjectMeta{
Name: "demo",
Namespace: TestNamespace,
Labels: map[string]string{
common.LabelKeyAppInstance: TestAppInstanceName,
},
},
Spec: apiv1.ServiceSpec{
Ports: []apiv1.ServicePort{
{
Port: 80,
TargetPort: intstr.FromInt(80),
},
},
Selector: map[string]string{
"app": "demo",
},
Type: "ClusterIP",
},
}
}
func DemoDeployment() *appsv1.Deployment {
var two int32 = 2
return &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
APIVersion: "apps/v1beta1",
Kind: "Deployment",
},
ObjectMeta: metav1.ObjectMeta{
Name: "demo",
Namespace: TestNamespace,
Labels: map[string]string{
common.LabelKeyAppInstance: TestAppInstanceName,
},
},
Spec: appsv1.DeploymentSpec{
Replicas: &two,
Template: apiv1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: map[string]string{
"app": "demo",
},
},
Spec: apiv1.PodSpec{
Containers: []apiv1.Container{
{
Name: "demo",
Image: "gcr.io/kuar-demo/kuard-amd64:1",
Ports: []apiv1.ContainerPort{
{
ContainerPort: 80,
},
},
},
},
},
},
},
}
}