by shigemk2

当面は技術的なことしか書かない

SHA pin 強制ポリシー

Require actions to be pinned to a full-length commit SHA: All actions must be pinned to a full-length commit SHA to be used. This includes actions from your enterprise and actions authored by GitHub. Reusable workflows can still be referenced by tag.

ということが書かれているので、sha pin強制ポリシーはreusable workflowは対象外なのでorgでshaごと指定するとかする必要がある

docs.github.com

Immutable Releases

2025年10月に GA。Organization SettingsのReleasesセクションから「All repositories」または「Selected repositories」で一括有効化でき、タグの付け替えとアセット改竄を防げる。Release attestationも自動生成される。

わかりづらいけどこの辺に案内あるけれど、ググれば比較的新しい操作方法が出てくるはず docs.github.com

docs.github.com

text.baldanders.info

kubectl rollout restart

ローリングスタート

istioサイドカーローリングスタートの例

kubectl get ns -o name -l istio-injection=enabled | while read -r ns; do
  ns=${ns#namespace/}
  kubectl get deploy -o name -n "${ns}" | while read -r deploy; do
    kubectl rollout restart "${deploy}" -n "${ns}"
    kubectl rollout status "${deploy}" --timeout=30s -n "${ns}"
  done
  kubectl get sts -o name -n "${ns}" | while read -r sts; do
    kubectl rollout restart "${sts}" -n "${ns}"
    kubectl rollout status "${sts}" --timeout=10s -n "${ns}"
  done
done

kubernetes.io

kubectl cordon/drain

  • cordon ノードに SchedulingDisabled を付けて、新しいPodがそのノードにスケジュールされないようにする。
  • drain drain ノード上の既存Podを安全に退避。内部的にはまず cordon してから、Podを1つずつ evict(退去)していく。

ノードが複数あるならforでぐるぐるしながらcordon/drainするのもあり

GKEの例

for node in $(kubectl get nodes -l cloud.google.com/gke-nodepool=EXISTING_NODE_POOL_NAME -o=name); do
  kubectl cordon "$node";
done
for node in $(kubectl get nodes -l cloud.google.com/gke-nodepool=EXISTING_NODE_POOL_NAME -o=name); do
  kubectl drain --force --ignore-daemonsets --delete-emptydir-data --grace-period=GRACEFUL_TERMINATION_SECONDS  "$node";
done

docs.cloud.google.com