Skip to content

Commit 6fa16f8

Browse files
authored
Merge pull request #247 from arangodb/bugfix/kube-1.11-pv-fix
Fixed PV creation on kubernetes 1.11
2 parents 448f340 + 4a096f2 commit 6fa16f8

File tree

4,933 files changed

+707790
-309073
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,933 files changed

+707790
-309073
lines changed

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ update-vendor:
162162
github.com/coreos/go-semver/semver \
163163
github.com/dchest/uniuri \
164164
github.com/dgrijalva/jwt-go \
165+
github.com/gin-gonic/gin \
166+
github.com/jessevdk/go-assets-builder \
165167
github.com/julienschmidt/httprouter \
166168
github.com/pkg/errors \
167169
github.com/prometheus/client_golang/prometheus \
@@ -171,6 +173,7 @@ update-vendor:
171173
github.com/stretchr/testify
172174
@$(PULSAR) go flatten -V $(VENDORDIR) $(VENDORDIR)
173175
@${MAKE} -B -s clean
176+
# Manually restore arangosync vendor with: git checkout deps/github.com/arangodb/arangosync
174177

175178
.PHONY: update-generated
176179
update-generated: $(GOBUILDDIR)
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Microsoft Corporation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# go-ansiterm
2+
3+
This is a cross platform Ansi Terminal Emulation library. It reads a stream of Ansi characters and produces the appropriate function calls. The results of the function calls are platform dependent.
4+
5+
For example the parser might receive "ESC, [, A" as a stream of three characters. This is the code for Cursor Up (http://www.vt100.net/docs/vt510-rm/CUU). The parser then calls the cursor up function (CUU()) on an event handler. The event handler determines what platform specific work must be done to cause the cursor to move up one position.
6+
7+
The parser (parser.go) is a partial implementation of this state machine (http://vt100.net/emu/vt500_parser.png). There are also two event handler implementations, one for tests (test_event_handler.go) to validate that the expected events are being produced and called, the other is a Windows implementation (winterm/win_event_handler.go).
8+
9+
See parser_test.go for examples exercising the state machine and generating appropriate function calls.
10+
11+
-----
12+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
package ansiterm
2+
3+
const LogEnv = "DEBUG_TERMINAL"
4+
5+
// ANSI constants
6+
// References:
7+
// -- http://www.ecma-international.org/publications/standards/Ecma-048.htm
8+
// -- http://man7.org/linux/man-pages/man4/console_codes.4.html
9+
// -- http://manpages.ubuntu.com/manpages/intrepid/man4/console_codes.4.html
10+
// -- http://en.wikipedia.org/wiki/ANSI_escape_code
11+
// -- http://vt100.net/emu/dec_ansi_parser
12+
// -- http://vt100.net/emu/vt500_parser.svg
13+
// -- http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
14+
// -- http://www.inwap.com/pdp10/ansicode.txt
15+
const (
16+
// ECMA-48 Set Graphics Rendition
17+
// Note:
18+
// -- Constants leading with an underscore (e.g., _ANSI_xxx) are unsupported or reserved
19+
// -- Fonts could possibly be supported via SetCurrentConsoleFontEx
20+
// -- Windows does not expose the per-window cursor (i.e., caret) blink times
21+
ANSI_SGR_RESET = 0
22+
ANSI_SGR_BOLD = 1
23+
ANSI_SGR_DIM = 2
24+
_ANSI_SGR_ITALIC = 3
25+
ANSI_SGR_UNDERLINE = 4
26+
_ANSI_SGR_BLINKSLOW = 5
27+
_ANSI_SGR_BLINKFAST = 6
28+
ANSI_SGR_REVERSE = 7
29+
_ANSI_SGR_INVISIBLE = 8
30+
_ANSI_SGR_LINETHROUGH = 9
31+
_ANSI_SGR_FONT_00 = 10
32+
_ANSI_SGR_FONT_01 = 11
33+
_ANSI_SGR_FONT_02 = 12
34+
_ANSI_SGR_FONT_03 = 13
35+
_ANSI_SGR_FONT_04 = 14
36+
_ANSI_SGR_FONT_05 = 15
37+
_ANSI_SGR_FONT_06 = 16
38+
_ANSI_SGR_FONT_07 = 17
39+
_ANSI_SGR_FONT_08 = 18
40+
_ANSI_SGR_FONT_09 = 19
41+
_ANSI_SGR_FONT_10 = 20
42+
_ANSI_SGR_DOUBLEUNDERLINE = 21
43+
ANSI_SGR_BOLD_DIM_OFF = 22
44+
_ANSI_SGR_ITALIC_OFF = 23
45+
ANSI_SGR_UNDERLINE_OFF = 24
46+
_ANSI_SGR_BLINK_OFF = 25
47+
_ANSI_SGR_RESERVED_00 = 26
48+
ANSI_SGR_REVERSE_OFF = 27
49+
_ANSI_SGR_INVISIBLE_OFF = 28
50+
_ANSI_SGR_LINETHROUGH_OFF = 29
51+
ANSI_SGR_FOREGROUND_BLACK = 30
52+
ANSI_SGR_FOREGROUND_RED = 31
53+
ANSI_SGR_FOREGROUND_GREEN = 32
54+
ANSI_SGR_FOREGROUND_YELLOW = 33
55+
ANSI_SGR_FOREGROUND_BLUE = 34
56+
ANSI_SGR_FOREGROUND_MAGENTA = 35
57+
ANSI_SGR_FOREGROUND_CYAN = 36
58+
ANSI_SGR_FOREGROUND_WHITE = 37
59+
_ANSI_SGR_RESERVED_01 = 38
60+
ANSI_SGR_FOREGROUND_DEFAULT = 39
61+
ANSI_SGR_BACKGROUND_BLACK = 40
62+
ANSI_SGR_BACKGROUND_RED = 41
63+
ANSI_SGR_BACKGROUND_GREEN = 42
64+
ANSI_SGR_BACKGROUND_YELLOW = 43
65+
ANSI_SGR_BACKGROUND_BLUE = 44
66+
ANSI_SGR_BACKGROUND_MAGENTA = 45
67+
ANSI_SGR_BACKGROUND_CYAN = 46
68+
ANSI_SGR_BACKGROUND_WHITE = 47
69+
_ANSI_SGR_RESERVED_02 = 48
70+
ANSI_SGR_BACKGROUND_DEFAULT = 49
71+
// 50 - 65: Unsupported
72+
73+
ANSI_MAX_CMD_LENGTH = 4096
74+
75+
MAX_INPUT_EVENTS = 128
76+
DEFAULT_WIDTH = 80
77+
DEFAULT_HEIGHT = 24
78+
79+
ANSI_BEL = 0x07
80+
ANSI_BACKSPACE = 0x08
81+
ANSI_TAB = 0x09
82+
ANSI_LINE_FEED = 0x0A
83+
ANSI_VERTICAL_TAB = 0x0B
84+
ANSI_FORM_FEED = 0x0C
85+
ANSI_CARRIAGE_RETURN = 0x0D
86+
ANSI_ESCAPE_PRIMARY = 0x1B
87+
ANSI_ESCAPE_SECONDARY = 0x5B
88+
ANSI_OSC_STRING_ENTRY = 0x5D
89+
ANSI_COMMAND_FIRST = 0x40
90+
ANSI_COMMAND_LAST = 0x7E
91+
DCS_ENTRY = 0x90
92+
CSI_ENTRY = 0x9B
93+
OSC_STRING = 0x9D
94+
ANSI_PARAMETER_SEP = ";"
95+
ANSI_CMD_G0 = '('
96+
ANSI_CMD_G1 = ')'
97+
ANSI_CMD_G2 = '*'
98+
ANSI_CMD_G3 = '+'
99+
ANSI_CMD_DECPNM = '>'
100+
ANSI_CMD_DECPAM = '='
101+
ANSI_CMD_OSC = ']'
102+
ANSI_CMD_STR_TERM = '\\'
103+
104+
KEY_CONTROL_PARAM_2 = ";2"
105+
KEY_CONTROL_PARAM_3 = ";3"
106+
KEY_CONTROL_PARAM_4 = ";4"
107+
KEY_CONTROL_PARAM_5 = ";5"
108+
KEY_CONTROL_PARAM_6 = ";6"
109+
KEY_CONTROL_PARAM_7 = ";7"
110+
KEY_CONTROL_PARAM_8 = ";8"
111+
KEY_ESC_CSI = "\x1B["
112+
KEY_ESC_N = "\x1BN"
113+
KEY_ESC_O = "\x1BO"
114+
115+
FILL_CHARACTER = ' '
116+
)
117+
118+
func getByteRange(start byte, end byte) []byte {
119+
bytes := make([]byte, 0, 32)
120+
for i := start; i <= end; i++ {
121+
bytes = append(bytes, byte(i))
122+
}
123+
124+
return bytes
125+
}
126+
127+
var toGroundBytes = getToGroundBytes()
128+
var executors = getExecuteBytes()
129+
130+
// SPACE 20+A0 hex Always and everywhere a blank space
131+
// Intermediate 20-2F hex !"#$%&'()*+,-./
132+
var intermeds = getByteRange(0x20, 0x2F)
133+
134+
// Parameters 30-3F hex 0123456789:;<=>?
135+
// CSI Parameters 30-39, 3B hex 0123456789;
136+
var csiParams = getByteRange(0x30, 0x3F)
137+
138+
var csiCollectables = append(getByteRange(0x30, 0x39), getByteRange(0x3B, 0x3F)...)
139+
140+
// Uppercase 40-5F hex @ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
141+
var upperCase = getByteRange(0x40, 0x5F)
142+
143+
// Lowercase 60-7E hex `abcdefghijlkmnopqrstuvwxyz{|}~
144+
var lowerCase = getByteRange(0x60, 0x7E)
145+
146+
// Alphabetics 40-7E hex (all of upper and lower case)
147+
var alphabetics = append(upperCase, lowerCase...)
148+
149+
var printables = getByteRange(0x20, 0x7F)
150+
151+
var escapeIntermediateToGroundBytes = getByteRange(0x30, 0x7E)
152+
var escapeToGroundBytes = getEscapeToGroundBytes()
153+
154+
// See http://www.vt100.net/emu/vt500_parser.png for description of the complex
155+
// byte ranges below
156+
157+
func getEscapeToGroundBytes() []byte {
158+
escapeToGroundBytes := getByteRange(0x30, 0x4F)
159+
escapeToGroundBytes = append(escapeToGroundBytes, getByteRange(0x51, 0x57)...)
160+
escapeToGroundBytes = append(escapeToGroundBytes, 0x59)
161+
escapeToGroundBytes = append(escapeToGroundBytes, 0x5A)
162+
escapeToGroundBytes = append(escapeToGroundBytes, 0x5C)
163+
escapeToGroundBytes = append(escapeToGroundBytes, getByteRange(0x60, 0x7E)...)
164+
return escapeToGroundBytes
165+
}
166+
167+
func getExecuteBytes() []byte {
168+
executeBytes := getByteRange(0x00, 0x17)
169+
executeBytes = append(executeBytes, 0x19)
170+
executeBytes = append(executeBytes, getByteRange(0x1C, 0x1F)...)
171+
return executeBytes
172+
}
173+
174+
func getToGroundBytes() []byte {
175+
groundBytes := []byte{0x18}
176+
groundBytes = append(groundBytes, 0x1A)
177+
groundBytes = append(groundBytes, getByteRange(0x80, 0x8F)...)
178+
groundBytes = append(groundBytes, getByteRange(0x91, 0x97)...)
179+
groundBytes = append(groundBytes, 0x99)
180+
groundBytes = append(groundBytes, 0x9A)
181+
groundBytes = append(groundBytes, 0x9C)
182+
return groundBytes
183+
}
184+
185+
// Delete 7F hex Always and everywhere ignored
186+
// C1 Control 80-9F hex 32 additional control characters
187+
// G1 Displayable A1-FE hex 94 additional displayable characters
188+
// Special A0+FF hex Same as SPACE and DELETE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package ansiterm
2+
3+
type ansiContext struct {
4+
currentChar byte
5+
paramBuffer []byte
6+
interBuffer []byte
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package ansiterm
2+
3+
type csiEntryState struct {
4+
baseState
5+
}
6+
7+
func (csiState csiEntryState) Handle(b byte) (s state, e error) {
8+
logger.Infof("CsiEntry::Handle %#x", b)
9+
10+
nextState, err := csiState.baseState.Handle(b)
11+
if nextState != nil || err != nil {
12+
return nextState, err
13+
}
14+
15+
switch {
16+
case sliceContains(alphabetics, b):
17+
return csiState.parser.ground, nil
18+
case sliceContains(csiCollectables, b):
19+
return csiState.parser.csiParam, nil
20+
case sliceContains(executors, b):
21+
return csiState, csiState.parser.execute()
22+
}
23+
24+
return csiState, nil
25+
}
26+
27+
func (csiState csiEntryState) Transition(s state) error {
28+
logger.Infof("CsiEntry::Transition %s --> %s", csiState.Name(), s.Name())
29+
csiState.baseState.Transition(s)
30+
31+
switch s {
32+
case csiState.parser.ground:
33+
return csiState.parser.csiDispatch()
34+
case csiState.parser.csiParam:
35+
switch {
36+
case sliceContains(csiParams, csiState.parser.context.currentChar):
37+
csiState.parser.collectParam()
38+
case sliceContains(intermeds, csiState.parser.context.currentChar):
39+
csiState.parser.collectInter()
40+
}
41+
}
42+
43+
return nil
44+
}
45+
46+
func (csiState csiEntryState) Enter() error {
47+
csiState.parser.clear()
48+
return nil
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package ansiterm
2+
3+
type csiParamState struct {
4+
baseState
5+
}
6+
7+
func (csiState csiParamState) Handle(b byte) (s state, e error) {
8+
logger.Infof("CsiParam::Handle %#x", b)
9+
10+
nextState, err := csiState.baseState.Handle(b)
11+
if nextState != nil || err != nil {
12+
return nextState, err
13+
}
14+
15+
switch {
16+
case sliceContains(alphabetics, b):
17+
return csiState.parser.ground, nil
18+
case sliceContains(csiCollectables, b):
19+
csiState.parser.collectParam()
20+
return csiState, nil
21+
case sliceContains(executors, b):
22+
return csiState, csiState.parser.execute()
23+
}
24+
25+
return csiState, nil
26+
}
27+
28+
func (csiState csiParamState) Transition(s state) error {
29+
logger.Infof("CsiParam::Transition %s --> %s", csiState.Name(), s.Name())
30+
csiState.baseState.Transition(s)
31+
32+
switch s {
33+
case csiState.parser.ground:
34+
return csiState.parser.csiDispatch()
35+
}
36+
37+
return nil
38+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package ansiterm
2+
3+
type escapeIntermediateState struct {
4+
baseState
5+
}
6+
7+
func (escState escapeIntermediateState) Handle(b byte) (s state, e error) {
8+
logger.Infof("escapeIntermediateState::Handle %#x", b)
9+
nextState, err := escState.baseState.Handle(b)
10+
if nextState != nil || err != nil {
11+
return nextState, err
12+
}
13+
14+
switch {
15+
case sliceContains(intermeds, b):
16+
return escState, escState.parser.collectInter()
17+
case sliceContains(executors, b):
18+
return escState, escState.parser.execute()
19+
case sliceContains(escapeIntermediateToGroundBytes, b):
20+
return escState.parser.ground, nil
21+
}
22+
23+
return escState, nil
24+
}
25+
26+
func (escState escapeIntermediateState) Transition(s state) error {
27+
logger.Infof("escapeIntermediateState::Transition %s --> %s", escState.Name(), s.Name())
28+
escState.baseState.Transition(s)
29+
30+
switch s {
31+
case escState.parser.ground:
32+
return escState.parser.escDispatch()
33+
}
34+
35+
return nil
36+
}

0 commit comments

Comments
 (0)