-
Notifications
You must be signed in to change notification settings - Fork 385
Add ability to specify CA certs to use for TLS authentication. #1112
Conversation
43e0593
to
1678a98
Compare
This is no longer in-progress. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to me, but I left 1 comment on the helm chart. My apologies for the long delay in reviewing!
- --tlsCert | ||
- "{{ .Values.tls.cert }}" | ||
{{- end}} | ||
{{- if .Values.tls.key}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not 100% sure on this, but iirc this will collapse --tlsKey
onto the same line as --tlsCert
. The solution would be to rewrite this as {{ if .Values.tls.key -}}
. Same with the above if
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both {{- if .Values.tls.key }}
and {{ if .Values.tls.key -}}
will yield the same yaml. The former will chomp the whitespace to the left, removing the newline from the previous line. The latter will chomp the whitespace to the right, removing the newline from the current line. In the end, they both will leave one newline. Using the left-side chomp seems to be a little less troublesome when the line after the if block is not at the same indentation level as the if block. With the right-side chomp, we would remove the spaces on the following line and leave the spaces on the current line, resulting in the following line being at the indentation of the current line.
For reference, the helm chart template guide [1] uses the left chomp in its example.
Here is the relevant snippet of the output from running helm install charts/ups-broker --name ups-broker --namespace ups-broker --set tls.cert=fake-cert --set tls.key=fake-key --dry-run --debug
.
imagePullPolicy: Always
args:
- --port
- "8080"
- --tlsCert
- "fake-cert"
- --tlsKey
- "fake-key"
ports:
- containerPort: 8080
[1] https://github.com/kubernetes/helm/blob/master/docs/chart_template_guide/control_structures.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch - I stand corrected, thanks @staebler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now I know it's called chomp. that document is way too difficult to find.
Modify ups-broker walkthrough example to support using TLS.
1678a98
to
5da8ea5
Compare
@@ -4,3 +4,6 @@ metadata: | |||
name: ups-broker | |||
spec: | |||
url: http://ups-broker-ups-broker.ups-broker.svc.cluster.local | |||
##url: https://ups-broker-ups-broker.ups-broker.svc.cluster.local:80 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might add a comment explaining what the commented out fields are here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One change requested - make it so you cannot set both the insecure flag and CA bundle at the same time.
// InsecureSkipTLSVerify disables TLS certificate verification when communicating with this Broker. | ||
// This is strongly discouraged. You should use the CABundle instead. | ||
// +optional | ||
InsecureSkipTLSVerify bool `json:"insecureSkipTLSVerify,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be a validation that ensures that you cannot set InsecureSkipTLSVerify
and CABundle
at the same time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable. Validation has been added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a nit for validation error message.
@@ -101,6 +101,10 @@ func validateBrokerSpec(spec *sc.BrokerSpec, fldPath *field.Path) field.ErrorLis | |||
|
|||
} | |||
|
|||
if spec.InsecureSkipTLSVerify && len(spec.CABundle) > 0 { | |||
allErrs = append(allErrs, field.Invalid(fldPath.Child("CABundle"), spec.CABundle, "CABundle cannot be used when InsecureSkipTLSVerify is true")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSON field name is caBundle
(and the other is insecureSkipTLSVerify
), so it should be:
allErrs = append(allErrs, field.Invalid(fldPath.Child("caBundle"), spec.CABundle, "caBundle cannot be used when insecureSkipTLSVerify is true"))
THanks a bunch! |
This has 2 LGTMs (I am also LGTM on this, fwiw), so I am merging |
@@ -77,6 +77,8 @@ func TestBrokerSpecChecksum(t *testing.T) { | |||
}, | |||
}, | |||
}, | |||
InsecureSkipTLSVerify: true, | |||
CABundle: []byte{13, 24, 35, 46}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these bytes represent something specific?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, nothing specific. Just a test set of bytes that can test that the cheksum is created correctly.
Closes #1064.
Adds insecureSkipTLSVerify and caBundle to the broker spec. The insecureSkipTLSVerify field allows the user to communicate with the broker via TLS in an insecure manner by ignoring TLS verification. The caBundle field allows the user to specify root CAs to use when verifying TLS.
Modifies ups-broker walkthrough example to support using TLS.
Updates the OSB client to include the changes from kubernetes-retired/go-open-service-broker-client#55. These changes bring support to the OSB client for skipping TLS verification and supplying root CAs.
As a consequence of doing a glide update, the github.com/golang/glog and github.com/gorilla/mux dependencies were update as well.
github.com/golang/glog changelog:
github.com/gorilla/mux changelog: