Skip to content
This repository has been archived by the owner on Jan 9, 2021. It is now read-only.

Deploys project on GKE 1.15.7 #27

Merged
merged 1 commit into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Changed
- Upgraded the Google Marketplace Tools container image used by the Deployer from 0.7.0 to 0.10.0. The newer version of these tools provide an adaptive Kubectl client version (tools read the Kubernetes server version, then select a matching kubectl binary).
- Upgraded the Google Marketplace Tools submodule to 0.10.0.
- Upgraded the version of Helm used by the deployer from 2.6.1 to 2.16.1 to eliminate this Helm bug: https://github.com/helm/helm/issues/2998
- Deleted x-google-marketplace section for tester.image in schema.yaml to be consistent for Google Marketplace Tools v0.10.0
- Added a build.sh flag (`-p` or `--persist`) to persist the application deployment after testing.
- Fixed the deployment's `deploy-info` annotations to use keys that are valid JSON keys (i.e. with quotes).

## [1.3.4](https://github.com/cyberark/conjur-google-cloud-launcher/releases/tag/v1.3.4) - 2019-01-08
### Changed
Expand Down
28 changes: 23 additions & 5 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,30 @@

The project URL is: https://console.cloud.google.com/home/dashboard?organizationId=854380395992&project=conjur-cloud-launcher-onboard

Before proceeding, make sure that:
* You are authorized to access to the `conjur-cloud-launcher-onboard` GCP project.
* Your current GCP project is set to `conjur-cloud-launcher-onboard`:
```
gcloud config set project conjur-cloud-launcher-onboard
```
* Your current GCP cluster is set to the desired cluster in the `conjur-cloud-launcher-onboard` project:
```
gcloud container cluster list
gcloud container clusters get-credentials <CLUSTER NAME>
```

## Cluster Setup

0. Run the following command to create the Application CRD: `$ make crd/install`.

1. Create the namespace from `setenv.sh`: `kubectl create ns "$(whoami)"`
1. Create the namespace from `setenv.sh`, and set to that namespace:
```
export NAMESPACE="$(whoami)"
kubectl create ns "$NAMESPACE"
kubectl config set-context --current --namespace="$NAMESPACE"
```

2. Run the following to create the app: `$ make app/install`.
2. Run the following to create the app: `$ make app/install-test`.

3. Run the following to watch the app: `$ make app/watch`.

Expand All @@ -48,6 +65,7 @@ This is done automatically by Jenkins in the build pipeline.

## Testing

`./build.sh` will automatically test the application with the configured kubectl context.
It will launch the application in a custom namespace, test it, and then delete the namespace.
This step is also automatically done by the build pipeline.
The `build.sh` script can be run a couple of ways:

* `./build.sh` will automatically test the application with the configured kubectl context. It will launch the application in a custom namespace, test it, and then delete the namespace. This step is also automatically done by the build pipeline.
* `./build.sh -p` (or `./build.sh --persist`) will automatically test the application with the configured kubectl context. It will launch the application in a custom namespace, test it, and leave the application running.
4 changes: 4 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ pipeline {
buildDiscarder(logRotator(numToKeepStr: '30'))
}

triggers {
cron(getDailyCronString())
}

environment {
REGISTRY = 'gcr.io/conjur-cloud-launcher-onboard'
}
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ app/build:: .build/conjur/deployer \
.build/var/REGISTRY \
.build/var/TAG \
| .build/conjur
# Note: print_target displays a highlighted (in yellow) message
# indicating the target that is being built.
$(call print_target, $@)
docker build \
--build-arg REGISTRY="$(REGISTRY)" \
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export NAMESPACE=conjur
Configure the container images:

```shell
export TAG_VERSION=1.3.4
export TAG_VERSION=1.4.0
export IMAGE_CONJUR="gcr.io/cloud-marketplace/cyberark/conjur-open-source:$TAG_VERSION"
export IMAGE_POSTGRES="gcr.io/cloud-marketplace/cyberark/conjur-open-source/postgres:$TAG_VERSION"
export IMAGE_NGINX="gcr.io/cloud-marketplace/cyberark/conjur-open-source/nginx:$TAG_VERSION"
Expand All @@ -112,22 +112,21 @@ for i in "IMAGE_CONJUR" "IMAGE_POSTGRES" "IMAGE_NGINX"; do
done
```

The Conjur data key is generated by the
deployer and does not need to be created
beforehand.

#### Create namespace in your Kubernetes cluster

We recommend running Conjur in its own namespace.
If you use a different namespace than the `default`, run the command below to create a new namespace:

```shell
kubectl create namespace "$NAMESPACE"
kubectl config set-context --current --namespace="$NAMESPACE"
```

#### Install the application with Helm to your Kubernetes cluster
#### Install the application with Helm (v2) to your Kubernetes cluster

These instructions assume that your local `helm` client is version 2.

This project uses the upstream [cyberark/conjur-oss Helm chart](https://github.com/cyberark/conjur-oss-helm-chart).
This project uses the upstream [cyberark/conjur-oss Helm chart](https://github.com/cyberark/conjur-oss-helm-chart). (You do not need to clone or helm install this repo directly; this will be done indirectly via the helm install of conjur below.)

Use `helm` to deploy the application to your Kubernetes cluster:
diverdane marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -138,7 +137,8 @@ See [conjur-oss/values.yaml](https://github.com/cyberark/conjur-oss-helm-chart/b
for all available upstream Helm chart parameters and their defaults.

```shell
helm install ./conjur
helm dependency update ./conjur
helm install conjur --set conjur-oss.dataKey="$(docker run --rm cyberark/conjur data-key generate)" ./conjur
```

#### View the app in the Google Cloud Console
Expand Down Expand Up @@ -264,11 +264,12 @@ Delete the application release using Helm:
```sh-session
# Find the release
$ helm list | grep conjur
reeling-greyhound 1 Fri Jul 20 16:36:03 2018 DEPLOYED conjur-1.0.0

conjur conjur 1 2020-03-09 15:36:14.293351857 -0400 EDT deployed conjur-1.3.7

# Delete the release
$ helm delete reeling-greyhound
release "reeling-greyhound" deleted
$ helm delete conjur
release "conjur" uninstalled
```

## License
Expand Down
3 changes: 3 additions & 0 deletions app.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ endef
.PHONY: .build/app/dev
.build/app/dev: .build/var/MARKETPLACE_TOOLS_TAG \
| .build/app
# Note: print_target displays a highlighted (in yellow) message
# indicating the target that is being built.
$(call print_target, $@)
sgnn7 marked this conversation as resolved.
Show resolved Hide resolved
docker run \
"gcr.io/cloud-marketplace-tools/k8s/dev:$(MARKETPLACE_TOOLS_TAG)" \
cat /scripts/dev > "$@"
Expand Down
2 changes: 0 additions & 2 deletions apptest/deployer/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ properties:
tester.image:
type: string
default: $REGISTRY/tester:$TAG
x-google-marketplace:
type: IMAGE

conjur-oss.ssl.hostname:
type: string
Expand Down
8 changes: 6 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ make crd/install
gcloud auth configure-docker

chart_dir=""
build_target="app/verify"

while [ "$1" != "" ]; do
case $1 in
-c | --chart-dir ) shift
chart_dir="${1}"
;;
# Use the -p | --persist flag to keep the application running
-p | --persist ) build_target="app/install-test"
;;
* ) >&2 echo "Unknown argument: ${1}"
exit 1
;;
Expand All @@ -39,13 +43,13 @@ if [ "${chart_dir}" != "" ]; then
fi

echo "Getting the desired marketplace Docker image..."
MARKETPLACE_TOOLS_TAG="0.7.0"
MARKETPLACE_TOOLS_TAG="0.10.0"
LOCAL_MARKETPLACE_TOOLS_TAG="local-$USER"
docker pull "gcr.io/cloud-marketplace-tools/k8s/dev:$MARKETPLACE_TOOLS_TAG"
docker tag "gcr.io/cloud-marketplace-tools/k8s/dev:$MARKETPLACE_TOOLS_TAG" \
"gcr.io/cloud-marketplace-tools/k8s/dev:$LOCAL_MARKETPLACE_TOOLS_TAG"

echo "Building/verifying app..."
make -j4 -e app/verify
make -j4 -e "$build_target"

echo "Done!"
2 changes: 1 addition & 1 deletion conjur/templates/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
annotations:
kubernetes-engine.cloud.google.com/icon: >-
data:image/png;base64,iVBORw0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D6zXUXTv1egtW9xFC2UgX+g9MCFkh3L5j9MQ4A1ijRfhXFdfYNmhYnviBN+wGDfJO20a7xMAu0jD0S4Ve0quIlX2ge1noAv9hUfiw0Li4kV/ULtoiBlD8KiTAWDXT7IHV4zOYPWQ7/Qcj66L7HRUl+5j4Om2nE72JjF5NFrdDjyMHvQTdmwXfzULanuGgDYiSHct0cQ+hPLL51hU2bJuQAmL1ysMCZ1U9obbTNjHAUPMKRD7TVH6emENvBNRUTcqNSMCNX6bbxRsGv0nDGMOq1doF5VC+pYYuLyCdhwlY7gExC5QVhQp/s++smn1eSSzu3zLaHhBrsuRODYajs8L+bEGKKWEfIgxnF6DNPdUtA+esoJduJ2SFL7LhailTnCXS8GWGpDLlDTKrVmFgrSr85mSJIhg9lctSgUpimtfRSto+N0FvPNT+OISTsxD6PEw8VaX96f9RyNgSJ7c0kzD9gkkoO5sj4U1AqVKOQO1mAsqrHDtYbiCqM2eiN1dilAaQhE+00ZxWO8BQ+SaR1nHQy+twBCgGhIPBLQgHxYBwUAwIB8WAcFAMCAfFgHBQDAgHxYBwUAwIB8WAcFAMCAfFgHBQDMgrCCH/B72jI0AbGfj3AAAAAElFTkSuQmCC
marketplace.cloud.google.com/deploy-info: '{partner_id: "cyberark", product_id: "conjur-open-source", partner_name: "CyberArk"}'
marketplace.cloud.google.com/deploy-info: '{"partner_id": "cyberark", "product_id": "conjur-open-source", "partner_name": "CyberArk"}'
labels:
app.kubernetes.io/name: "{{ .Release.Name }}"
spec:
Expand Down
4 changes: 3 additions & 1 deletion crd.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ include common.Makefile
# Installs the application CRD on the cluster.
.PHONY: crd/install
crd/install:
kubectl apply -f "https://raw.githubusercontent.com/GoogleCloudPlatform/marketplace-k8s-app-tools/master/crd/app-crd.yaml"
# Ignore errors on kubectl apply. `AlreadyExists` Errors can occur if
# another parallel test is doing a kubectl apply at the same time.
-kubectl apply -f "https://raw.githubusercontent.com/GoogleCloudPlatform/marketplace-k8s-app-tools/master/crd/app-crd.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is a risky move but maybe it will be fine. I'll leave it as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I did not like adding this, but the first time I ran the 2 test cases in parallel, I saw an AlreadyExists error in one test. I didn't expect to see this sort of error when kubectl apply ... is being used, but there's apparently a race condition where the 2 instances of kubectl apply ... realize that a create is needed, and they both try the create at the same time. It's too bad there's no --ignore-already-created flag or similar to whatever the flag is for kubectl create ....



# Uninstalls the application CRD from the cluster.
Expand Down
4 changes: 2 additions & 2 deletions deployer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN echo "cachebuster-20190118" >/dev/null \
&& apt-get update \
&& apt-get install -y --no-install-recommends gettext curl

RUN curl -L -o /tmp/helm.tgz https://storage.googleapis.com/kubernetes-helm/helm-v2.6.1-linux-amd64.tar.gz && \
RUN curl -L -o /tmp/helm.tgz https://storage.googleapis.com/kubernetes-helm/helm-v2.16.1-linux-amd64.tar.gz && \
cd /tmp && \
tar xvzf helm.tgz && \
cp linux-amd64/helm /usr/local/bin/helm && \
Expand Down Expand Up @@ -43,7 +43,7 @@ RUN cat /tmp/test/schema.yaml \
&& mv /tmp/test/schema.yaml.new /tmp/test/schema.yaml


FROM gcr.io/cloud-marketplace-tools/k8s/deployer_helm:0.7.0
FROM gcr.io/cloud-marketplace-tools/k8s/deployer_helm:0.10.0
COPY --from=build /tmp/conjur.tar.gz /data/chart/
COPY --from=build /tmp/test/conjur.tar.gz /data-test/chart/
COPY --from=build /tmp/schema.yaml /data/
Expand Down