File tree 5 files changed +37
-3
lines changed
5 files changed +37
-3
lines changed Original file line number Diff line number Diff line change 21
21
#docs/*.md
22
22
# Then explicitly reverse the ignore rule for a single file:
23
23
#!docs/README.md
24
+ lib/Kubernetes/ApiClient.pm
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ requires 'Module::Runtime';
6
6
requires ' URI::Query' ;
7
7
requires ' Module::Find' ;
8
8
requires ' LWP::UserAgent' ;
9
+ requires ' LWP::Protocol::https' ;
9
10
requires ' Class::Accessor' ;
10
11
11
12
on ' test' => sub {
Original file line number Diff line number Diff line change
1
+ use strict;
2
+ use warnings;
3
+
4
+ my $api_factory = Kubernetes::ApiFactory-> new(
5
+ ' base_url' => ' https://127.0.0.1:6443' ,
6
+ ' ssl_opts' => {
7
+ # Disabling server ca validation
8
+ # SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
9
+ # verify_hostname => 0,
10
+
11
+ SSL_use_cert => 1,
12
+ SSL_ca_file => " /path/to/ca" ,
13
+ SSL_cert_file => " /path/to/cert" ,
14
+ SSL_key_file => " /path/to/key" ,
15
+ },
16
+ );
17
+
18
+ my $corev1_api = $api_factory -> get_api(' CoreV1' );
19
+
20
+ my $namespaceList = $corev1_api -> list_namespace();
21
+
22
+ printf " found %d namespaces:\n " , scalar @{$namespaceList -> items};
23
+ printf " =====================\n " , length @{$namespaceList -> items};
24
+ foreach my $namespace (@{$namespaceList -> items}) {
25
+ printf " %s \n " , $namespace -> metadata-> name;
26
+ }
Original file line number Diff line number Diff line change @@ -51,10 +51,12 @@ sub new {
51
51
}
52
52
53
53
my (%args ) = (
54
- ' ua' => LWP::UserAgent-> new,
54
+ ' ua' => LWP::UserAgent-> new(
55
+ ssl_opts => $config -> {ssl_opts },
56
+ ),
55
57
' config' => $config ,
56
58
);
57
-
59
+
58
60
return bless \%args , $class ;
59
61
}
60
62
Original file line number Diff line number Diff line change @@ -110,7 +110,11 @@ sub new {
110
110
$p {access_token } //= ' ' ;
111
111
112
112
# base_url
113
- $p {base_url } //= ' http://localhost' ;
113
+ $p {base_url } //= ' http://localhost' ;
114
+
115
+ $p {ssl_opts } //= {
116
+ verify_hostname => 1,
117
+ };
114
118
115
119
return bless \%p => $self ;
116
120
}
You can’t perform that action at this time.
0 commit comments