Skip to content

Commit

Permalink
Remove helm template and update versions (#155)
Browse files Browse the repository at this point in the history
* Remove helm template and update versions

* Regenerate init-package

* Remove changing create-kpt-functions
  • Loading branch information
prachirp authored Jun 5, 2020
1 parent f3df445 commit 49fb6d9
Show file tree
Hide file tree
Showing 94 changed files with 3,128 additions and 4,304 deletions.
61 changes: 0 additions & 61 deletions tests/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ metadata:
items: []
EOF
)
CHARTS_SRC="charts/bitnami"

############################
# Test framework
Expand All @@ -41,24 +40,11 @@ function testcase() {
cd "${tmp}"
}

function helm_testcase() {
echo "testcase: ${1}"
tmp=$(mktemp -d "/tmp/e2e.${1}.XXXXXXXX")
cp -r "${REPO}"/example-configs "${tmp}"
cd "${tmp}"
git clone -q https://github.com/bitnami/charts.git
}

function fail() {
echo "FAIL: " "$@"
exit 1
}

function assert_contains_string() {
content="$(<"$1")"
grep -q "$2" "$1" || fail "String $2 not contained in: ${content}"
}

function assert_empty_list() {
content="$(<"$1")"
[[ ${content} = "${EMPTY_OUTPUT}" ]] || fail "Not empty list: ${content}"
Expand Down Expand Up @@ -176,43 +162,6 @@ assert_dir_exists payments-dev
assert_dir_exists payments-prod
grep -q allowPrivilegeEscalation podsecuritypolicy_psp.yaml

helm_testcase "docker_helm_template_expected_args"
docker run -u "$(id -u)" -v "$(pwd)/${CHARTS_SRC}":/source gcr.io/kpt-functions/helm-template:"${TAG}" -i /dev/null -d name=expected-args -d chart_path=/source/redis >out.yaml
assert_contains_string out.yaml "expected-args"

helm_testcase "docker_helm_template_extra_args"
cat >fc.yaml <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: my-config
annotations:
config.k8s.io/function: |
container:
image: gcr.io/kpt-functions/helm-template
config.kubernetes.io/local-config: "true"
data:
name: extra-args
chart_path: /source/charts/bitnami/redis
--values: /source/charts/bitnami/redis/values-production.yaml
EOF
docker run -u "$(id -u)" -v "$(pwd)":/source gcr.io/kpt-functions/helm-template:"${TAG}" -i /dev/null -f /source/fc.yaml >out.yaml
assert_contains_string out.yaml "extra-args"

helm_testcase "docker_helm_template_sink"
docker run -u "$(id -u)" -v "$(pwd)/${CHARTS_SRC}":/source gcr.io/kpt-functions/helm-template:"${TAG}" -i /dev/null -d chart_path=/source/redis -d name=sink-redis |
docker run -i -u "$(id -u)" -v "$(pwd)":/sink gcr.io/kpt-functions/write-yaml:"${TAG}" -o /dev/null -d sink_dir=/sink -d overwrite=true
assert_dir_exists default
assert_contains_string default/secret_sink-redis.yaml "sink-redis"

helm_testcase "docker_helm_template_pipeline"
docker run -u "$(id -u)" -v "$(pwd)/${CHARTS_SRC}":/source gcr.io/kpt-functions/helm-template:"${TAG}" -i /dev/null -d chart_path=/source/mongodb -d name=my-mongodb |
docker run -i -u "$(id -u)" -v "$(pwd)/${CHARTS_SRC}":/source gcr.io/kpt-functions/helm-template:"${TAG}" -d name=my-redis -d chart_path=/source/redis |
docker run -i -u "$(id -u)" -v "$(pwd)":/sink gcr.io/kpt-functions/write-yaml:"${TAG}" -o /dev/null -d sink_dir=/sink -d overwrite=true
assert_dir_exists default
assert_contains_string default/secret_my-mongodb.yaml "my-mongodb"
assert_contains_string default/secret_my-redis.yaml "my-redis"

############################
# kpt fn Tests
############################
Expand Down Expand Up @@ -277,13 +226,3 @@ EOF
kpt fn run .
grep -qR 'color: orange' .
grep -qR 'city: toronto' .

# TODO: Add kpt_helm_template_imperative_short and kpt_helm_template_declarative tests after fixing <https://github.com/GoogleContainerTools/kpt/issues/587>
helm_testcase "kpt_helm_template_imperative"
kpt fn source example-configs |
docker run -i -u "$(id -u)" -v "$(pwd)/${CHARTS_SRC}":/source gcr.io/kpt-functions/helm-template:"${TAG}" -d chart_path=/source/mongodb -d name=my-mongodb |
docker run -i -u "$(id -u)" -v "$(pwd)/${CHARTS_SRC}":/source gcr.io/kpt-functions/helm-template:"${TAG}" -d name=my-redis -d chart_path=/source/redis |
kpt fn sink example-configs
assert_dir_exists example-configs/default
assert_contains_string example-configs/default/secret_my-mongodb.yaml "my-mongodb"
assert_contains_string example-configs/default/secret_my-redis.yaml "my-redis"
6 changes: 3 additions & 3 deletions ts/demo-functions/build/expand_team_cr.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine as builder
FROM node:lts-alpine as builder

RUN mkdir -p /home/node/app && \
chown -R node:node /home/node/app
Expand All @@ -9,7 +9,7 @@ WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
RUN npm ci
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
Expand All @@ -20,7 +20,7 @@ RUN npm run build && \

#############################################

FROM node:10-alpine
FROM node:lts-alpine

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
Expand Down
51 changes: 0 additions & 51 deletions ts/demo-functions/build/helm_template.Dockerfile

This file was deleted.

6 changes: 3 additions & 3 deletions ts/demo-functions/build/label_namespace.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine as builder
FROM node:lts-alpine as builder

RUN mkdir -p /home/node/app && \
chown -R node:node /home/node/app
Expand All @@ -9,7 +9,7 @@ WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
RUN npm ci
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
Expand All @@ -20,7 +20,7 @@ RUN npm run build && \

#############################################

FROM node:10-alpine
FROM node:lts-alpine

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
Expand Down
6 changes: 3 additions & 3 deletions ts/demo-functions/build/mutate_psp.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine as builder
FROM node:lts-alpine as builder

RUN mkdir -p /home/node/app && \
chown -R node:node /home/node/app
Expand All @@ -9,7 +9,7 @@ WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
RUN npm ci
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
Expand All @@ -20,7 +20,7 @@ RUN npm run build && \

#############################################

FROM node:10-alpine
FROM node:lts-alpine

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
Expand Down
6 changes: 3 additions & 3 deletions ts/demo-functions/build/no_op.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine as builder
FROM node:lts-alpine as builder

RUN mkdir -p /home/node/app && \
chown -R node:node /home/node/app
Expand All @@ -9,7 +9,7 @@ WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
RUN npm ci
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
Expand All @@ -20,7 +20,7 @@ RUN npm run build && \

#############################################

FROM node:10-alpine
FROM node:lts-alpine

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
Expand Down
6 changes: 3 additions & 3 deletions ts/demo-functions/build/read_yaml.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine as builder
FROM node:lts-alpine as builder

RUN mkdir -p /home/node/app && \
chown -R node:node /home/node/app
Expand All @@ -9,7 +9,7 @@ WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
RUN npm ci
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
Expand All @@ -20,7 +20,7 @@ RUN npm run build && \

#############################################

FROM node:10-alpine
FROM node:lts-alpine

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
Expand Down
6 changes: 3 additions & 3 deletions ts/demo-functions/build/suggest_psp.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine as builder
FROM node:lts-alpine as builder

RUN mkdir -p /home/node/app && \
chown -R node:node /home/node/app
Expand All @@ -9,7 +9,7 @@ WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
RUN npm ci
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
Expand All @@ -20,7 +20,7 @@ RUN npm run build && \

#############################################

FROM node:10-alpine
FROM node:lts-alpine

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
Expand Down
6 changes: 3 additions & 3 deletions ts/demo-functions/build/validate_rolebinding.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine as builder
FROM node:lts-alpine as builder

RUN mkdir -p /home/node/app && \
chown -R node:node /home/node/app
Expand All @@ -9,7 +9,7 @@ WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
RUN npm ci
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
Expand All @@ -20,7 +20,7 @@ RUN npm run build && \

#############################################

FROM node:10-alpine
FROM node:lts-alpine

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
Expand Down
6 changes: 3 additions & 3 deletions ts/demo-functions/build/write_yaml.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10-alpine as builder
FROM node:lts-alpine as builder

RUN mkdir -p /home/node/app && \
chown -R node:node /home/node/app
Expand All @@ -9,7 +9,7 @@ WORKDIR /home/node/app

# Install dependencies and cache them.
COPY --chown=node:node package*.json ./
RUN npm ci
RUN npm ci --ignore-scripts

# Build the source.
COPY --chown=node:node tsconfig.json .
Expand All @@ -20,7 +20,7 @@ RUN npm run build && \

#############################################

FROM node:10-alpine
FROM node:lts-alpine

# Run as non-root user as a best-practices:
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
Expand Down
Loading

0 comments on commit 49fb6d9

Please sign in to comment.