forked from tkestack/tke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
images.go
111 lines (96 loc) · 4.38 KB
/
images.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
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
/*
* Tencent is pleased to support the open source community by making TKEStack
* available.
*
* Copyright (C) 2012-2019 Tencent. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
* License at
*
* https://opensource.org/licenses/Apache-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package images
import (
"reflect"
"sort"
"tkestack.io/tke/pkg/app/version"
"tkestack.io/tke/pkg/util/containerregistry"
)
type Components struct {
Registry containerregistry.Image
Busybox containerregistry.Image
InfluxDB containerregistry.Image
ProviderRes containerregistry.Image
TKEGateway containerregistry.Image
TKEAuthAPI containerregistry.Image
TKEAuthController containerregistry.Image
TKEBusinessAPI containerregistry.Image
TKEBusinessController containerregistry.Image
TKEMonitorAPI containerregistry.Image
TKEMonitorController containerregistry.Image
TKENotifyAPI containerregistry.Image
TKENotifyController containerregistry.Image
TKEPlatformAPI containerregistry.Image
TKEPlatformController containerregistry.Image
TKERegistryAPI containerregistry.Image
TKERegistryController containerregistry.Image
TKELogagentAPI containerregistry.Image
TKELogagentController containerregistry.Image
TKEAudit containerregistry.Image
TKEApplicationAPI containerregistry.Image
TKEApplicationController containerregistry.Image
}
func (c Components) Get(name string) *containerregistry.Image {
v := reflect.ValueOf(c)
for i := 0; i < v.NumField(); i++ {
v, _ := v.Field(i).Interface().(containerregistry.Image)
if v.Name == name {
return &v
}
}
return nil
}
var Version = version.Get().GitVersion
var components = Components{
Registry: containerregistry.Image{Name: "registry", Tag: "2.7.1"},
Busybox: containerregistry.Image{Name: "busybox", Tag: "1.31.1"},
InfluxDB: containerregistry.Image{Name: "influxdb", Tag: "1.7.9"},
ProviderRes: containerregistry.Image{Name: "provider-res", Tag: "v1.19.7-1"},
TKEAuthAPI: containerregistry.Image{Name: "tke-auth-api", Tag: Version},
TKEAuthController: containerregistry.Image{Name: "tke-auth-controller", Tag: Version},
TKEBusinessAPI: containerregistry.Image{Name: "tke-business-api", Tag: Version},
TKEBusinessController: containerregistry.Image{Name: "tke-business-controller", Tag: Version},
TKEGateway: containerregistry.Image{Name: "tke-gateway", Tag: Version},
TKEMonitorAPI: containerregistry.Image{Name: "tke-monitor-api", Tag: Version},
TKEMonitorController: containerregistry.Image{Name: "tke-monitor-controller", Tag: Version},
TKENotifyAPI: containerregistry.Image{Name: "tke-notify-api", Tag: Version},
TKENotifyController: containerregistry.Image{Name: "tke-notify-controller", Tag: Version},
TKEPlatformAPI: containerregistry.Image{Name: "tke-platform-api", Tag: Version},
TKEPlatformController: containerregistry.Image{Name: "tke-platform-controller", Tag: Version},
TKERegistryAPI: containerregistry.Image{Name: "tke-registry-api", Tag: Version},
TKERegistryController: containerregistry.Image{Name: "tke-registry-controller", Tag: Version},
TKELogagentAPI: containerregistry.Image{Name: "tke-logagent-api", Tag: Version},
TKELogagentController: containerregistry.Image{Name: "tke-logagent-controller", Tag: Version},
TKEAudit: containerregistry.Image{Name: "tke-audit-api", Tag: Version},
TKEApplicationAPI: containerregistry.Image{Name: "tke-application-api", Tag: Version},
TKEApplicationController: containerregistry.Image{Name: "tke-application-controller", Tag: Version},
}
func List() []string {
var items []string
v := reflect.ValueOf(components)
for i := 0; i < v.NumField(); i++ {
v, _ := v.Field(i).Interface().(containerregistry.Image)
items = append(items, v.BaseName())
}
sort.Strings(items)
return items
}
func Get() Components {
return components
}