Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Cleaning up the setup instructions for Kubernetes 1.7 #1005

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ contrib/build/*/tmp/*
.pkg
.kube
.var
charts/catalog/apiserver-key.pem
charts/catalog/apiserver.csr
charts/catalog/apiserver.pem
Copy link
Contributor

Choose a reason for hiding this comment

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

can we put these in a subdir to isolate them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure, I know this works at the top level chart directory though, and I'd rather make progress this way for now

charts/catalog/ca-key.pem
charts/catalog/ca.csr
charts/catalog/ca.pem
charts/catalog/server-ca-config.json
charts/catalog/svc-cat-ca.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh --
#!/bin/bash

# Copyright 2017 The Kubernetes Authors.
#
Expand All @@ -14,6 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit

CUR=$(pwd)
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Entering $DIR"
cd $DIR

export HELM_NAME=catalog
export SVCCAT_NAMESPACE=catalog
export SVCCAT_SERVICE_NAME=${HELM_NAME}-${SVCCAT_NAMESPACE}-apiserver
Expand Down Expand Up @@ -44,7 +51,7 @@ EOF


cfssl genkey --initca ${SVCCAT_CA_SETUP} | cfssljson -bare ${CA_NAME}
# now the files 'ca.csr ca-key.pem ca.pem' exist
# now the files 'ca.csr, ca-key.pem, and ca.pem' exist

export SVCCAT_CA_CERT=${CA_NAME}.pem
export SVCCAT_CA_KEY=${CA_NAME}-key.pem
Expand Down
2 changes: 1 addition & 1 deletion charts/catalog/templates/apiregistration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
service:
namespace: {{ .Release.Namespace }}
name: {{ template "fullname" . }}-apiserver
caBundle: {{ .Values.apiserver.tls.ca }}
caBundle: {{ (.Files.Get .Values.apiserver.tls.caFileName) | b64enc }}
{{ if .Capabilities.APIVersions.Has "apiregistration.k8s.io/v1alpha1" -}}
priority: {{ .Values.apiserver.aggregator.priority }}
{{ else if .Capabilities.APIVersions.Has "apiregistration.k8s.io/v1beta1" -}}
Expand Down
4 changes: 2 additions & 2 deletions charts/catalog/templates/apiserver-cert-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ metadata:
heritage: "{{ .Release.Service }}"
type: Opaque
data:
tls.crt: {{ .Values.apiserver.tls.cert }}
tls.key: {{ .Values.apiserver.tls.key }}
tls.crt: {{ (.Files.Get .Values.apiserver.tls.certFileName) | b64enc }}
tls.key: {{ (.Files.Get .Values.apiserver.tls.keyFileName) | b64enc }}
Copy link
Contributor

Choose a reason for hiding this comment

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

is b64enc a helm thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it uses sprig for template functions. relevant docs: https://masterminds.github.io/sprig/encoding.html

{{- if .Values.apiserver.tls.requestHeaderCA }}
requestheader-ca.crt: {{ .Values.apiserver.tls.requestHeaderCA }}
{{- end }}
2 changes: 2 additions & 0 deletions charts/catalog/templates/apiserver-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ spec:
- "{{ .Values.apiserver.verbosity }}"
{{- if .Values.apiserver.tls.requestHeaderCA }}
- --requestheader-client-ca-file=/var/run/kubernetes-service-catalog/requestheader-ca.crt
{{ else }}
- --authentication-skip-lookup=true
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I think it's possible to use delegated authn/authz without passing the requestheader-ca when the correct RBAC bindings are in place. See #936 and #981

{{- end }}
{{- if not .Values.apiserver.auth.enabled }}
- --disable-auth
Expand Down
21 changes: 15 additions & 6 deletions charts/catalog/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@ apiserver:
# for more information on proper values of this field
versionPriority: 20
tls:
# Base64-encoded certificate authority for the APIService object to register
# the Service Catalog API with the apiregistration
ca: ""
# Base64-encoded x509 certificate
cert: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURUVENDQWpXZ0F3SUJBZ0lCQVRBTkJna3Foa2lHOXcwQkFRc0ZBREFpTVNBd0hnWURWUVFEREJjeE1DNHgKTVRJdU1TNHhPRFJBTVRRNE56RTVPRE14TWpBZUZ3MHhOekF5TVRVeU1qTTRNekphRncweE9EQXlNVFV5TWpNNApNekphTUNJeElEQWVCZ05WQkFNTUZ6RXdMakV4TWk0eExqRTRORUF4TkRnM01UazRNekV5TUlJQklqQU5CZ2txCmhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBc1J6WlcxTllJQ2FaV3NScytrUGZxRU1uUnI0eE91N2gKb0l5ODI2MHltU3lCRkFZaUh0ankrVVc5NldNbXdCQkFRcVlGR3BQczN2UnI1SGF1RkJuV1dicHRMUjlnbVdZWApRa0tzYm9yK1MybTJwYWUyQ2EyVVRnMXJkMkV5VHpkbWkzaFdKMWRQMllRV0tOSXJOSGpmcTM5L25HTU5YWHRjCmJqbWYxb0ZHUER5ODVMNlIyclpVMHlaM0NMNVByczNhV0tQQmtLVXU3NDZhbldONzNTcGRoSTFxMnhNWHJseXMKcFlnUzdjV2FhZERidjVvNjFUYUFyTm0yTCtUWlNESExUMUVzOXdlVCs3TkhQQVlkUVpYTW1lRXU1V1U5ZzZ0UApnOEtmQk5PVG9iUzZPOTZLTzl4Y0VqT0JLcWdaZTQyYVpoZmFja09rcCs5aUFRN1BPQXhTVVFJREFRQUJvNEdOCk1JR0tNQTRHQTFVZER3RUIvd1FFQXdJQ3BEQVRCZ05WSFNVRUREQUtCZ2dyQmdFRkJRY0RBVEFQQmdOVkhSTUIKQWY4RUJUQURBUUgvTUZJR0ExVWRFUVJMTUVtQ0ZtdDFZbVZ5Ym1WMFpYTXVaR1ZtWVhWc2RDNXpkbU9DRW10MQpZbVZ5Ym1WMFpYTXVaR1ZtWVhWc2RJSUthM1ZpWlhKdVpYUmxjNElKYkc5allXeG9iM04waHdRS2NBRzRNQTBHCkNTcUdTSWIzRFFFQkN3VUFBNElCQVFCYWlPckpOS3FhMmFWdG13YVdoaDAyVFJrMjlXLzA0WlRCYnJseFlpbHQKVi9CYklHbmF3UzlxcGRyVHJNc0RBVmtBbUpRaGtabHJOeFpYbE01WnR2c2wyc3ZHMVlFVnA1UTJuaU9PT3B1Sgo1UDFINUo2SDJNWUpQS2c3OTAyVnZnZ0xPVG5QU01aVjgyWFRlV2JrRW51UjFlY3pwK1NmWjVjZFArSnE3WVRuCm52dHc3aHUzOW1mSVZIU3g3Rk0vN2lBWUJLN0tNQlNUUHZYdWk0SGRTamUzTkhkNlllL0c1bTgvOXNxVXVIL0gKcWJMT0lpenFRRVFNTFRzaFNHdUtxYlVFZ2tBU0ExaTVPbENZcWpEUGRQNTBvVEJkQ24vRnhrMVIvc0R5UlhtQwpYMUR4cUZjNzdkT0pMaHJKM0tDT1RsTy9RY2tkcytkR0tTU09jV0Y4L0p5egotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
# The name of the file that contains the certificate authority for the APIService object to
# register the Service Catalog API with the API aggregator in the APIRegistration object.
# This field is required if apiserver.auth.enabled is true.
caFileName:
# The name of the file that contains the x509 certificate for use in the aforementioned
# APIService object. This field is required if apiserver.auth.enabled is true.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think so. RBAC and delegated authn/authz can happen while still serving with self-signed certs

certFileName:
# The name of the file that contains the private key for use in the aforementioned APIService
# object. This field is required if apiserver.auth.enabled is true.
# Base64-encoded private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UFcxb0NkTTl0OWM4V0hSNwpzSSsrWktKOVJVanZzeUNZeHM1SFNlNzFVNXZYMTFMcUhydkc2Q2docnNNc2lCa0N1NGZWCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
keyFileName:
# The name of the file that contains the CA to authenticate connections from API server
# proxies. This field is not required. If it is not set, the service-catalog API server
# will be started with the --authentication-skip-lookup flag, which will disable the auth checks
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure setting CA should tie to setting this other flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

they seem to be one or the other

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @MHBauer

# from the API server proxies as well as client cert authentication.
requestHeaderCA:
# Attributes of the apiserver's service resource
service:
# Type of service; valid values are "LoadBalancer" and "NodePort"
Expand Down
24 changes: 16 additions & 8 deletions docs/api-aggregation-setup.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Setting up Service Catalog for API Aggregation in Kubernetes

The aggregator is a server that sits in front of the core API
Expand All @@ -15,7 +14,7 @@ certificate bundle to the APIService apiregistration endpoint.

For development purposes, it is convenient to use the existing CA
automatically set up by the kubernetes development environment. The
[script in contrib](../contrib/svc-cat-apiserver-aggregation-tls-setup.sh)
[script in the catalog chart](../charts/catalog/aggregation-tls-setup.sh)
generates a fresh CA and certificate setup, without using any existing
kubernetes infrastructure CAs or certificates. This script should be
`source`ed to define all of the variables it contains in the current
Expand Down Expand Up @@ -179,12 +178,14 @@ keys we just generated inline.

```
helm install charts/catalog \
--name ${HELM_NAME} --namespace ${SVCCAT_NAMESPACE} \
--name ${HELM_NAME} \
--namespace ${SVCCAT_NAMESPACE} \
--set apiserver.auth.enabled=true \
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should just switch this to true by default, see #981

--set useAggregator=true \
--set apiserver.tls.ca=$(base64 --wrap 0 ${SC_SERVING_CA}) \
--set apiserver.tls.cert=$(base64 --wrap 0 ${SC_SERVING_CERT}) \
--set apiserver.tls.key=$(base64 --wrap 0 ${SC_SERVING_KEY})
--set useAggregator=true \
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should just switch this to true by default, see #981

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be fine for #981 to do that.

--set apiserver.insecure=false \
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should just switch this to false by default, see #981

--set apiserver.tls.caFileName=${SC_SERVING_CA} \
--set apiserver.tls.certFileName=${SC_SERVING_CERT} \
--set apiserver.tls.keyFileName=${SC_SERVING_KEY}
```

`servicecatalog.k8s.io/v1alpha1` should show up under `kubectl
Expand All @@ -211,5 +212,12 @@ Before installing the helm chart, run the script in contrib by
`source`ing it, to define all of the necessary variables.

```shell
source /contrib/svc-cat-apiserver-aggregation-tls-setup.sh
source charts/catalog/aggregation/tls-setup/sh
```

To delete, all resources, execute the following:

```console
helm delete --purge catalog
kubectl delete apiservice v1alpha1.servicecatalog.k8s.io
```
Loading