Skip to content

Commit 597e06e

Browse files
Add optional input k8s_manifests (#15)
<!-- Thank you for proposing a pull request! Please note that SOME TESTS WILL LIKELY FAIL due to how GitHub exposes secrets in Pull Requests from forks. Someone from the team will review your Pull Request and respond. Please describe your change and any implementation details below. --> I added optional input `k8s_manifests` to be passed to the binary `gke-deploy` subroutine `run` as parameter `-f`. It enables this GitHub Action users to use other than suggested configs within the target k8s cluster. --------- Signed-off-by: Levi <78334846+muhammad-levi@users.noreply.github.com> Co-authored-by: Seth Vargo <seth@sethvargo.com>
1 parent f4bfff9 commit 597e06e

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
project_id: 'my-project'
3939
namespace: 'my-namespace'
4040
expose: '8000'
41+
k8s_manifests: 'configs'
4142

4243
- name: 'get-deployments'
4344
shell: bash
@@ -65,3 +66,9 @@ jobs:
6566
- `expose` - (Optional) The port provided will be used to expose the deployed
6667
workload object (i.e., port and targetPort will be set to the value provided
6768
in this flag). If not provided, it will not be passed to the binary.
69+
70+
- `k8s_manifests` - (Optional) Local or GCS path to configuration file or
71+
directory of configuration files to use to create Kubernetes objects
72+
(file or files in directory must end in ".yml" or ".yaml").
73+
Prefix this value with "gs://" to indicate a GCS path.
74+
If not provided, it will not be passed to the binary.

action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ inputs:
5555
If not provided, it will not be passed to the binary.
5656
required: false
5757

58+
k8s_manifests:
59+
description: |-
60+
Local or GCS path to configuration file or directory of configuration files to use to create Kubernetes objects (file or files in directory must end in ".yml" or ".yaml").
61+
Prefix this value with "gs://" to indicate a GCS path.
62+
If not provided, it will not be passed to the binary.
63+
required: false
64+
5865
branding:
5966
icon: 'lock'
6067
color: 'blue'

entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ cluster_name="$4"
2323
project_id="$5"
2424
namespace="$6"
2525
expose_port="$7"
26+
k8s_manifests="$8"
2627

2728
gke_deploy_command="gke-deploy run -i $image -a $app_name -l $location -c $cluster_name -p $project_id"
2829

@@ -42,6 +43,11 @@ if [ -n "$expose_port" ]; then
4243
gke_deploy_command="$gke_deploy_command -x $expose_port"
4344
fi
4445

46+
# Add k8s manifests file(s) if the input is apparent.
47+
if [ -n "$k8s_manifests" ]; then
48+
gke_deploy_command="$gke_deploy_command -f $k8s_manifests"
49+
fi
50+
4551
# Utilize Google APIs user agent for metrics with the following unique identifier:
4652
export GOOGLE_APIS_USER_AGENT=google-github-action:deploy-gke/$gha_version
4753

0 commit comments

Comments
 (0)