Skip to content

Instantly share code, notes, and snippets.

View aaron-prindle's full-sized avatar
💭
📦

Aaron Prindle aaron-prindle

💭
📦
  • Google
  • San Francisco
View GitHub Profile
@aaron-prindle
aaron-prindle / gist:5a47f8b64a5ec8cff870b5bc12590216
Created May 22, 2025 23:47
add // +k8s:minimum=600 to certificates.k8s.io/v1/CertificateSigningRequest
aprindle@aprindle-ssd ~/validation-gen [my-validation-gen_enable-csr-view]git diff
diff --git a/pkg/apis/certificates/validation/validation_test.go b/pkg/apis/certificates/validation/validation_test.go
index a54aa9adf46..25fa6a7d367 100644
--- a/pkg/apis/certificates/validation/validation_test.go
+++ b/pkg/apis/certificates/validation/validation_test.go
@@ -274,7 +274,7 @@ func TestValidateCertificateSigningRequestCreate(t *testing.T) {
},
},
errs: field.ErrorList{
- field.Invalid(specPath.Child("expirationSeconds"), int32(-1), "may not specify a duration less than 600 seconds (10 minutes)"),
@aaron-prindle
aaron-prindle / doc.go
Created April 20, 2025 03:22
+k8s:unionMember only has "1-level-deep" union context example
/*
Copyright 2024 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@aaron-prindle
aaron-prindle / rc_declarative_validation.yaml
Created March 14, 2025 17:16
rc_declarative_validation.yaml
# Test Case: valid replicas (1), feature gate enabled
# Expected: Success
apiVersion: v1
kind: ReplicationController
metadata:
name: rc-validation-1
namespace: default
spec:
replicas: 1
selector:
@aaron-prindle
aaron-prindle / gist:987095fed89996ac8a93496ce7c21b78
Created March 14, 2025 17:04
test/integration/apiserver/declarative_validation_metrics_test.go test passing @ k/k HEAD
/*
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@aaron-prindle
aaron-prindle / gist:0ef66e4c625d92d6158f8d83bafb3208
Created March 10, 2025 21:40
declarative_validation_metrics_test.go
/*
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@aaron-prindle
aaron-prindle / gist:1148eafa1b782bccbf09d79e60b75513
Created March 10, 2025 05:03
gatherDeclarativeValidationMismatches with `1:many` matching more similar to matcher.Test (modified from 1:1 initially)
// gatherDeclarativeValidationMismatches compares imperative and declarative validation errors
// using logic that more closely mirrors the approach in ErrorMatcher.Test().
//
// Specifically:
// - Imperative errors are treated as "want" errors.
// - Declarative errors are treated as "got" errors.
// - Each "want" error will match all "got" errors that satisfy matcher.Matches(...) and
// remove them from the unmatched list.
// - 0 matches is treated as an "unmatched imperative" problem.
// - More than 1 match is treated as a "multiple matched" problem (instead of picking
@aaron-prindle
aaron-prindle / gist:1bc0ef2822baa00e363ea378c531b41c
Created March 7, 2025 17:14
gatherDeclarativeValidationMismatches map "bucketing" implementation for perf optimization
/*
Copyright 2025 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@aaron-prindle
aaron-prindle / main.py
Created February 18, 2025 19:14
skaffold-issues-server/backend/main.py
import logging
import glob
import os
import textwrap
import re
import numpy as np
import pandas as pd
from flask import Flask, request, jsonify
from flask_cors import CORS
from vertexai.preview.language_models import TextEmbeddingModel, TextGenerationModel, CodeGenerationModel
@aaron-prindle
aaron-prindle / gist:bf06660a18587651427c7bb68ba01cc2
Created February 5, 2025 19:52
ReplicationController.Replicas invalid.yaml file re-prompted for no `detail` field
# Base valid ReplicationController object (must be the SAME as in valid.yaml)
apiVersion: v1
kind: ReplicationController
metadata:
name: valid-rc
spec:
replicas: 1
selector:
app: my-app
template:
@aaron-prindle
aaron-prindle / gist:c1909649867068495dc07033cd1ba6d5
Created February 5, 2025 19:47
ReplicationController.Replicas invalid.yaml
# Base valid ReplicationController object (must be the SAME as in valid.yaml)
apiVersion: v1
kind: ReplicationController
metadata:
name: valid-rc
spec:
replicas: 1
selector:
app: my-app
template: