-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
584792e
commit 0886f3c
Showing
4 changed files
with
208 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
should create Gateway and Service resources if enabled: | ||
1: | | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: GatewayClass | ||
metadata: | ||
name: RELEASE-NAME-container-agent-ssh | ||
namespace: NAMESPACE | ||
spec: | ||
controllerName: example.net/gateway-controller | ||
2: | | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: Gateway | ||
metadata: | ||
name: RELEASE-NAME-container-agent-ssh | ||
namespace: NAMESPACE | ||
spec: | ||
gatewayClassName: RELEASE-NAME-container-agent-ssh | ||
listeners: | ||
- allowedRoutes: | ||
kinds: | ||
- kind: TCPRoute | ||
name: ssh-22 | ||
port: 22 | ||
protocol: TCP | ||
- allowedRoutes: | ||
kinds: | ||
- kind: TCPRoute | ||
name: ssh-23 | ||
port: 23 | ||
protocol: TCP | ||
- allowedRoutes: | ||
kinds: | ||
- kind: TCPRoute | ||
name: ssh-24 | ||
port: 24 | ||
protocol: TCP | ||
3: | | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: TCPRoute | ||
metadata: | ||
name: ssh-22 | ||
namespace: NAMESPACE | ||
spec: | ||
parentRefs: | ||
- name: RELEASE-NAME-container-agent-ssh | ||
sectionName: ssh-22 | ||
rules: | ||
- backendRefs: | ||
- name: RELEASE-NAME-container-agent-ssh | ||
port: 22 | ||
4: | | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: TCPRoute | ||
metadata: | ||
name: ssh-23 | ||
namespace: NAMESPACE | ||
spec: | ||
parentRefs: | ||
- name: RELEASE-NAME-container-agent-ssh | ||
sectionName: ssh-23 | ||
rules: | ||
- backendRefs: | ||
- name: RELEASE-NAME-container-agent-ssh | ||
port: 23 | ||
5: | | ||
apiVersion: gateway.networking.k8s.io/v1alpha2 | ||
kind: TCPRoute | ||
metadata: | ||
name: ssh-24 | ||
namespace: NAMESPACE | ||
spec: | ||
parentRefs: | ||
- name: RELEASE-NAME-container-agent-ssh | ||
sectionName: ssh-24 | ||
rules: | ||
- backendRefs: | ||
- name: RELEASE-NAME-container-agent-ssh | ||
port: 24 | ||
6: | | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: RELEASE-NAME-container-agent-ssh | ||
namespace: NAMESPACE | ||
spec: | ||
ports: | ||
- name: ssh-22 | ||
port: 22 | ||
protocol: TCP | ||
targetPort: ssh-22 | ||
- name: ssh-23 | ||
port: 23 | ||
protocol: TCP | ||
targetPort: ssh-23 | ||
- name: ssh-24 | ||
port: 24 | ||
protocol: TCP | ||
targetPort: ssh-24 | ||
selector: | ||
app.kubernetes.io/managed-by: circleci-container-agent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
suite: test ssh | ||
tests: | ||
- it: should create Gateway and Service resources if enabled | ||
template: templates/ssh.yaml | ||
set: | ||
agent.ssh.isEnabled: true | ||
agent.ssh.controllerName: "example.net/gateway-controller" | ||
agent.ssh.startPort: 22 | ||
agent.ssh.numPorts: 3 | ||
asserts: | ||
- matchSnapshot: {} | ||
|
||
- it: should update Role rules to allow get Gateway and Service resources if enabled | ||
template: templates/role.yaml | ||
set: | ||
agent.ssh.isEnabled: true | ||
asserts: | ||
- contains: | ||
path: rules | ||
content: | ||
apiGroups: ["", "gateway.networking.k8s.io"] | ||
resources: ["gateways", "services", "endpoints"] | ||
verbs: ["get"] | ||
documentIndex: 0 | ||
|
||
- it: should set container-agent ssh configuration if enabled | ||
template: templates/deployment.yaml | ||
set: | ||
agent.ssh.isEnabled: true | ||
asserts: | ||
- contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: KUBE_SSH_IS_ENABLED | ||
value: "true" | ||
- contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: KUBE_SSH_GATEWAY_NAME | ||
value: "RELEASE-NAME-container-agent-ssh" | ||
- contains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: KUBE_SSH_SERVICE_NAME | ||
value: "RELEASE-NAME-container-agent-ssh" | ||
|
||
- it: should not create any Gateway or Service resources if disabled | ||
template: templates/ssh.yaml | ||
set: | ||
agent.ssh.isEnabled: false | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
|
||
- it: should not update Role rules to allow get Gateway and Service resources if disabled | ||
template: templates/role.yaml | ||
set: | ||
agent.ssh.isEnabled: false | ||
asserts: | ||
- notContains: | ||
path: rules | ||
content: | ||
apiGroups: ["", "gateway.networking.k8s.io"] | ||
resources: ["gateways", "services", "endpoints"] | ||
verbs: ["get"] | ||
documentIndex: 0 | ||
|
||
- it: should not set container-agent ssh configuration if disabled | ||
template: templates/deployment.yaml | ||
set: | ||
agent.ssh.isEnabled: false | ||
asserts: | ||
- notContains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: KUBE_SSH_IS_ENABLED | ||
value: "true" | ||
- notContains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: KUBE_SSH_GATEWAY_NAME | ||
value: "RELEASE-NAME-container-agent-ssh" | ||
- notContains: | ||
path: spec.template.spec.containers[0].env | ||
content: | ||
name: KUBE_SSH_SERVICE_NAME | ||
value: "RELEASE-NAME-container-agent-ssh" |