-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #538 from mengqiy/starlark/v0.2
Merge master into starlark/v0.2
- Loading branch information
Showing
107 changed files
with
7,449 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
echo "Updating docs..." | ||
make generate; | ||
diff=`git diff` | ||
|
||
if [[ $diff != "" ]]; | ||
then | ||
echo "Found unstaged changes [$diff]. Make sure to run `make generate` for updating the docs before you commit the changes." | ||
exit 1 | ||
else | ||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2021 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: Check Documentation Synchronized | ||
on: | ||
pull_request: | ||
push: | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: | | ||
./.github/hooks/pre-commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
* @frankfarzan @mengqiy @droot | ||
*.md @droot @frankfarzan | ||
* @frankfarzan @mengqiy @droot @phanimarupaka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
diff --git a/deployment_test-helloworld-chart.yaml b/deployment_test-helloworld-chart.yaml | ||
new file mode 100644 | ||
index 0000000..8ba7f5c | ||
--- /dev/null | ||
+++ b/deployment_test-helloworld-chart.yaml | ||
@@ -0,0 +1,43 @@ | ||
+# Source: helloworld-chart/templates/deployment.yaml | ||
+apiVersion: apps/v1 | ||
+kind: Deployment | ||
+metadata: | ||
+ name: test-helloworld-chart | ||
+ labels: | ||
+ helm.sh/chart: helloworld-chart-0.1.0 | ||
+ app.kubernetes.io/name: helloworld-chart | ||
+ app.kubernetes.io/instance: test | ||
+ app.kubernetes.io/version: "1.16.0" | ||
+ app.kubernetes.io/managed-by: Helm | ||
+spec: | ||
+ replicas: 5 | ||
+ selector: | ||
+ matchLabels: | ||
+ app.kubernetes.io/name: helloworld-chart | ||
+ app.kubernetes.io/instance: test | ||
+ template: | ||
+ metadata: | ||
+ labels: | ||
+ app.kubernetes.io/name: helloworld-chart | ||
+ app.kubernetes.io/instance: test | ||
+ spec: | ||
+ serviceAccountName: test-helloworld-chart | ||
+ securityContext: {} | ||
+ containers: | ||
+ - name: helloworld-chart | ||
+ securityContext: {} | ||
+ image: "nginx:1.16.0" | ||
+ imagePullPolicy: Always | ||
+ ports: | ||
+ - name: http | ||
+ containerPort: 80 | ||
+ protocol: TCP | ||
+ livenessProbe: | ||
+ httpGet: | ||
+ path: / | ||
+ port: http | ||
+ readinessProbe: | ||
+ httpGet: | ||
+ path: / | ||
+ port: http | ||
+ resources: {} | ||
diff --git a/pod_test-helloworld-chart-test-connection.yaml b/pod_test-helloworld-chart-test-connection.yaml | ||
new file mode 100644 | ||
index 0000000..8793304 | ||
--- /dev/null | ||
+++ b/pod_test-helloworld-chart-test-connection.yaml | ||
@@ -0,0 +1,20 @@ | ||
+# Source: helloworld-chart/templates/tests/test-connection.yaml | ||
+apiVersion: v1 | ||
+kind: Pod | ||
+metadata: | ||
+ name: "test-helloworld-chart-test-connection" | ||
+ labels: | ||
+ helm.sh/chart: helloworld-chart-0.1.0 | ||
+ app.kubernetes.io/name: helloworld-chart | ||
+ app.kubernetes.io/instance: test | ||
+ app.kubernetes.io/version: "1.16.0" | ||
+ app.kubernetes.io/managed-by: Helm | ||
+ annotations: | ||
+ "helm.sh/hook": test-success | ||
+spec: | ||
+ containers: | ||
+ - name: wget | ||
+ image: busybox | ||
+ command: ['wget'] | ||
+ args: ['test-helloworld-chart:80'] | ||
+ restartPolicy: Never | ||
diff --git a/service_test-helloworld-chart.yaml b/service_test-helloworld-chart.yaml | ||
new file mode 100644 | ||
index 0000000..7d734d3 | ||
--- /dev/null | ||
+++ b/service_test-helloworld-chart.yaml | ||
@@ -0,0 +1,21 @@ | ||
+# Source: helloworld-chart/templates/service.yaml | ||
+apiVersion: v1 | ||
+kind: Service | ||
+metadata: | ||
+ name: test-helloworld-chart | ||
+ labels: | ||
+ helm.sh/chart: helloworld-chart-0.1.0 | ||
+ app.kubernetes.io/name: helloworld-chart | ||
+ app.kubernetes.io/instance: test | ||
+ app.kubernetes.io/version: "1.16.0" | ||
+ app.kubernetes.io/managed-by: Helm | ||
+spec: | ||
+ type: ClusterIP | ||
+ ports: | ||
+ - port: 80 | ||
+ targetPort: http | ||
+ protocol: TCP | ||
+ name: http | ||
+ selector: | ||
+ app.kubernetes.io/name: helloworld-chart | ||
+ app.kubernetes.io/instance: test | ||
diff --git a/serviceaccount_test-helloworld-chart.yaml b/serviceaccount_test-helloworld-chart.yaml | ||
new file mode 100644 | ||
index 0000000..5800f2a | ||
--- /dev/null | ||
+++ b/serviceaccount_test-helloworld-chart.yaml | ||
@@ -0,0 +1,11 @@ | ||
+# Source: helloworld-chart/templates/serviceaccount.yaml | ||
+apiVersion: v1 | ||
+kind: ServiceAccount | ||
+metadata: | ||
+ name: test-helloworld-chart | ||
+ labels: | ||
+ helm.sh/chart: helloworld-chart-0.1.0 | ||
+ app.kubernetes.io/name: helloworld-chart | ||
+ app.kubernetes.io/instance: test | ||
+ app.kubernetes.io/version: "1.16.0" | ||
+ app.kubernetes.io/managed-by: Helm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
kpt fn eval --image-pull-policy ifNotPresent --image gcr.io/kpt-fn/inflate-helm-chart:unstable \ | ||
--mount type=bind,src="$(pwd)",dst=/tmp/charts -- \ | ||
name=helloworld-chart \ | ||
releaseName=test \ | ||
valuesFile=/tmp/charts/helloworld-values/values.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.expected | ||
helloworld-chart | ||
helloworld-values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# inflate-helm-chart: Local Chart | ||
|
||
### Overview | ||
|
||
This example demonstrated how to imperatively invoke the `inflate-helm-chart` | ||
function to inflate a helm chart that lives in your local filesystem. | ||
|
||
### Function invocation | ||
|
||
Run the following command to fetch the example package: | ||
|
||
```shell | ||
$ kpt pkg get https://github.com/GoogleContainerTools/kpt-functions-catalog.git/examples/inflate-helm-chart-local | ||
``` | ||
|
||
```shell | ||
$ cd inflate-helm-chart-local | ||
``` | ||
|
||
Run the following commands to inflate the helm chart in your local | ||
filesystem. | ||
|
||
```shell | ||
$ kpt fn eval --image gcr.io/kpt-fn/inflate-helm-chart:unstable \ | ||
--mount type=bind,src=$(pwd),dst=/tmp/charts \ | ||
-- name=helloworld-chart \ | ||
releaseName=test | ||
``` | ||
|
||
You can optionally provide your own values files using `--valuesFile`. | ||
|
||
```shell | ||
$ kpt fn eval --image gcr.io/kpt-fn/inflate-helm-chart:unstable \ | ||
--mount type=bind,src=$(pwd),dst=/tmp/charts -- \ | ||
name=helloworld-chart \ | ||
releaseName=test \ | ||
valuesFile=tmp/charts/helloworld-values/values.yaml | ||
``` | ||
|
||
### Expected result | ||
|
||
You can run the following command to see the new files you have: | ||
|
||
```shell | ||
$ kpt pkg tree | ||
├── [deployment_test-helloworld-chart.yaml] Deployment test-helloworld-chart | ||
├── [pod_test-helloworld-chart-test-connection.yaml] Pod test-helloworld-chart-test-connection | ||
├── [service_test-helloworld-chart.yaml] Service test-helloworld-chart | ||
└── [serviceaccount_test-helloworld-chart.yaml] ServiceAccount test-helloworld-chart | ||
``` | ||
|
||
You should be able to find `replicas: 5` in | ||
file `deployment_test-helloworld-chart.yaml`, which demonstrates that | ||
the correct values file provided by --valuesFile was used. |
21 changes: 21 additions & 0 deletions
21
examples/inflate-helm-chart-local/helloworld-chart/Chart.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: v2 | ||
name: helloworld-chart | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. | ||
appVersion: 1.16.0 |
21 changes: 21 additions & 0 deletions
21
examples/inflate-helm-chart-local/helloworld-chart/templates/NOTES.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} | ||
{{- end }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "helloworld-chart.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "helloworld-chart.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "helloworld-chart.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "helloworld-chart.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:80 | ||
{{- end }} |
Oops, something went wrong.