你好,当我使用节点端口公开我的 redis 服务时,它工作正常。我能够访问它。但如果我尝试切换到 Ingress Nginx 控制器,它会拒绝连接。其他应用程序可以与 Ingress 配合使用。
这是我的服务:
apiVersion: v1
kind: Service
metadata:
name: redis-svc
spec:
# type: NodePort
ports:
- name: http
port: 6379
targetPort: 6379
protocol: TCP
# nodePort: 30007
selector:
app: redis
Run Code Online (Sandbox Code Playgroud)
这是入口:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: redis-ing
annotations:
kubernetes.io/ingress.class: "nginx"
ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
# nginx.ingress.kubernetes.io/enable-cors: "true"
# nginx.ingress.kubernetes.io/cors-allow-methods: "PUT, GET, POST, OPTIONS"
# nginx.ingress.kubernetes.io/cors-allow-origin: "https://test.hefest.io"
# nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
spec:
tls:
- secretName: letsencrypt-prod
hosts:
- redis-dev.domain.com
rules:
- …Run Code Online (Sandbox Code Playgroud) 我试图理解线性回归......这是我试图理解的脚本:
'''
A linear regression learning algorithm example using TensorFlow library.
Author: Aymeric Damien
Project: https://github.com/aymericdamien/TensorFlow-Examples/
'''
from __future__ import print_function
import tensorflow as tf
from numpy import *
import numpy
import matplotlib.pyplot as plt
rng = numpy.random
# Parameters
learning_rate = 0.0001
training_epochs = 1000
display_step = 50
# Training Data
train_X = numpy.asarray([3.3,4.4,5.5,6.71,6.93,4.168,9.779,6.182,7.59,2.167,
7.042,10.791,5.313,7.997,5.654,9.27,3.1])
train_Y = numpy.asarray([1.7,2.76,2.09,3.19,1.694,1.573,3.366,2.596,2.53,1.221,
2.827,3.465,1.65,2.904,2.42,2.94,1.3])
train_X=numpy.asarray(train_X)
train_Y=numpy.asarray(train_Y)
n_samples = train_X.shape[0]
# tf Graph Input
X = tf.placeholder("float")
Y = tf.placeholder("float")
# Set model weights
W …Run Code Online (Sandbox Code Playgroud) 我有这样的查询:
galleryModel.find({_id: galleryId})
.populate({
model: 'User',
path: 'objectId',
select: 'firstName lastName'
})
Run Code Online (Sandbox Code Playgroud)
的最终响应objectId将如下所示:
objectId: {
...
}
Run Code Online (Sandbox Code Playgroud)
如何user在不更改实际路径的情况下将其更改为响应?
在我的根文件夹中,我有tsconfig.json文件,如下所示:
{
"compilerOptions": {
/* Basic Options */
"target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": [
"es2017",
"dom"
], /* Specify library files to be included in the compilation. */
"declaration": false, /* Generates corresponding '.d.ts' file. */
"outDir": "./dist", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root …Run Code Online (Sandbox Code Playgroud) 这是我正在使用的集合:
- sign1: A1
- sign2: A2
- sign1: A2
- sign2: A5
- sign1: A2
- sign2: A6
- sign1: A2
- sign2: A8
- sign1: A5
- sign2: A8
Run Code Online (Sandbox Code Playgroud)
查询应该找到从 A1 到 A8 的路径
例如,它应该找到:
path1:
A1 A2 -> A2 A5 -> A5 A8
path2:
A1 A2 -> A2 A8
path3:
A1 A2 -> A2 A6 -> should be ignored since not finishes with A8
Run Code Online (Sandbox Code Playgroud)
目前,我尝试了这个(@ray 的部分解决方案):
我的查询的第一个问题是它返回所有路径,即使它不以 A8 结尾
第二个问题是不分离路径将所有内容放在一个数组中
mongodb mongodb-query nosql-aggregation aggregation-framework
我在LoginComponent中有登录功能:
login() {
this.loading = true;
this.subscription = this.authenticationService.login(this.model.username, this.model.password)
.subscribe(result => {
this.em.changeNav(1);
this.loading = false;
this.Auth.setToken(result);
this.router.navigate(['/code']);
this.subscription.unsubscribe();
},
err => {
this.error = JSON.parse(err._body).error;
this.loading = false;
});
}
Run Code Online (Sandbox Code Playgroud)
this.authenticationService.login 是向api发送http请求的服务...
这是测试:
it('should login', fakeAsync(() => {
spyOn(component, 'login');
let button = fixture.debugElement.nativeElement.querySelector('button');
button.click();
//CHECK IF LOGIN FUNCTION CALLED
fixture.whenStable().then(() => {
expect(component.login).toHaveBeenCalled();
})
}));
Run Code Online (Sandbox Code Playgroud)
如何this.authenticationService.login在订阅方法中模拟服务和断言?
编辑
测试:
import { async, ComponentFixture, TestBed, fakeAsync, tick, inject } from '@angular/core/testing';
import { By } from '@angular/platform-browser'; …Run Code Online (Sandbox Code Playgroud) 我正在尝试向现有 hapi 定义添加新类型...我想添加 seneca 类型...这是示例
interface SenecaMethods {
act: any;
add: any;
}
interface HapiServer extends Hapi.Server {
info: any;
seneca: SenecaMethods;
}
const server: HapiServer = new Hapi.Server();
Run Code Online (Sandbox Code Playgroud)
它返回的错误服务器无法分配给 HapiServer,类型服务器中缺少属性“seneca”。
如何将 seneca 方法添加到 Hapi.Server?我可以将 seneca 设为可选,但我不希望它是可选的....
我创建了注册表积分,当我像这样申请 pod 时:
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: registry.io.io/simple-node
imagePullSecrets:
- name: regcred
Run Code Online (Sandbox Code Playgroud)
它工作成功拉图像
但如果我尝试这样做:
apiVersion: apps/v1
kind: Deployment
metadata:
name: node123
namespace: node123
spec:
replicas: 5
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 2
maxUnavailable: 0
selector:
matchLabels:
name: node123
template:
metadata:
labels:
name: node123
spec:
containers:
- name: node123
image: registry.io.io/simple-node
ports:
- containerPort: 3000
imagePullSecrets:
- name: regcred
Run Code Online (Sandbox Code Playgroud)
在 pod 上会得到错误:ImagePullBackOff
当我描述它时
无法拉取镜像“registry.io.io/simple-node”:rpc 错误:代码 = 未知描述 = 来自守护进程的错误响应:获取 https://registry.io.io/v2/simple-node/manifests/latest:没有基本的身份验证凭据
有谁知道如何解决这个问题?
kubernetes ×2
mongodb ×2
typescript ×2
angular ×1
bash ×1
hapi.js ×1
mongoose ×1
node.js ×1
prediction ×1
python ×1
redis ×1
tensorflow ×1
tsc ×1
tsconfig ×1
unit-testing ×1