Skip to content

Commit 4aa8bb7

Browse files
authored
Merge pull request #198 from swhoro/fixed
add support of reading certificate-authority file
2 parents c223563 + 79ab588 commit 4aa8bb7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kubernetes/config/kube_config_yaml.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ mapping :: = MAPPING - START(node node) * MAPPING - END
4444
#define KEY_USER_AUTH_PROVIDER_CONFIG_IDP_ISSUE_URL "idp-issuer-url"
4545
#define KEY_USER_AUTH_PROVIDER_CONFIG_REFRESH_TOKEN "refresh-token"
4646
#define KEY_CERTIFICATE_AUTHORITY_DATA "certificate-authority-data"
47+
#define KEY_CERTIFICATE_AUTHORITY "certificate-authority"
4748
#define KEY_INSECURE_SKIP_TLS_VERIFY "insecure-skip-tls-verify"
4849
#define KEY_SERVER "server"
4950
#define KEY_CLIENT_CERTIFICATE "client-certificate"
@@ -192,7 +193,7 @@ static int parse_kubeconfig_yaml_string_mapping_sequence(keyValuePair_t *** p_st
192193

193194
static int parse_kubeconfig_yaml_property_mapping(kubeconfig_property_t * property, yaml_document_t * document, yaml_node_t * node)
194195
{
195-
static char fname[] = "parse_kubeconfig_yaml_property_info_mapping()";
196+
static char fname[] = "parse_kubeconfig_yaml_property_mapping()";
196197

197198
yaml_node_pair_t *pair = NULL;
198199
yaml_node_t *key = NULL;
@@ -214,6 +215,8 @@ static int parse_kubeconfig_yaml_property_mapping(kubeconfig_property_t * proper
214215
if (KUBECONFIG_PROPERTY_TYPE_CLUSTER == property->type) {
215216
if (0 == strcmp(key->data.scalar.value, KEY_CERTIFICATE_AUTHORITY_DATA)) {
216217
property->certificate_authority_data = strdup(value->data.scalar.value);
218+
} else if (0 == strcmp(key->data.scalar.value, KEY_CERTIFICATE_AUTHORITY)) {
219+
property->certificate_authority_data = load_file_content(value->data.scalar.value);
217220
} else if (0 == strcmp(key->data.scalar.value, KEY_SERVER)) {
218221
property->server = strdup(value->data.scalar.value);
219222
} else if (0 == strcmp(key->data.scalar.value, KEY_INSECURE_SKIP_TLS_VERIFY)) {

0 commit comments

Comments
 (0)