@@ -44495,24 +44495,28 @@ function configureKubectl() {
44495
44495
const fingerprint = process.env.OCI_CLI_FINGERPRINT || '';
44496
44496
const privateKey = process.env.OCI_CLI_KEY_CONTENT || '';
44497
44497
const region = oci_common__WEBPACK_IMPORTED_MODULE_7__.Region.fromRegionId(process.env.OCI_CLI_REGION || '');
44498
+ // Inputs
44499
+ const clusterOCID = _actions_core__WEBPACK_IMPORTED_MODULE_3__.getInput('cluster', { required: true });
44500
+ const enablePrivateEndpoint = _actions_core__WEBPACK_IMPORTED_MODULE_3__.getInput('enablePrivateEndpoint').toLowerCase() === 'true';
44498
44501
const authProvider = new oci_common__WEBPACK_IMPORTED_MODULE_7__.SimpleAuthenticationDetailsProvider(tenancy, user, fingerprint, privateKey, null, region);
44499
44502
const ceClient = new oci_containerengine__WEBPACK_IMPORTED_MODULE_6__.ContainerEngineClient({
44500
44503
authenticationDetailsProvider: authProvider
44501
44504
});
44502
44505
const oke = (yield ceClient.getCluster({
44503
- clusterId: _actions_core__WEBPACK_IMPORTED_MODULE_3__.getInput('cluster', { required: true })
44506
+ clusterId: clusterOCID
44504
44507
})).cluster;
44505
44508
if (oke &&
44506
44509
oke.id &&
44507
44510
oke.kubernetesVersion &&
44508
- ((_a = oke.endpointConfig) === null || _a === void 0 ? void 0 : _a.isPublicIpEnabled)) {
44511
+ ((( _a = oke.endpointConfig) === null || _a === void 0 ? void 0 : _a.isPublicIpEnabled) || enablePrivateEndpoint )) {
44509
44512
const kubectlPath = yield getKubectl(oke.kubernetesVersion);
44510
44513
_actions_core__WEBPACK_IMPORTED_MODULE_3__.addPath(kubectlPath);
44514
+ const clusterEndpoint = oci_containerengine__WEBPACK_IMPORTED_MODULE_6__.models.CreateClusterKubeconfigContentDetails.Endpoint;
44511
44515
const kubeconfig = yield (0,oci_common__WEBPACK_IMPORTED_MODULE_7__.getStringFromResponseBody)((yield ceClient.createKubeconfig({
44512
44516
clusterId: oke.id,
44513
44517
createClusterKubeconfigContentDetails: {
44514
44518
tokenVersion: '2.0.0',
44515
- endpoint: oci_containerengine__WEBPACK_IMPORTED_MODULE_6__.models.CreateClusterKubeconfigContentDetails.Endpoint .PublicEndpoint
44519
+ endpoint: enablePrivateEndpoint ? clusterEndpoint.PrivateEndpoint : clusterEndpoint .PublicEndpoint
44516
44520
}
44517
44521
})).value);
44518
44522
const kubeconfigPath = path__WEBPACK_IMPORTED_MODULE_2__.join(os__WEBPACK_IMPORTED_MODULE_1__.homedir(), '.kube');
0 commit comments