forked from redhat-developer/vscode-openshift-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateServiceTypes.ts
More file actions
135 lines (120 loc) · 3.42 KB
/
createServiceTypes.ts
File metadata and controls
135 lines (120 loc) · 3.42 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*-----------------------------------------------------------------------------------------------
* Copyright (c) Red Hat, Inc. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*-----------------------------------------------------------------------------------------------*/
/**
* Represents the parts that we care about for the ClusterServiceVersion (CSV) Kubernetes resource.
*/
export type ClusterServiceVersion = {
spec: {
customresourcedefinitions: {
/**
* Stubs that describe the Custom Resource Definitions that this CSV have created.
*/
owned: CustomResourceDefinitionStub[];
};
/**
* Description of the ClusterServiceVersion, usually containing a description on how to use the Operator.
*/
description: string;
/**
* An array of base64-encoded icons
*/
icon: string[];
};
};
/**
* Represents the shortened description of a CustomResourceDefinition that's included in the ClusterServiceVersion.
*/
export type CustomResourceDefinitionStub = {
/**
* Pascal-case name
*/
kind: string;
/**
* FQN
*/
name: string;
version: string;
/**
* Additional documentation for the properties under `.spec`
*/
specDescriptors: SpecDescriptor[];
/**
* Added property, not part of what's reported by the cluster.
* The description of the associated ClusterServiceVersion.
*/
csvDescription?: string;
};
/**
* Represents an additional piece of documentation for one of the properties
*/
export type SpecDescriptor = {
description: string;
displayName: string;
/**
* The JSON path to the property that this describes
*/
path: string;
}
export type OwnerReference = {
name: string;
kind: string;
uid: string;
apiVersion: string;
controller?: boolean;
blockOwnerDeletion?: boolean;
};
export type ObjectMetadata = {
annotations?: { [key: string]: string };
clusterName?: string;
creationTimestamp?: string;
deletionGracePeriodSeconds?: number;
deletionTimestamp?: string;
finalizers?: string[];
generateName?: string;
generation?: number;
labels?: { [key: string]: string };
managedFields?: any[];
name?: string;
namespace?: string;
ownerReferences?: OwnerReference[];
resourceVersion?: string;
uid?: string;
};
// Properties common to (almost) all Kubernetes resources.
export type K8sResourceCommon = {
apiVersion?: string;
kind?: string;
metadata?: ObjectMetadata;
};
export type MatchExpression = {
key: string;
operator: 'Exists' | 'DoesNotExist' | 'In' | 'NotIn' | 'Equals' | 'NotEqual';
values?: string[];
value?: string;
};
export type MatchLabels = {
[key: string]: string;
};
export type Selector = {
matchLabels?: MatchLabels;
matchExpressions?: MatchExpression[];
};
export type Port = {
name: string;
port: string;
protocol: string;
targetPort: string;
};
// Generic, unknown kind. Avoid when possible since it allows any key in spec
// or status, weakening type checking.
export type K8sResourceKind = K8sResourceCommon & {
spec?: {
selector?: Selector | MatchLabels;
ports?: Port[];
[key: string]: any;
};
status?: { [key: string]: any };
data?: { [key: string]: any };
};