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

Commit

Permalink
Merge branch 'master' into viccuad/add-yaml-linting
Browse files Browse the repository at this point in the history
  • Loading branch information
viccuad authored Nov 19, 2019
2 parents b28a520 + 2c4a04c commit be694cc
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 15 deletions.
4 changes: 2 additions & 2 deletions def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ project = struct(
),
cf_operator = struct(
chart = struct(
url = "https://cf-operators.s3.amazonaws.com/helm-charts/cf-operator-v0.4.2-146.ge5d49c17.tgz",
sha256 = "676e7e1c2dd589598c04f3960266daf7c11c62d3af9fbf621aeb06707b25e1bf",
url = "https://s3.amazonaws.com/cf-operators/helm-charts/cf-operator-v0.4.2-147.gb88e4296.tgz",
sha256 = "7cc0c23df3aa5fb7f2075e3dbd77d2dc51c1ee283060ae9cb46ed680b1deb1d0",
),
namespace = "cfo",
),
Expand Down
16 changes: 15 additions & 1 deletion deploy/helm/kubecf/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,23 @@ package(default_visibility = ["//visibility:public"])

load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
load("//rules/helm:def.bzl", helm_package = "package")
load("//:def.bzl", "project")
load("//deploy/helm/kubecf:defs.bzl", "metadata_file_generator")

metadata_file_generator(
name = "metadata",
file = "Metadata.yaml",
operator_chart = project.cf_operator.chart.url
)

filegroup(
name = "chart_files_static",
srcs = glob(
["**/*"],
exclude = ["**/BUILD.bazel"],
exclude = [
"**/BUILD.bazel",
"**/defs.bzl",
],
),
)

Expand All @@ -24,6 +35,9 @@ helm_package(
srcs = [
":chart_files_static",
],
generated = [
":metadata",
],
tars = [
":cf_deployment",
"//bosh/releases:pre_render_scripts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,14 @@
value: local

# Attach a persistent disk to bits-service VM to store eirinifs
# TODO: storage class type should be configurable
# - type: replace
# path: /instance_groups/name=bits/persistent_disk_type?
# value: ???
- type: replace
path: /instance_groups/name=bits/persistent_disk?
value: 20480 # 20GB
{{- if .Values.kube.storage_class }}
- type: replace
path: /instance_groups/name=bits/persistent_disk_type?
value: {{ .Values.kube.storage_class }}
{{- end }}

- type: replace
path: /instance_groups/name=api/jobs/name=cloud_controller_ng/properties/cc/bits_service?/enabled?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,17 @@
sha1: ~

# Configure the persistent disk in the way that cf-operator can provision.
- type: remove
path: /instance_groups/name=database/persistent_disk_type
- type: replace
path: /instance_groups/name=database/persistent_disk?
value: 20480 # 20GB
{{- if .Values.kube.storage_class }}
- type: replace
path: /instance_groups/name=database/persistent_disk_type
value: {{ .Values.kube.storage_class }}
{{- else }}
- type: remove
path: /instance_groups/name=database/persistent_disk_type
{{- end }}

# Replace the jobs using the cf-mysql-release.
- type: replace
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Configure the persistent disk in the way that cf-operator can provision.
- type: remove
path: /instance_groups/name=singleton-blobstore/persistent_disk_type
- type: replace
path: /instance_groups/name=singleton-blobstore/persistent_disk?
value: 102400 # 100GB
{{- if .Values.kube.storage_class }}
- type: replace
path: /instance_groups/name=singleton-blobstore/persistent_disk_type
value: {{ .Values.kube.storage_class }}
{{- else }}
- type: remove
path: /instance_groups/name=singleton-blobstore/persistent_disk_type
{{- end }}

- type: replace
path: /instance_groups/name=singleton-blobstore/jobs/name=blobstore/properties/blobstore/internal_access_rules?
Expand Down
8 changes: 8 additions & 0 deletions deploy/helm/kubecf/defs.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
def metadata_file_generator(name, file, operator_chart, visibility=None):
native.genrule(
name = name,
srcs = [],
outs = [file],
cmd = "echo 'operatorChartUrl: \"{}\"' > $@".format(operator_chart),
visibility = visibility,
)
2 changes: 1 addition & 1 deletion deploy/helm/kubecf/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ metadata:
data:
tls.crt: {{ .Values.features.ingress.tls.crt | b64enc | quote }}
tls.key: {{ .Values.features.ingress.tls.key | b64enc | quote }}
{{- end -}}
{{- end }}
---
# This ingress specifies routing and access for the cloud controller public Kubecf service, e.g.
# "api.<domain>" and other services in that domain hierarchy.
Expand Down
5 changes: 5 additions & 0 deletions deploy/helm/kubecf/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ deployment_name: kubecf
# addr: kubecf-log-api:8082
properties: {}

# The the storage class to be used for the instance groups that need it (e.g. bits, database and singleton-blobstore)
# If it's not set, the default storage class will be used.
kube:
storage_class: ~

releases:
# The defaults for all releases, where we do not otherwise override them.
defaults:
Expand Down
5 changes: 4 additions & 1 deletion rules/helm/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def _package_impl(ctx):
output_tgz = ctx.actions.declare_file(output_filename)
outputs = [output_tgz]
ctx.actions.run(
inputs = [] + ctx.files.srcs + ctx.files.tars,
inputs = [] + ctx.files.srcs + ctx.files.tars + ctx.files.generated,
outputs = outputs,
tools = [ctx.executable._helm],
progress_message = "Generating Helm package archive {}".format(output_filename),
Expand All @@ -12,6 +12,8 @@ def _package_impl(ctx):
"PACKAGE_DIR": ctx.attr.package_dir,
# TODO(f0rmiga): Figure out a way of working with paths that contain spaces.
"TARS": " ".join([f.path for f in ctx.files.tars]),
# TODO(mudler): Support also nested folders and paths with spaces
"GENERATED": " ".join([f.path for f in ctx.files.generated]),
"HELM": ctx.executable._helm.path,
"CHART_VERSION": ctx.attr.chart_version,
"APP_VERSION": ctx.attr.app_version,
Expand All @@ -27,6 +29,7 @@ _package = rule(
"srcs": attr.label_list(
mandatory = True,
),
"generated": attr.label_list(),
"tars": attr.label_list(),
"package_dir": attr.string(
mandatory = True,
Expand Down
9 changes: 8 additions & 1 deletion rules/helm/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@ set -o errexit -o nounset

build_dir="tmp/build/${PACKAGE_DIR}"
mkdir -p "${build_dir}"

cp -L -R "${PACKAGE_DIR}"/* "${build_dir}"

# Generated files ( here TARS, GENERATED ) are not part of the source code
# to be able to use them, we have to copy them
for t in ${TARS}; do
tar xf "${t}" -C "${build_dir}"
tar xf "${t}" -C "${build_dir}" > /dev/null
done

for g in ${GENERATED}; do
cp "${g}" "${build_dir}"/ > /dev/null
done

"${HELM}" init --client-only > /dev/null
Expand Down

0 comments on commit be694cc

Please sign in to comment.