Skip to content

Commit

Permalink
upgrade to kce v0.6.0
Browse files Browse the repository at this point in the history
Signed-off-by: Anastas Dancha <[email protected]>
  • Loading branch information
anapsix committed Jan 19, 2021
1 parent 80d43c9 commit a7d1cc1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ COPY k8s-vault_example.yaml .
COPY k8s-vault-completion.bash .
COPY ./src ./src
RUN \
shards install && \
shards install --production && \
crystal build --progress --release --static src/cli.cr -o /tmp/k8s-vault && \
upx /tmp/k8s-vault && \
echo >&2 "## Version check: $(/tmp/k8s-vault -v)" && \
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.2.1
5 changes: 3 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: k8s-vault
version: 0.2.0
version: 0.2.1

description: |
`k8s-vault` makes it easy to reach K8s API via jumphost, using SSH port forwarding.
dependencies:
kce:
# path: ../kce.cr
github: anapsix/kce.cr
version: ~> 0.5.0
version: ~> 0.6.0

authors:
- Anastas Dancha <[email protected]>
Expand Down
10 changes: 5 additions & 5 deletions src/k8s-vault.cr
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ module K8sVault
end
ssh_jump_host = context_config.ssh_jump_host

kubeconfig = KCE.config_obj(target_context: kubecontext, kubeconfig: kubeconfig_path)
cluster_server = kubeconfig["clusters"].first.cluster["server"].to_s
kubeconfig = KCE.config(kubecontext: kubecontext, kubeconfig: kubeconfig_path)
cluster_server = kubeconfig.clusters.first.cluster.server.to_s
remote_proto = cluster_server.split(/https?:\/\//).first?.to_s
remote_proto = remote_proto.empty? ? "https" : remote_proto
remote_host, remote_port = cluster_server.split(/https?:\/\//).last.split(":")
Expand All @@ -45,9 +45,9 @@ module K8sVault
end

# update config with values for SSH forwarding
kubeconfig["clusters"].first.cluster.delete("certificate-authority-data")
kubeconfig["clusters"].first.cluster["insecure-skip-tls-verify"] = true
kubeconfig["clusters"].first.cluster["server"] = "#{remote_proto}://127.0.0.1:#{local_port}"
kubeconfig.clusters.first.cluster.certificate_authority_data = nil
kubeconfig.clusters.first.cluster.insecure_skip_tls_verify = true
kubeconfig.clusters.first.cluster.server = "#{remote_proto}://127.0.0.1:#{local_port}"

Config.new(
config_path: config_path.to_s,
Expand Down

0 comments on commit a7d1cc1

Please sign in to comment.