Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Clutch
Commits
fd003cc4
Commit
fd003cc4
authored
4 years ago
by
Rithu John
Browse files
Options
Download
Email Patches
Plain Diff
address feedback
parent
7c2cc600
extend-configmaps
No related merge requests found
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
api/k8s/v1/k8s.proto
+2
-2
api/k8s/v1/k8s.proto
backend/api/k8s/v1/k8s.pb.go
+509
-502
backend/api/k8s/v1/k8s.pb.go
backend/api/k8s/v1/k8s.pb.validate.go
+13
-6
backend/api/k8s/v1/k8s.pb.validate.go
backend/service/k8s/configmap.go
+3
-3
backend/service/k8s/configmap.go
backend/service/k8s/configmap_test.go
+2
-3
backend/service/k8s/configmap_test.go
frontend/api/src/index.d.ts
+2
-2
frontend/api/src/index.d.ts
frontend/api/src/index.js
+25
-11
frontend/api/src/index.js
with
556 additions
and
529 deletions
+556
-529
api/k8s/v1/k8s.proto
+
2
-
2
View file @
fd003cc4
...
...
@@ -730,9 +730,9 @@ message ConfigMap {
map
<
string
,
string
>
annotations
=
4
;
map
<
string
,
string
>
labels
=
5
;
// represents a configmaps data field which is
simple
// represents a configmaps data field which is
a
// key:value map
google.protobuf.
Struct
data
=
6
;
map
<
string
,
google.protobuf.
Value
>
data
=
6
;
}
message
ListConfigMapsRequest
{
...
...
This diff is collapsed.
Click to expand it.
backend/api/k8s/v1/k8s.pb.go
+
509
-
502
View file @
fd003cc4
This diff is collapsed.
Click to expand it.
backend/api/k8s/v1/k8s.pb.validate.go
+
13
-
6
View file @
fd003cc4
...
...
@@ -4065,14 +4065,21 @@ func (m *ConfigMap) Validate() error {
// no validation rules for Labels
if
v
,
ok
:=
interface
{}(
m
.
GetData
())
.
(
interface
{
Validate
()
error
});
ok
{
if
err
:=
v
.
Validate
();
err
!=
nil
{
return
ConfigMapValidationError
{
field
:
"Data"
,
reason
:
"embedded message failed validation"
,
cause
:
err
,
for
key
,
val
:=
range
m
.
GetData
()
{
_
=
val
// no validation rules for Data[key]
if
v
,
ok
:=
interface
{}(
val
)
.
(
interface
{
Validate
()
error
});
ok
{
if
err
:=
v
.
Validate
();
err
!=
nil
{
return
ConfigMapValidationError
{
field
:
fmt
.
Sprintf
(
"Data[%v]"
,
key
),
reason
:
"embedded message failed validation"
,
cause
:
err
,
}
}
}
}
return
nil
...
...
This diff is collapsed.
Click to expand it.
backend/service/k8s/configmap.go
+
3
-
3
View file @
fd003cc4
...
...
@@ -83,11 +83,11 @@ func protoForConfigMap(cluster string, k8sconfigMap *v1.ConfigMap) *k8sapiv1.Con
}
// optional fields
if
k8sconfigMap
.
Data
!=
nil
{
dataMap
:=
make
(
map
[
string
]
interface
{}
,
len
(
k8sconfigMap
.
Data
))
dataMap
:=
make
(
map
[
string
]
*
structpb
.
Value
,
len
(
k8sconfigMap
.
Data
))
for
k
,
v
:=
range
k8sconfigMap
.
Data
{
dataMap
[
k
]
=
v
dataMap
[
k
]
,
_
=
structpb
.
NewValue
(
v
)
}
ret
.
Data
,
_
=
structpb
.
NewStruct
(
dataMap
)
ret
.
Data
=
dataMap
}
return
ret
}
This diff is collapsed.
Click to expand it.
backend/service/k8s/configmap_test.go
+
2
-
3
View file @
fd003cc4
...
...
@@ -210,10 +210,9 @@ func TestProtoForConfigMap(t *testing.T) {
if
len
(
tt
.
configMap
.
Data
)
>
0
{
mapData
:=
tt
.
configMap
.
Data
mapResult
:=
configMap
.
Data
.
AsMap
()
for
key
,
val
:=
range
mapResult
{
assert
.
Equal
(
t
,
mapData
[
key
],
val
)
for
key
,
val
:=
range
configMap
.
Data
{
assert
.
Equal
(
t
,
mapData
[
key
],
val
.
GetStringValue
()
)
}
}
})
...
...
This diff is collapsed.
Click to expand it.
frontend/api/src/index.d.ts
+
2
-
2
View file @
fd003cc4
...
...
@@ -12882,7 +12882,7 @@ export namespace clutch {
labels?: ({ [k: string]: string }|null);
/** ConfigMap data */
data?: (google.protobuf.I
Struct
|null);
data?: (
{ [k: string]:
google.protobuf.I
Value }
|null);
}
/** Represents a ConfigMap. */
...
...
@@ -12910,7 +12910,7 @@ export namespace clutch {
public labels: { [k: string]: string };
/** ConfigMap data. */
public data
?
:
(
google.protobuf.I
Struct|null)
;
public data
: { [k: string]
: google.protobuf.I
Value }
;
/**
* Verifies a ConfigMap message.
...
...
This diff is collapsed.
Click to expand it.
frontend/api/src/index.js
+
25
-
11
View file @
fd003cc4
...
...
@@ -30461,7 +30461,7 @@ export const clutch = $root.clutch = (() => {
* @property {string|null} [name] ConfigMap name
* @property {Object.<string,string>|null} [annotations] ConfigMap annotations
* @property {Object.<string,string>|null} [labels] ConfigMap labels
* @property {google.protobuf.I
Struct
|null} [data] ConfigMap data
* @property {
Object.<string,
google.protobuf.I
Value>
|null} [data] ConfigMap data
*/
/**
...
...
@@ -30475,6 +30475,7 @@ export const clutch = $root.clutch = (() => {
function ConfigMap(properties) {
this.annotations = {};
this.labels = {};
this.data = {};
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
...
...
@@ -30523,11 +30524,11 @@ export const clutch = $root.clutch = (() => {
/**
* ConfigMap data.
* @member {google.protobuf.I
Struct|null|undefined
} data
* @member {
Object.<string,
google.protobuf.I
Value>
} data
* @memberof clutch.k8s.v1.ConfigMap
* @instance
*/
ConfigMap.prototype.data =
null
;
ConfigMap.prototype.data =
$util.emptyObject
;
/**
* Verifies a ConfigMap message.
...
...
@@ -30566,9 +30567,14 @@ export const clutch = $root.clutch = (() => {
return "labels: string{k:string} expected";
}
if (message.data != null && message.hasOwnProperty("data")) {
let error = $root.google.protobuf.Struct.verify(message.data);
if (error)
return "data." + error;
if (!$util.isObject(message.data))
return "data: object expected";
let key = Object.keys(message.data);
for (let i = 0; i < key.length; ++i) {
let error = $root.google.protobuf.Value.verify(message.data[key[i]]);
if (error)
return "data." + error;
}
}
return null;
};
...
...
@@ -30605,10 +30611,15 @@ export const clutch = $root.clutch = (() => {
for (let keys = Object.keys(object.labels), i = 0; i < keys.length; ++i)
message.labels[keys[i]] = String(object.labels[keys[i]]);
}
if (object.data
!= null
) {
if (object.data) {
if (typeof object.data !== "object")
throw TypeError(".clutch.k8s.v1.ConfigMap.data: object expected");
message.data = $root.google.protobuf.Struct.fromObject(object.data);
message.data = {};
for (let keys = Object.keys(object.data), i = 0; i < keys.length; ++i) {
if (typeof object.data[keys[i]] !== "object")
throw TypeError(".clutch.k8s.v1.ConfigMap.data: object expected");
message.data[keys[i]] = $root.google.protobuf.Value.fromObject(object.data[keys[i]]);
}
}
return message;
};
...
...
@@ -30629,12 +30640,12 @@ export const clutch = $root.clutch = (() => {
if (options.objects || options.defaults) {
object.annotations = {};
object.labels = {};
object.data = {};
}
if (options.defaults) {
object.cluster = "";
object.namespace = "";
object.name = "";
object.data = null;
}
if (message.cluster != null && message.hasOwnProperty("cluster"))
object.cluster = message.cluster;
...
...
@@ -30653,8 +30664,11 @@ export const clutch = $root.clutch = (() => {
for (let j = 0; j < keys2.length; ++j)
object.labels[keys2[j]] = message.labels[keys2[j]];
}
if (message.data != null && message.hasOwnProperty("data"))
object.data = $root.google.protobuf.Struct.toObject(message.data, options);
if (message.data && (keys2 = Object.keys(message.data)).length) {
object.data = {};
for (let j = 0; j < keys2.length; ++j)
object.data[keys2[j]] = $root.google.protobuf.Value.toObject(message.data[keys2[j]], options);
}
return object;
};
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help