-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from lensapp/https-proxy-env
Https proxy env
- Loading branch information
Showing
7 changed files
with
427 additions
and
122 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`updater parses yaml 1`] = ` | ||
"apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: lens-platform | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: lens-platform-cluster | ||
namespace: lens-platform | ||
data: | ||
lensPlatformK8sclusterId: some-LENS_PLATFORM_K8S_CLUSTER_ID | ||
lensPlatformSpaceName: some-LENS_PLATFORM_SPACE_NAME | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: bored-agent-updater | ||
namespace: lens-platform | ||
spec: | ||
schedule: \\"@hourly\\" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: bored-agent-updater | ||
containers: | ||
- name: bored-agent-updater | ||
image: quay.io/k8slens/bored-agent:0.10.0 | ||
env: | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: BORED_SERVER | ||
value: some-BORED_SERVER | ||
- name: BORED_TOKEN | ||
value: some-BORED_TOKEN | ||
- name: LENS_PLATFORM_K8S_CLUSTER_ID | ||
value: some-LENS_PLATFORM_K8S_CLUSTER_ID | ||
- name: LENS_PLATFORM_SPACE_NAME | ||
value: some-LENS_PLATFORM_SPACE_NAME | ||
- name: LENS_BACKEND_URL | ||
value: https://some-url.irrelevant/ | ||
- name: AUTO_UPDATE_URL | ||
value: https://some-url.irrelevant/some-file-path | ||
- name: BORED_HTTPS_PROXY | ||
value: some-BORED_HTTPS_PROXY | ||
command: | ||
- node | ||
- dist/src/updater.js | ||
restartPolicy: Never | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: bored-agent | ||
namespace: lens-platform | ||
labels: | ||
app: bored-agent | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: bored-agent | ||
template: | ||
metadata: | ||
labels: | ||
app: bored-agent | ||
spec: | ||
priorityClassName: lens-bored-agent | ||
serviceAccountName: bored-agent | ||
containers: | ||
- name: agent | ||
image: quay.io/k8slens/bored-agent:0.10.0 | ||
env: | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: BORED_SERVER | ||
value: some-BORED_SERVER | ||
- name: BORED_TOKEN | ||
value: some-BORED_TOKEN | ||
- name: HTTPS_PROXY | ||
value: some-HTTPS_PROXY | ||
" | ||
`; |
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,88 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: lens-platform | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: lens-platform-cluster | ||
namespace: lens-platform | ||
data: | ||
lensPlatformK8sclusterId: $LENS_PLATFORM_K8S_CLUSTER_ID | ||
lensPlatformSpaceName: $LENS_PLATFORM_SPACE_NAME | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: bored-agent-updater | ||
namespace: lens-platform | ||
spec: | ||
schedule: "@hourly" | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: bored-agent-updater | ||
containers: | ||
- name: bored-agent-updater | ||
image: quay.io/k8slens/bored-agent:0.10.0 | ||
env: | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: BORED_SERVER | ||
value: $BORED_SERVER | ||
- name: BORED_TOKEN | ||
value: $BORED_TOKEN | ||
- name: LENS_PLATFORM_K8S_CLUSTER_ID | ||
value: $LENS_PLATFORM_K8S_CLUSTER_ID | ||
- name: LENS_PLATFORM_SPACE_NAME | ||
value: $LENS_PLATFORM_SPACE_NAME | ||
- name: LENS_BACKEND_URL | ||
value: $LENS_BACKEND_URL | ||
- name: AUTO_UPDATE_URL | ||
value: $AUTO_UPDATE_URL | ||
- name: BORED_HTTPS_PROXY | ||
value: "" | ||
command: | ||
- node | ||
- dist/src/updater.js | ||
restartPolicy: Never | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: bored-agent | ||
namespace: lens-platform | ||
labels: | ||
app: bored-agent | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: bored-agent | ||
template: | ||
metadata: | ||
labels: | ||
app: bored-agent | ||
spec: | ||
priorityClassName: "lens-bored-agent" | ||
serviceAccountName: bored-agent | ||
containers: | ||
- name: agent | ||
image: quay.io/k8slens/bored-agent:0.10.0 | ||
env: | ||
- name: NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: BORED_SERVER | ||
value: $BORED_SERVER | ||
- name: BORED_TOKEN | ||
value: $BORED_TOKEN | ||
- name: HTTPS_PROXY | ||
value: "" | ||
--- | ||
|
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,34 @@ | ||
import path from "path"; | ||
import { Config, fetchBoredAgentYml } from "../updater-yml"; | ||
import fs from "fs"; | ||
|
||
describe("updater", () => { | ||
let config: Config; | ||
let gotMock: jest.Mock; | ||
|
||
beforeEach(() => { | ||
config = { | ||
BORED_SERVER: "some-BORED_SERVER", | ||
BORED_TOKEN: "some-BORED_TOKEN", | ||
LENS_PLATFORM_K8S_CLUSTER_ID: "some-LENS_PLATFORM_K8S_CLUSTER_ID", | ||
LENS_PLATFORM_SPACE_NAME: "some-LENS_PLATFORM_SPACE_NAME", | ||
NAMESPACE: "some-NAMESPACE", | ||
AUTO_UPDATE_URL: "https://some-url.irrelevant/some-file-path", | ||
LENS_BACKEND_URL: "https://some-url.irrelevant/", | ||
HTTPS_PROXY: "some-HTTPS_PROXY", | ||
BORED_HTTPS_PROXY: "some-BORED_HTTPS_PROXY", | ||
}; | ||
|
||
const mockData = fs.readFileSync( | ||
path.join(__dirname, "./updater-mock.yml") | ||
); | ||
|
||
gotMock = jest.fn().mockResolvedValue({ body: mockData.toString() }); | ||
}); | ||
|
||
it("parses yaml", async () => { | ||
const result = await fetchBoredAgentYml(config, gotMock as any); | ||
|
||
expect(result).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.