小编ufk*_*ufk的帖子

使用kubeconfig在coreos上安装kubernetes(而不是弃用--api-server)

我有两台带CoreOS beta的核心机器(1185.2.0).

我使用修改后的脚本使用rkt容器安装kuberentes,原始脚本位于https://github.com/coreos/coreos-kubernetes/tree/master/multi-node/generic.修改后的版本位于https://github.com/kfirufk/coreos-kubernetes-multi-node-generic-install-script.

我为脚本设置的环境变量是:

ADVERTISE_IP=10.79.218.2
ETCD_ENDPOINTS="https://coreos-2.tux-in.com:2379,https://coreos-3.tux-in.com:2379"
K8S_VER=v1.4.3_coreos.0
HYPERKUBE_IMAGE_REPO=quay.io/coreos/hyperkube
POD_NETWORK=10.2.0.0/16
SERVICE_IP_RANGE=10.3.0.0/24
K8S_SERVICE_IP=10.3.0.1
DNS_SERVICE_IP=10.3.0.10
USE_CALICO=true
CONTAINER_RUNTIME=rkt
ETCD_CERT_FILE="/etc/ssl/etcd/etcd1.pem"
ETCD_KEY_FILE="/etc/ssl/etcd/etcd1-key.pem"
ETCD_TRUSTED_CA_FILE="/etc/ssl/etcd/ca.pem"
ETCD_CLIENT_CERT_AUTH=true
OVERWRITE_ALL_FILES=true
CONTROLLER_HOSTNAME="coreos-2.tux-in.com"
ETCD_CERT_ROOT_DIR="/etc/ssl/etcd"
ETCD_SCHEME="https"
ETCD_AUTHORITY="coreos-2.tux-in.com:2379"
IS_MASK_UPDATE_ENGINE=false
Run Code Online (Sandbox Code Playgroud)

最值得注意的更改是添加对etcd2 tls证书和kubeconfig yaml使用的支持,而不是depreated --api-server.

目前我正在尝试使用coreos-2.tux-in.com的控制器脚本进行安装.

控制器节点的kubeconfig yaml包含:

current-context: tuxin-coreos-context
apiVersion: v1
clusters:
- cluster:
    certificate-authority: /etc/kubernetes/ssl/ca.pem
    server: https://coreos-2.tux-in.com:443
  name: tuxin-coreos-cluster
contexts:
- context:
    cluster: tuxin-coreos-cluster
  name: tuxin-coreos-context
kind: Config
preferences:
  colors: true
users:
- name: kubelet
  user:
    client-certificate: /etc/kubernetes/ssl/apiserver.pem
    client-key: /etc/kubernetes/ssl/apiserver-key.pem
Run Code Online (Sandbox Code Playgroud)

生成的kubelet.service文件包含

[Service]
Environment=KUBELET_VERSION=v1.4.3_coreos.0
Environment=KUBELET_ACI=quay.io/coreos/hyperkube
Environment="RKT_OPTS=--volume dns,kind=host,source=/etc/resolv.conf   --mount volume=dns,target=/etc/resolv.conf …
Run Code Online (Sandbox Code Playgroud)

coreos kubernetes rkt kubelet

5
推荐指数
1
解决办法
635
查看次数

运行kubelet时"x509:由未知权限签名的证书"

我正在尝试在CoreOS beta(1192.2.0)上使用kubelet 1.4.5安装kubernetes.

我正在使用稍微修改过的控制器版本和工作者安装脚本来自https://github.com/coreos/coreos-kubernetes/tree/master/multi-node/generic

所以一般我使用以下bash脚本在Gentoo Linux上创建许可证:

#!/bin/bash
export MASTER_HOST=coreos-2.tux-in.com
export K8S_SERVICE_IP=10.3.0.1
export WORKER_IP=10.79.218.3
export WORKER_FQDN=coreos-3.tux-in.com
openssl genrsa -out ca-key.pem 2048
openssl req -x509 -new -nodes -key ca-key.pem -days 10000 -out ca.pem -subj "/CN=kube-ca"
openssl genrsa -out apiserver-key.pem 2048
openssl req -new -key apiserver-key.pem -out apiserver.csr -subj "/CN=kube-apiserver" -config openssl.cnf
openssl x509 -req -in apiserver.csr -CA ca.pem -CAkey ca-key.pem -CAcreateserial -out apiserver.pem -days 365 -extensions v3_req -extfile openssl.cnf
openssl genrsa -out ${WORKER_FQDN}-worker-key.pem 2048
openssl req -new -key ${WORKER_FQDN}-worker-key.pem -out ${WORKER_FQDN}-worker.csr …
Run Code Online (Sandbox Code Playgroud)

coreos kubernetes kubelet

5
推荐指数
1
解决办法
8272
查看次数

在prestashop 1.7模块中基于新过滤器创建自定义产品页面

我安装了prestashop 1.7.2.4.我创建了一个带控制器的模块,并连接到ModuleRoutes钩子,以创建我自己的实际工作路线!:)

一般来说,我在prestashop模块中创建了一组新的辅助类别,我想创建一个产品页面,它只显示基于第二类别集的相关产品.

所以我在首页上创建了一个框,它将通过第二个类别集进行搜索,然后重定向到ModuleRoutes钩子捕获的正确友好URL 并正确打开一个干净的页面.

如何使用购物车和一切实际创建自定义产品页面?不知道如何从这里前进.

任何有关该问题的信息将不胜感激.

谢谢

php prestashop prestashop-1.7

5
推荐指数
0
解决办法
770
查看次数

安装的卷不会填充docker图像内容

我跑Container Linux by CoreOS 1618.0.0 (Ladybug).

rkt Version: 1.29.0

我创建了一个systemd服务文件来运行docker nagios图像:

[Unit]
Description=Nagios
Requires=network-online.target local-fs.target
After=network-online.target local-fs.target

[Install]
WantedBy=multi-user.target

[Service]
Slice=machine.slice
ExecStart=/usr/bin/rkt run --port=80-tcp:8018 --insecure-options=image --volume volume-var-log-apache2,kind=host,source=/mnt/storage/nagios/apache2-log --volume volume-usr-share-snmp-mibs,kind=host,source=/mnt/storage/nagios/snmp-mibs --volume volume-opt-nagiosgraph-etc,kind=host,source=/mnt/storage/nagios/nagiosgraph/etc --volume volume-opt-nagiosgraph-var,kind=host,source=/mnt/storage/nagios/nagiosgraph/var --volume volume-opt-nagios-libexec,kind=host,source=/mnt/storage/nagios/nagios/libexec --volume volume-opt-nagios-var,kind=host,source=/mnt/storage/nagios/etc,readOnly=false --volume volume-opt-nagios-etc,kind=host,source=/mnt/storage/nagios/var,readOnly=false --volume volume-opt-custom-nagios-plugins,kind=host,source=/mnt/storage/nagios/custom-plugins docker://jasonrivers/nagios:latest
KillMode=mixed
Restart=always
RestartSec=0
ExecStopPost=/usr/bin/rkt gc --mark-only
Run Code Online (Sandbox Code Playgroud)

现在问题是安装的parittions没有填充相关的图像文件.

通常我所做的是提取图像本身并手动复制相关文件.

问题是......还有另一个吗?

希望我错过了一个rkt参数,该参数用安装位置中docker镜像中的文件填充相关的已安装目录

有任何想法吗 ?

docker coreos rkt

5
推荐指数
0
解决办法
176
查看次数

我可以将自定义参数添加到自动报告的first_open事件中吗?

我正在编写一个使用 firebase 的 flutter 应用程序。当用户首次打开应用程序时,会报告自动的first_open事件。

有没有办法向first_open 事件添加自定义参数?

我不确定这是否可能,但我想知道是否可以禁用自动报告的first_open事件并使用自定义参数手动报告它,或者从flutter捕获first_open事件并在报告之前向其添加自定义参数。

关于这个问题的任何想法将不胜感激。

谢谢

firebase flutter firebase-analytics

5
推荐指数
1
解决办法
942
查看次数

当 Apollo GraphQL 因错误而失败时显示 MatSnackBar 消息

我有一个使用 Angular 10 和 Apollo GraphQL 的网站。

每当请求失败时,我想向用户显示错误MatSnackBar,但我不知道如何MatSnackBar向.OnError()apollo-link-error

这是我的graphql.module.ts代码:

import {NgModule} from '@angular/core';
import {APOLLO_OPTIONS} from 'apollo-angular';
import {ApolloClientOptions, ApolloLink, InMemoryCache} from '@apollo/client/core';
import {HttpLink} from 'apollo-angular/http';
import { onError } from 'apollo-link-error';

function getNewToken(): any {
  //TODO: need to implement
}

const errorLink = onError(({ graphQLErrors, networkError, operation, forward }) => {
    if (graphQLErrors) {
      for (const err of graphQLErrors) {
        switch (err.extensions?.code) {
          case 'UNAUTHENTICATED':
            // error code is set …
Run Code Online (Sandbox Code Playgroud)

apollo angular-material graphql angular

5
推荐指数
1
解决办法
521
查看次数

使用 go-cmp 正确比较和查找具有导出成员的两个结构之间的差异

我正在编写一个 Go 应用程序,我想为其创建一个测试,在该测试中,我从数据库中查询一些内容,将其插入到一个结构中,然后将该结构值与我所使用的相同类型的静态结构进行比较如果它们匹配,则测试成功,如果不匹配,我想显示差异。所以我尝试使用go-cmp包。

一般来说,我收到此错误:

panic: cannot handle unexported field at {main.fooTest}.F1.Int.neg:
    "math/big".Int
consider using a custom Comparer; if you control the implementation of type, you can also consider using an Exporter, AllowUnexported, or cmpopts.IgnoreUnexported [recovered]
Run Code Online (Sandbox Code Playgroud)

我得到这个是因为pgtype.Numeric我的结构中有

type fooTest struct {
    I1   int
    I2   *int
    S1   string
    S2   *string
    F1   pgtype.Numeric
    F2   *pgtype.Numeric
    Ff1  float64
    Ff2  *float64
    Ia1  []int
    Ia2  []*int
    Ia3  *[]int
    Sa1  []string
    Sa2  []*string
    Sa3  *[]string
    Fa1  pgtype.Float8Array
    Fa2  *pgtype.Float8Array
    Faf1 []float64
    Faf2 []*float64 …
Run Code Online (Sandbox Code Playgroud)

struct go go-cmp

5
推荐指数
1
解决办法
4732
查看次数

从 bash 的输出中删除包含大量可能性的行

我正在尝试过滤一个大 txt 文件(大约 10GB)的行,该文件只在direction列等于时才被呼叫号码的前缀2.

这是我从管道获取的文件格式(来自不同的脚本)

caller_number=34234234324, clear_number=982545345435, direction=1, ...
caller_number=83479234234, clear_number=348347384533, direction=2, ...
Run Code Online (Sandbox Code Playgroud)

因为这只是一个示例数据,但实际文件包含许多其他列,但我只想过滤clear_number基于direction所以这就足够了。

我想删除不包含前缀列表的行,因此例如在这里我将使用 grep 执行以下操作:

grep -vP 'clear_number=(?!(2207891|22034418|22074450|220201677|220240574|220272183|220722988|220723276|220751152|220774457|220794227|220799141|2202000425|2202000939|2202000967)).*direction=2'
Run Code Online (Sandbox Code Playgroud)

这很好用。唯一的问题是我得到的前缀数量有时约为 10K-50K,这是很多前缀,如果我尝试使用grep get来做到这一点grep: regular expression is too large

任何想法如何使用 Bash 命令解决它?

更新

例如..假设我有以下内容:

caller_number=34234234324,     clear_number=982545345435, direction=1
caller_number=83479234234,     clear_number=348347384533, direction=2
caller_number=2342334324,      clear_number=5555345435,   direction=1
caller_number=034082394234324, clear_number=33335345435,  direction=1
caller_number=83479234234,     clear_number=348347384533, direction=2
caller_number=83479234234,     clear_number=444447384533, direction=2
caller_number=83479234234,     clear_number=64237384533, direction=2
Run Code Online (Sandbox Code Playgroud)

我的list.txt包含:

642
3333
534234235
Run Code Online (Sandbox Code Playgroud)

所以它只会返回该行

caller_number=83479234234,     clear_number=64237384533, direction=2
Run Code Online (Sandbox Code Playgroud)

因为清晰的数字以642and direction=开头2 …

awk grep sed

5
推荐指数
3
解决办法
168
查看次数

正确理解 Angular14 中的注入 - 必须从注入上下文调用inject()

我正在尝试学习 Angular 14 中的变化,特别inject()是我能够将模块注入到函数中的功能,并且我不需要为此创建特殊服务..但我认为我弄错了。

我正在尝试创建一些静态函数来使用 package 发送小吃消息ngx-toastr,但这个包与我的问题无关。我如何正确实现显示小吃消息的功能,同时向它们注入它们需要操作的所需模块。

这是我的messages.ts文件:

import {inject} from '@angular/core';
import {ToastrService} from 'ngx-toastr';


export const snackMsgSuccess = (msg: string, title?: string) => {
  const toaster = inject(ToastrService);
  toaster.success(msg, title, {
    easeTime: 1000
  });
};


export const snackMsgInfo = (msg: string, title?: string) => {
  const toaster = inject(ToastrService);
  toaster.info(msg, title, {
    easeTime: 1000
  });
};

export const snackMsgWarn = (msg: string, title?: string) => {
  const toaster = inject(ToastrService);
  toaster.warning(msg, title, …
Run Code Online (Sandbox Code Playgroud)

inject angular angular14

5
推荐指数
1
解决办法
2万
查看次数

在 Angular-Material 15 中向 mat-tab-label 添加关闭按钮

您好,我正在使用 Angular 材料编写 Angular 15 应用程序。

我用的是新的mat-tab(不是旧的)组件在我的页面中创建选项卡,并且我希望在选项卡标题中有一个关闭按钮。

所以在我创建的组件中removeTab函数:

removeTab(index: number) {
    this.tabs.splice(index, 1);
  }
Run Code Online (Sandbox Code Playgroud)

在模板中我做了以下操作:

<mat-tab-group>
  <mat-tab *ngFor="let tab of tabs; let index = index">
    <ng-template mat-tab-label>
      {{index}}
      <button (click)="removeTab(index)" mat-icon-button><mat-icon>close</mat-icon></button>
    </ng-template>
...
Run Code Online (Sandbox Code Playgroud)

问题是,当我将鼠标悬停在关闭按钮上时,它不显示它是可单击的,当我单击它时,只需单击选项卡本身,事件不会传播到关闭按钮。

我该如何解决这样的事情?

angular-material angular mat-tab angular15

5
推荐指数
1
解决办法
2017
查看次数