-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathnode-shell-setting.tsx
More file actions
119 lines (113 loc) · 4.06 KB
/
Copy pathnode-shell-setting.tsx
File metadata and controls
119 lines (113 loc) · 4.06 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
/**
* Copyright (c) OpenLens Authors. All rights reserved.
* Licensed under MIT License. See LICENSE in root directory for more information.
*/
import type { Cluster } from "../../../common/cluster/cluster";
import { makeObservable, observable, runInAction } from "mobx";
import { SubTitle } from "../layout/sub-title";
import React from "react";
import { Input } from "../input/input";
import { observer } from "mobx-react";
import { Icon } from "@k8slens/icon";
import { initialNodeShellImage, initialNodeShellWindowsImage } from "../../../common/cluster-types";
import Gutter from "../gutter/gutter";
export interface ClusterNodeShellSettingProps {
cluster: Cluster;
}
@observer
export class ClusterNodeShellSetting extends React.Component<ClusterNodeShellSettingProps> {
@observable nodeShellImage = this.props.cluster.preferences?.nodeShellImage || "";
@observable nodeShellWindowsImage = this.props.cluster.preferences?.nodeShellWindowsImage || "";
@observable imagePullSecret = this.props.cluster.preferences?.imagePullSecret || "";
constructor(props: ClusterNodeShellSettingProps) {
super(props);
makeObservable(this);
}
componentWillUnmount() {
runInAction(() => {
this.props.cluster.preferences.nodeShellImage = this.nodeShellImage || undefined;
this.props.cluster.preferences.nodeShellWindowsImage = this.nodeShellWindowsImage || undefined;
this.props.cluster.preferences.imagePullSecret = this.imagePullSecret || undefined;
});
}
render() {
return (
<>
<section>
<SubTitle title="Node shell image for Linux" id="node-shell-image"/>
<Input
theme="round-black"
placeholder={`Default image: ${initialNodeShellImage}`}
value={this.nodeShellImage}
onChange={value => this.nodeShellImage = value}
iconRight={
this.nodeShellImage
? (
<Icon
smallest
material="close"
onClick={() => this.nodeShellImage = ""}
tooltip="Reset"
/>
)
: undefined
}
/>
<small className="hint">
Node shell image. Used for creating node shell pod on Linux nodes.
</small>
</section>
<Gutter />
<section>
<SubTitle title="Node shell image for Windows" id="node-shell-windows-image"/>
<Input
theme="round-black"
placeholder={`Default image: ${initialNodeShellWindowsImage}`}
value={this.nodeShellWindowsImage}
onChange={value => this.nodeShellWindowsImage = value}
iconRight={
this.nodeShellWindowsImage
? (
<Icon
smallest
material="close"
onClick={() => this.nodeShellWindowsImage = ""}
tooltip="Reset"
/>
)
: undefined
}
/>
<small className="hint">
Node shell image. Used for creating node shell pod on Windows nodes.
</small>
</section>
<Gutter />
<section>
<SubTitle title="Image pull secret" id="image-pull-secret"/>
<Input
placeholder="Specify a secret name..."
theme="round-black"
value={this.imagePullSecret}
onChange={value => this.imagePullSecret = value}
iconRight={
this.imagePullSecret
? (
<Icon
smallest
material="close"
onClick={() => this.imagePullSecret = ""}
tooltip="Clear"
/>
)
: undefined
}
/>
<small className="hint">
Name of a pre-existing secret in the kube-system namespace. An optional setting. Used for pulling image from a private registry.
</small>
</section>
</>
);
}
}