Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): 2.4.5 #4216

Merged
merged 9 commits into from
Feb 28, 2024
8 changes: 8 additions & 0 deletions .github/workflows/monokle-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ jobs:
run: |
brew install jq

- name: Check MacOS certs expiration
run: |
ls -la
chmod +x .github/workflows/scripts/check-osx-cert-exp.sh && .github/workflows/scripts/check-osx-cert-exp.sh
env:
CERTIFICATE_OSX_APPLICATION: ${{ secrets.MONOKLE_MACOS_CERTS }}
CERTIFICATE_PASSWORD: ${{ secrets.MONOKLE_MACOS_CERTS_PASSWORD }}

- name: Add MacOS certs
run: |
ls -la
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/scripts/check-osx-cert-exp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env sh

KEY_CHAIN=build.keychain
CERTIFICATE_P12=certificate.p12

# Recreate the certificate from the secure environment variable
echo $CERTIFICATE_OSX_APPLICATION | base64 --decode > $CERTIFICATE_P12

# Get expiration date of the certificate
CERT_EXPIRATION_DATE=$(openssl pkcs12 -in certificate.p12 -passin pass:$CERTIFICATE_PASSWORD -nokeys | openssl x509 -noout -enddate | cut -d= -f2)
echo "Certificate expires on: $CERT_EXPIRATION_DATE"

# Compare the expiration date with the current date
CERT_EXPIRATION_DATE=$(date -j -f "%b %d %T %Y %Z" "$CERT_EXPIRATION_DATE" +"%Y-%m-%d")
CURRENT_DATE=$(date +"%Y-%m-%d")

if [[ "$CURRENT_DATE" > "$CERT_EXPIRATION_DATE" ]]; then
echo "The certificate has expired."
exit 1
else
echo "The certificate is valid."
fi
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [2.4.5](https://github.com/kubeshop/monokle/compare/v2.4.4...v2.4.5) (2024-02-28)


### Bug Fixes

* access debug logs for failed proxy setups ([a05348d](https://github.com/kubeshop/monokle/commit/a05348d37afbde808ea46ee9d2dcbac7580aaca3))
* missing crds folder runtime error ([75fb95a](https://github.com/kubeshop/monokle/commit/75fb95a8bf70f3ae28f72efed05fc81a231b883b))
* preserve \n\t\r control characters when displaying logs ([ed6a412](https://github.com/kubeshop/monokle/commit/ed6a4120fe35cc9e90dab762ec4a87b61610eb33))
* stringify the `context` and `kubeconfig` cli arguments ([93e6652](https://github.com/kubeshop/monokle/commit/93e665267b061efecc5d61702e6ef63b605747ed))

### [2.4.4](https://github.com/kubeshop/monokle/compare/v2.4.3...v2.4.4) (2024-01-04)


Expand Down
8 changes: 8 additions & 0 deletions electron/app/services/cluster/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ const errors = createErrors({
title: 'Cannot connect to the cluster',
description: 'There is no current context selected.',
},
'proxy-missing-context': {
title: 'Cannot connect to the cluster',
description: 'The specified context does not exist. Please check your kubeconfig file.',
},
'proxy-invalid-config': {
title: 'Cannot connect to the cluster',
description: 'The proxy connection arguments were invalid.',
},
'local-connection-refused': {
title: 'Cannot connect to the cluster',
description: 'The connection was refused - is your Docker Engine or VM running?',
Expand Down
3 changes: 3 additions & 0 deletions electron/app/services/cluster/handlers/debugProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export async function debugProxy({context, kubeconfig}: DebugProxyArgs): Promise
return proxy.debugInfo;
}

const proxy = await PROXY_SERVICE.getLast();
if (proxy) return proxy.debugInfo;

return {
cmd: 'kubectl proxy exited',
logs: [
Expand Down
6 changes: 6 additions & 0 deletions electron/app/services/cluster/handlers/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ function determineError(reason: string, contextId: ContextId): MonokleClusterErr
if (reason === 'MONOKLE_PROXY_EMPTY_CONTEXT') {
return getMonokleClusterError('proxy-empty-context', contextId);
}
if (reason === 'MONOKLE_PROXY_MISSING_CONTEXT') {
return getMonokleClusterError('proxy-missing-context', contextId);
}
if (reason === 'MONOKLE_PROXY_INVALID_CONFIG') {
return getMonokleClusterError('proxy-invalid-config', contextId);
}

// Kubectl user authentication error.
// These happen within the local kube-proxy.
Expand Down
8 changes: 6 additions & 2 deletions electron/kubernetes/ProxyInstance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export class ProxyInstance {
throw new Error('MONOKLE_PROXY_EMPTY_CONTEXT');
}

const globalOptions = [`--context=${this.context}`];
if (this.kubeconfig) globalOptions.push(`--kubeconfig=${this.kubeconfig}`);
const globalOptions = [`--context=${JSON.stringify(this.context)}`];
if (this.kubeconfig) globalOptions.push(`--kubeconfig=${JSON.stringify(this.kubeconfig)}`);
if (this.verbosity) globalOptions.push(`-v=${this.verbosity}`);

const proxyOptions = [`--port=${this.port}`];
Expand Down Expand Up @@ -113,6 +113,10 @@ export class ProxyInstance {
proxySignal.reject(new Error('EADDRINUSE'));
} else if (msg.includes('error: The gcp auth plugin has been removed')) {
proxySignal.reject(new Error('MONOKLE_PROXY_GCP_LEGACY_PLUGIN'));
} else if (/^error: flags cannot be placed before/i.test(msg)) {
proxySignal.reject(new Error('MONOKLE_PROXY_INVALID_CONFIG'));
} else if (/^(error: context).*(does not exist)/i.test(msg)) {
proxySignal.reject(new Error('MONOKLE_PROXY_MISSING_CONTEXT'));
} else {
// do nothing and let the timeout reject eventually.
// For instance, high verbosity logs plenty of details
Expand Down
6 changes: 6 additions & 0 deletions electron/kubernetes/ProxyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const PROXY_MAX_ATTEMPTS = 25;
export class ProxyService {
private nextPort = 30001;
private proxies: ProxyInstance[] = [];
private last: ProxyInstance | undefined;

get(context: string, kubeconfig?: string): Promise<ProxyInstance> {
const proxy = this.proxies.find(p => p.context === context && p.kubeconfig === kubeconfig);
Expand All @@ -21,6 +22,10 @@ export class ProxyService {
return this.start(context, kubeconfig);
}

async getLast(): Promise<ProxyInstance | undefined> {
return this.last;
}

find(context: string) {
return this.proxies.find(p => p.context === context);
}
Expand All @@ -34,6 +39,7 @@ export class ProxyService {
this.nextPort += 1;

const proxy = new ProxyInstance({context, kubeconfig, port, verbosity: undefined});
this.last = proxy;
await proxy.start();

proxy.onDelete = () => {
Expand Down
Loading
Loading