828 Matching Annotations
  1. Nov 2020
    1. pass its state down as props to its child components

      props down

    2. This is why state is often called local or encapsulated

      state is private to component that owns it

    3. the props at the time the update is applied as the second argument:

      相当于对应这个 state 时的 props?

    4. While this.props is set up by React itself and this.state has a special meaning, you are free to add additional fields to the class manually if you need to store something that doesn’t participate in the data flow (like a timer ID).

      this 里

      • props
      • state

      这俩是特殊的

      而其他的字段可以随意加?

    5. When React sees an element representing a user-defined component, it passes JSX attributes and children to this component as a single object. We call this object “props”.

      ?

    6. This function is a valid React component because it accepts a single “props” (which stands for properties) object argument with data and returns a React element

      (properties) => react element

    7. render a React element into a root DOM node

      将一个 React Component 在一个 root DOM node 中渲染

    8. {name}

      variable name in braces: {name}

    9. via https://reactjs.org/docs/getting-started.html#learn-react

      as they called: learn concepts step by step

    1. 读了一遍收获不大,读懂的内容读之前已经懂的,不懂的看了还是不大懂,等日后再来吧

    2. act before your cache has filled

      什么叫(或者说怎么判断) : cache has filled?

    3. You may see other mechanisms like reflectors and deltafifos driving controllers. Those were older mechanisms that we later used to build the SharedInformers. You should avoid using them in new controllers.

      so reflectors and DeltaFIFOs are used to build the SharedInformers

      as this pic showed:

      client-go https://github.com/kubernetes/sample-controller/blob/master/docs/images/client-go-controller-interaction.jpeg

    1. 这个问题值得看看,

      • metadata 里,resourceVersion 和 generation 的区别
      • 这两个字段分别什么时机会 +1
      • 貌似所有object 都有 resourceVersion 字段,但是只有部分有 generation
    1. In Rancher, an administrator applies a resource quota to the Project, and then the quota propagates to each Namespace. Kubernetes then enforces the admin’s limits using the native version of resource quotas.

      看起来也是利用了原生的 resourceQuota,不知道如何实现的

    1. provides constraints that limit aggregate resource consumption per namespace

      ResourceQuota is namespaced

      所以自然的,它不支持对 cluster 级别资源的限制

    1. If a request with the dry-run attribute would trigger a call to this webhook, the request will instead fail, and the webhook will not be called.

      啥意思,是说如果标记为 Some,dry-run 时就不会被调用么?

    2. To validate an object after all mutations are guaranteed complete, use a validating admission webhook instead (recommended for webhooks with side-effects).

      言下之意是 validating admission webhook 会在所有 mutation 之后执行,很合理

    3. may be reordered

      reordered by who?

      auto reordered by api-server?

    1. BestEffort, the Containers in the Pod must not have any memory or CPU limits or requests.

      BestEffort:

      • no memory or CPU limits or requests

      啥都没有

      和 Guaranteed 刚好两个极端,处于中间都就是 Burstable

    2. If a Container specifies its own memory limit, but does not specify a memory request, Kubernetes automatically assigns a memory request that matches the limit. Similarly,

      container 只配置了 limit 的时候,k8s 会自动给他加上 request

      该 request == limit

    1. The .metadata.generation value is incremented for all changes, except for changes to .metadata or .status.

      status 的更新不会 inc .metadata.generation

      metadata 也不会,这个有点儿意外

    2. PUT/POST/PATCH requests to the custom resource ignore changes to the status stanza.

      对 custom resource 的 PUT/POST/PATCH 等更新操作,是忽略 status 的

    3. Custom resources are validated via OpenAPI v3 schemas and you can add additional validation using admission webhooks.

      two ways of validation

      • OpenAPI v3 schemas
      • admission webhooks
    1. Administrators might have sets of certificates that they provide to individual users

      这是什么意思?

    1. If a Container specifies its own memory limit, but does not specify a memory request, Kubernetes automatically assigns a memory request that matches the limit. Similarly, if a Container specifies its own CPU limit, but does not specify a CPU request, Kubernetes automatically assigns a CPU request that matches the limit.

      配置了 limit,但是没配置 resource 的时候,会自动填补上 resource (== limit)

    1. CCM

      CCM = Cumulative Clean Mass = 吃尘量

    2. 单位时间里能净化多少体积的空气

      CADR = Clean Air Delivery Rate = 每小时清洁空气立方米

    1. This marker is what allows new schemas to be added here automatically when a new API is added to the project.

      ?

    1. Transformers: Modify Resource Config by adding, updating or deleting fields

      更新具体的 fields

      Generator 和 Transformer 的区别可以简单的说是:

      • Generator - 操作文件
      • Transformer - 操作字段
    2. Type

      如上所提及的,下面的 types 就三种:

      • Generator
      • Transformer
      • Meta
    3. Meta: Configure behavior of Generators and Transformers

      配置 Generator 和 Transformer 本身

    4. Generators: Provide Resource Config to Kustomize

      给 kustomize 提供配置信息的,比如如下配置里的 resourcesconfigMapGenerator

      commonLabels:
          app: myWord
      resources:
          - dp.yml
          - svc.yml
      configMapGenerator:
          - name: wordpress-map
            files:
                - env.startup.txt
      

      简单说就是告诉文件在哪儿

    5. will have it updated

      to what?

    6. Reference for Kustomization.yaml

    1. simple & clear intro on WTF is kustomize


      这篇我居然读过。。。完全当新文档看的。。

    1. In particular, you use destination rules to specify named service subsets, such as grouping all a given service’s instances by version

      给我的印象是 Destination Rules 就是给 service 分 version 用的

    2. RANDOM

      效果是每个 subset 里,默认使用 RANDOM 的负载均衡策略

    3. host: my-svc

      这个 host 又怎么说。。

      对应 k8s 的 service ?

    4. host: reviews

      the hostname is a k8s service

    5. Virtual service hosts don’t actually have to be part of the Istio service registry, they are simply virtual destinations.

      怎么理解? host 可以随便写?

    6. hosts

      这儿的 hosts 对应什么, k8s 的 service?

    7. 看起来似乎 virtual service 主要的功能就是能给 service 分 version 访问

    8. Without virtual services, Envoy distributes traffic using round-robin load balancing between all service instances, as described in the introduction.

      没有 Virtual Service 的话,用 k8s 的 service 只能有 round robin 的功能,像 灰度发布之类的就没有简单的办法了

    9. With a virtual service, you can specify traffic behavior for one or more hostnames.

      这个 hostname 是指?

    10. Specifying service subsets and other destination-specific policies in a separate object lets you reuse these cleanly between virtual services.

      怎么 reuse ?

    1. Although the name for this technique might not be familiar [1], the practice of canary releasing has been adopted for some time. Sometimes it is referred to as a phased rollout or an incremental rollout.

      好吧,几个名字一个意思

      • canary release
      • staged rollout
      • phased rollout
      • incremental rollout
      • 灰度发布
    1. 不错的总结

      • 蓝绿 - 流量切换 standby
      • 滚动 - 现有集群中逐渐升级
      • 灰度/金丝雀 - 新老并存,逐渐切换
  2. Oct 2020
    1. 1秒(s) =1000毫秒(ms) 1毫秒(ms)=1000微秒 (us) 1微秒(us)=1000纳秒 (ns)

      以 1k 为单位递进

    1. consider the stack on which the operating system must run when it receives the system call. Should this be a different stack from the one that the application uses, or could it use the same stack as the application program? Assume that the application program is blocked while the system call runs.

      没看懂

    1. The term "x86" came into being because the names of several successors to Intel's 8086 processor end in "86", including the 80186, 80286, 80386 and 80486 processors.

      好几个使用了这个指令集的 CPU 的型号都以 86 结尾,所以将此指令集以 x86 命名

    1. FAQ on Istio Security

      感觉有效信息挺多

    1. -n istio-system

      this PeerAuthn policy is installed in root istio ns: istio-system

    1. curl --cacert ${CACERT} --header "Authorization: Bearer ${TOKEN}" -X GET ${APISERVER}/api

      directly curl API server

      展开一下就是:

      curl --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt \
      --header "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
      https://kubernetes.default/api
      
    1. 这篇对网络隔离可能有帮助

      key words:

      tenant, network isolation, api-server, kubelet, etcd

    1. The "aud" (audience) claim identifies the recipients that the JWT is intended for.

      貌似可以理解成使用(消费)这个 JWT 的 app 的名字

    1. rules:

      two rules:

      • one with from only
      • another with to only

      first requires JWT on all paths, second allow request to /healthz with no requirement

      thus: require JWT on all paths, except /healthz

    1. JSON Web Key Set

      The JSON Web Key Set (JWKS) is a set of keys containing the public keys used to verify any JSON Web Token (JWT) issued by the authorization server and signed using the RS256 signing algorithm.

      https://auth0.com/docs/tokens/json-web-tokens/json-web-key-sets

    2. Peer authentication policies specify the mutual TLS mode Istio enforces on target workloads

      特么就一个作用啊,就是启动 mTLS?

    3. The following modes are supported

      3 modes of mutual TLS supported for peer authn policies:

      • strict
      • permissive
      • disable
    4. When you configure multiple mesh- or namespace-wide peer authentication policies for the same mesh or namespace, Istio ignores the newer policies. When more than one workload-specific peer authentication policy matches, Istio picks the oldest one.

      peer authn policy:

      • 如果 mesh 或 ns 级别的 peer authn policy 有多条,用最老的
      • workload 级别的有多条,用最老的

      特么

      ignores the newer policies.

      Istio picks the oldest one.

      不是一个意思么。。。

    5. authentication policies apply to requests that a service receives. To specify client-side authentication rules in mutual TLS, you need to specify the TLSSettings in the DestinationRule.

      没太懂

    6. peer and request authentication policies

      authn policies 分两种:

      • peer authn policy - PeerAuthentication
      • request authn policy - RequestAuthentication
    7. Istio stores mesh-scope policies in the root namespace

      默认情况下,安装在 istio-system 里的 authn policy 是全局配置

    8. The control plane watches the apiserver, generates the secure naming mappings

      根据什么信息来生成 secure naming mappings?

    9. Identity Provision

      nice pic

    10. Istio agents

      这是个之前没听说过的 Istio 新组件

    11. exchange credentials with their identity information

      credentials 这儿是指的证书

      那 identity 呢?是 service account

      所以证书里有 service account 信息

    12. Kubernetes: Kubernetes service account

      好吧,k8s 上,identity 就是 service account

    13. and reject any clients who failed to pay their bill from accessing the workloads

      有点儿我们 saas 收费的意思了

    14. authentication, authorization and audit (AAA) tools

      AAA:

      • authn
      • authz
      • audit
    1. nice write up on mTLS

    2. Verifying Alice is actually Alice is a much less common operation, but is generally called “Mutual TLS authentication” as both Alice and Bob are verified.

      好吧,我懂了,mTLS 之所以比较少听到,就是应为它的场景更少一些

      合理了

    1. Istio 和 k8s 中的访问控制 access control

      • istio - AuthorizationPolicy
      • k8s - NetworkPolicy
    2. principal

      这个 principal 是个什么鬼东西?


      principal:

      • 校长
      • 主要的
    3. the same goal could have been achieved with two different AuthorizationPolicy entries for the two different rules

      不同 AuthorizationPolicy 之间的关系也是:或, 有其一通过即通过

    4. Istio has a data plane, and a control plane.

      nice pic showing data plane & control plane

    1. Service-level

      这个 service 貌似就是 k8s 的 service

    1. via david, multi-tenancy, network isolation

    1. Single Risk Exposure

      how?

    2. But what about impermanent loss, i.e. how does PMM ensure that liquidity providers get what they deposited when they withdraw their tokens? The answer is by encouraging arbitrage trading.

      ?

    1. 貌似是另一个 k8s 的 dashboard,页面全但是感觉使用比较复杂

      可以关注

    Tags

    Annotators

    URL

    1. via david, multi-tenancy

      Cloud native networking and network security

    1. 这个个人博客看起来不错啊,k8s 相关

    1. An admission controller is a piece of code that intercepts requests to the Kubernetes API server prior to persistence of the object, but after the request is authenticated and authorized.

      An admission controller:

      • a piece of code
      • that intercepts requests to k8s API server

      timing:

      • before persistence of the object
      • but after the request is authned & authzed
    1. In addition to compiled-in admission plugins, admission plugins can be developed as extensions and run as webhooks configured at runtime.

      Admission Controller 是 k8s 官方的代码,而用户可以通过 Admission Webhook 的方式,添加一些自己的逻辑,来修改和校验到 k8s api server 的请求

    1. 可算明白了 Monitor 和 Lock 的区别,Monitor 是一个完整的结构,其构成元素里包括 Lock,还包括若干 Condition Variables (条件变量)

      type Monitor struct {
        Lock Lock
        EntranceQueue []Thread
      
        CVs []ConditionVariable
      }
      
      type ConditionVariable struct {
        WaitingQueue []Thread
      }
      

      java monitor

      想象 Monitor 是一个房子,所有强锁的线程先进这个房子,如果 Lock 已被占,则在这个入口等着,否则拿着锁进入正厅,执行业务逻辑

      如果不需等待某些条件,则直接执行,最后退出,并释放锁,让其他线程进入,否则

      在 while 循环中等待条件变量成立,同时释放锁,进入等待室,等待其他入口处的线程进入正厅后,可能执行的 nofity,被唤醒后,去入口处,重新等待获锁,之后检查条件时候确实成立(在 while(P)中),如果否,则再次 wait,如果真,则可执行业务逻辑,有需要的话退出前也执行 nofity(), 退出释放锁,结束

      总结来说,monitor:一把 lock,两个 waiting queue

      ps. 这个图也不错

    2. wikipedia 的(有些)文章质量真高啊

    3. A Java style monitor

      nice and clean pic showing Java style monitor:

      • 1 implicit condition variable
    4. The operations notify c and notify all c are treated as "hints" that P may be true for some waiting thread.

      notify & notifyAll is a hint that condition might be true

    5. condition variable c

      这儿 c 是一个代称,指代 condition variable,对应右图中的 a, b

    6. The implementation given here is incorrect

      啊?

    7. Sample Mesa-monitor implementation with Test-and-Set

      有点儿太底层,已经不太看得懂了,只明白个大概

    8. signal(queueEmptyCV); -- OR -- notifyAll(queueEmptyCV);

      wake up consumers waiting because of empty queue

    9. bounded producer/consumer problem

      这个 bounded producer/consumer problem 特别适合用来帮助理解 monitor

      • lock, 保护 bounded queue
      • condition variables:
        • producer: queue is not full
        • consumer: queue is not empty
    10. signal c

      notify() in Java

    11. broadcast c

      notifyAll() in Java

    12. Monitors provide a mechanism for threads to temporarily give up exclusive access in order to wait for some condition to be met, before regaining exclusive access and resuming their task.

      所以除了 lock 之外,monitor 还有一个功能就是可以让线程放弃🔒,直到它需要的条件成立,再才重新获得🔒

      这是 monitor 比 lock 多的一点涵义

    13. A monitor consists of a mutex (lock) object and condition variables.

      这儿看出点儿 monitor 和 lock 的区别了

      monitor 是一个结构,包括两个元素:

      • mutex (lock)
      • condition variables
    14. In concurrent programming (also known as parallel programming), a monitor is a synchronization construct that allows threads to have both mutual exclusion and the ability to wait (block) for a certain condition to become false.

      monitor, two feature:

      • mutex
      • the ability to wait for a certain condition to become true
    1. In retrospect, this design decision was probably a bad one: not only can it be confusing, but it forces JVM implementors to make tradeoffs between object size and locking performance.

      哈哈

    1. A mutual exclusion (mutex) is a program object that prevents simultaneous access to a shared resource.

      才发现 mutex 原来是 MUTual EXclusion 的缩写

      • mutual: 相互
      • exclusion: 排斥
      • mutual exclusion - mutex - 相互排斥 - 互斥
    1. intentionally

      ?for what

    2. It makes decisions by evaluating the incoming object against all defined ResourceQuota.Status.Hard resource limits in the request namespace.

      看起来官方的 ResourceQuota 也是用的 Admission Webhook 来实现的

    1. 信息量几乎为零的一篇文章。。。

    2. Rancher goes beyond Namespaces by including a Project resource that helps ease the administrative burden of clusters

      这个也是我们想要的啊

    3. “If launching another resource in the Namespace would exceed the quota, then nothing else gets to launch,” Goins noted.

      引用自己公司的文章的做法,就一个字:骚

    1. Configurations for local ephemeral storage

      没看懂

    2. The amount of resources available to Pods is less than the node capacity, because system daemons use a portion of the available resources.

      Allocatable < Capacity

    3. more than 1120m CPUs or 6.23Gi of memory, it will not fit on the node

      how come the numbers?

      1120m CPUs or 6.23Gi of memory

      • CPU, allocatable - allocated = 1800m - 680m = 1120m
      • memory, allocatable - allocated = 7474992Ki - 920Mi = (7474992/1024.0 - 920) / 1024 = 6.23Gi
    4. CPU and memory are collectively referred to as compute resources, or just resources. Compute resources are measurable quantities that can be requested, allocated, and consumed. They are distinct from API resources. API resources, such as Pods and Services are objects that can be read and modified through the Kubernetes API server.

      两种 resource,不一样的东西

      • Compute Resources, or simply resources, are CPU & memory
      • API resources, e.g. Pods, Services
    1. 对于许多应用场合,互斥操作是不够用的。线程可能需要等待某个条件 P {\displaystyle P} 为真,才能继续执行。

      条件变量

    1. 算是释疑了,monitor 就是 lock, lock 就是 monitor

      甚至可以称为: monitor lock

    2. intrinsic lock or monitor lock. (The API specification often refers to this entity simply as a "monitor."

      所以这些名词是一个意思

      • intrinsic lock
      • monitor lock
      • monitor

      所以,lock 和 monitor 是一个东西,就是锁,就是需要排他的访问一个共享资源的时候,需要从 object 上获取的东西

    1. When a thread releases the lock, a happens-before relationship is established between that action and any subsequent acquisition of the same lock.

      happens-brefore