Skip to content

Commit add89d9

Browse files
authored
Provision Kerberos principals for IP addresses (#552)
* Provision principals for IP addresses * Add nodeport IP listener volume test * Changelog * Remove FQDNization from changelog It was reverted in #551
1 parent 5e73a95 commit add89d9

File tree

5 files changed

+47
-13
lines changed

5 files changed

+47
-13
lines changed

CHANGELOG.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ All notable changes to this project will be documented in this file.
1212
### Added
1313

1414
- Made RSA key length configurable for certificates issued by cert-manager ([#528]).
15-
16-
### Changed
17-
18-
- Append a dot (`.`) to the default cluster domain to reduce DNS requests ([#543]).
15+
- Kerberos principal backends now also provision principals for IP address, not just DNS hostnames ([#552]).
1916

2017
### Fixed
2118

@@ -26,8 +23,8 @@ All notable changes to this project will be documented in this file.
2623

2724
[#528]: https://github.com/stackabletech/secret-operator/pull/528
2825
[#536]: https://github.com/stackabletech/secret-operator/pull/536
29-
[#543]: https://github.com/stackabletech/secret-operator/pull/543
3026
[#548]: https://github.com/stackabletech/secret-operator/pull/548
27+
[#552]: https://github.com/stackabletech/secret-operator/pull/552
3128

3229
## [24.11.0] - 2024-11-18
3330

rust/operator-binary/src/backend/kerberos_keytab.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,18 @@ cluster.local = {realm_name}
208208
scope: scope.clone(),
209209
})?
210210
{
211-
if let Address::Dns(hostname) = addr {
212-
pod_principals.push(
213-
format!("{service_name}/{hostname}")
214-
.try_into()
215-
.context(PodPrincipalSnafu)?,
216-
);
217-
}
211+
pod_principals.push(
212+
match addr {
213+
Address::Dns(hostname) => {
214+
format!("{service_name}/{hostname}")
215+
}
216+
Address::Ip(ip) => {
217+
format!("{service_name}/{ip}")
218+
}
219+
}
220+
.try_into()
221+
.context(PodPrincipalSnafu)?,
222+
);
218223
}
219224
}
220225
}

tests/templates/kuttl/kerberos/01-install-kdc.yaml.j2

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: kuttl.dev/v1beta1
33
kind: TestStep
44
commands:
55
- script: envsubst '$NAMESPACE' < secretclass.yaml | kubectl apply -f -
6+
- script: envsubst '$NAMESPACE' < listenerclass.yaml | kubectl apply -f -
67
---
78
apiVersion: apps/v1
89
kind: StatefulSet

tests/templates/kuttl/kerberos/kinit-client.yaml.j2

+23-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ spec:
2121
klist -k /stackable/krb/keytab -teKC
2222
echo kiniting node
2323
kinit -kt /stackable/krb/keytab -p HTTP/$NODE_NAME
24+
echo kiniting node ip
25+
NODE_IP="$(cat /stackable/listener/nodeport-ip/default-address/address)"
26+
echo node ip is "$NODE_IP"
27+
kinit -kt /stackable/krb/keytab -p "HTTP/$NODE_IP"
2428
echo kiniting service
2529
kinit -kt /stackable/krb/keytab -p HTTP/krb5-client.$NAMESPACE.svc.cluster.local
2630
echo kiniting pod
@@ -39,21 +43,39 @@ spec:
3943
volumeMounts:
4044
- mountPath: /stackable/krb
4145
name: kerberos
46+
- mountPath: /stackable/listener/nodeport-ip
47+
name: listener-nodeport-ip
48+
ports:
49+
- name: dummy
50+
containerPort: 9999
4251
volumes:
4352
- name: kerberos
4453
ephemeral:
4554
volumeClaimTemplate:
4655
metadata:
4756
annotations:
4857
secrets.stackable.tech/class: kerberos-$NAMESPACE
49-
secrets.stackable.tech/scope: node,pod
58+
secrets.stackable.tech/scope: node,pod,listener-volume=listener-nodeport-ip
5059
spec:
5160
storageClassName: secrets.stackable.tech
5261
accessModes:
5362
- ReadWriteOnce
5463
resources:
5564
requests:
5665
storage: "1"
66+
- name: listener-nodeport-ip
67+
ephemeral:
68+
volumeClaimTemplate:
69+
metadata:
70+
annotations:
71+
listeners.stackable.tech/listener-class: nodeport-ip-$NAMESPACE
72+
spec:
73+
storageClassName: listeners.stackable.tech
74+
accessModes:
75+
- ReadWriteOnce
76+
resources:
77+
requests:
78+
storage: "1"
5779
restartPolicy: Never
5880
terminationGracePeriodSeconds: 0
5981
subdomain: krb5-client
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# $NAMESPACE will be replaced with the namespace of the test case.
2+
---
3+
apiVersion: listeners.stackable.tech/v1alpha1
4+
kind: ListenerClass
5+
metadata:
6+
name: nodeport-ip-$NAMESPACE
7+
spec:
8+
serviceType: NodePort
9+
preferredAddressType: IP

0 commit comments

Comments
 (0)