829 Matching Annotations
  1. Nov 2020
    1. 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

      这俩是特殊的

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

    2. 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”.

      ?

    3. 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

    1. 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 之后执行,很合理

    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. 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. Transformers: Modify Resource Config by adding, updating or deleting fields

      更新具体的 fields

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

      • Generator - 操作文件
      • Transformer - 操作字段
    2. Generators: Provide Resource Config to Kustomize

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

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

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

    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. Virtual service hosts don’t actually have to be part of the Istio service registry, they are simply virtual destinations.

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

    3. 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 的功能,像 灰度发布之类的就没有简单的办法了

    4. 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
      • 灰度发布
  2. Oct 2020
    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. 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. Peer authentication policies specify the mutual TLS mode Istio enforces on target workloads

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

    2. 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.

      不是一个意思么。。。

    3. 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.

      没太懂

    4. peer and request authentication policies

      authn policies 分两种:

      • peer authn policy - PeerAuthentication
      • request authn policy - RequestAuthentication
    5. exchange credentials with their identity information

      credentials 这儿是指的证书

      那 identity 呢?是 service account

      所以证书里有 service account 信息

    1. 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. the same goal could have been achieved with two different AuthorizationPolicy entries for the two different rules

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

    1. 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.

      ?

    Tags

    Annotators

    URL

    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. 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

    3. bounded producer/consumer problem

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

      • lock, 保护 bounded queue
      • condition variables:
        • producer: queue is not full
        • consumer: queue is not empty
    4. 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 多的一点涵义

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

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

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

      • mutex (lock)
      • condition variables
    6. 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. It makes decisions by evaluating the incoming object against all defined ResourceQuota.Status.Hard resource limits in the request namespace.

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

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

      这个也是我们想要的啊

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

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

    1. 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

    2. 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
    3. 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. 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 上获取的东西