Skip to content

Commit

Permalink
Use k8s 1.29 client libs (#43)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <tamal@appscode.com>
  • Loading branch information
tamalsaha committed Dec 26, 2023
1 parent 06618b9 commit b98cecb
Show file tree
Hide file tree
Showing 2,866 changed files with 340,753 additions and 86,063 deletions.
2 changes: 1 addition & 1 deletion .config/api-rules/violation_exceptions.list
Expand Up @@ -100,6 +100,7 @@ API rule violation: list_type_missing,k8s.io/api/core/v1,ServiceSpec,LoadBalance
API rule violation: list_type_missing,k8s.io/api/core/v1,TopologySelectorLabelRequirement,Values
API rule violation: list_type_missing,k8s.io/api/core/v1,TopologySelectorTerm,MatchLabelExpressions
API rule violation: list_type_missing,k8s.io/api/networking/v1,IPBlock,Except
API rule violation: list_type_missing,k8s.io/api/networking/v1,IngressLoadBalancerStatus,Ingress
API rule violation: list_type_missing,k8s.io/api/networking/v1,NetworkPolicyEgressRule,Ports
API rule violation: list_type_missing,k8s.io/api/networking/v1,NetworkPolicyEgressRule,To
API rule violation: list_type_missing,k8s.io/api/networking/v1,NetworkPolicyIngressRule,From
Expand Down Expand Up @@ -206,7 +207,6 @@ API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,StatusCause
API rule violation: names_match,k8s.io/apimachinery/pkg/apis/meta/v1,Time,Time
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentEncoding
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,ContentType
API rule violation: names_match,k8s.io/apimachinery/pkg/runtime,Unknown,Raw
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,IntVal
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,StrVal
API rule violation: names_match,k8s.io/apimachinery/pkg/util/intstr,IntOrString,Type
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -13,10 +13,10 @@ jobs:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: '1.20'
go-version: '1.21'
id: go

- name: Check out code into the Go module directory
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-crds.yaml
Expand Up @@ -10,10 +10,10 @@ jobs:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: '1.20'
go-version: '1.21'
id: go

- uses: actions/checkout@v1
Expand Down
8 changes: 3 additions & 5 deletions Makefile
Expand Up @@ -21,7 +21,7 @@ COMPRESS ?= no

# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true"
CODE_GENERATOR_IMAGE ?= ghcr.io/appscode/gengo:release-1.25
CODE_GENERATOR_IMAGE ?= ghcr.io/appscode/gengo:release-1.29
API_GROUPS ?= voyager:v1beta1 voyager:v1

# Where to push the docker image.
Expand Down Expand Up @@ -71,7 +71,7 @@ TAG := $(VERSION)_$(OS)_$(ARCH)
TAG_PROD := $(TAG)
TAG_DBG := $(VERSION)-dbg_$(OS)_$(ARCH)

GO_VERSION ?= 1.20
GO_VERSION ?= 1.21
BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION)
CHART_TEST_IMAGE ?= quay.io/helmpack/chart-testing:v3.5.1

Expand Down Expand Up @@ -137,22 +137,20 @@ version:
.PHONY: clientset
clientset:
@docker run --rm \
-u $$(id -u):$$(id -g) \
-v /tmp:/.cache \
-v $$(pwd):$(DOCKER_REPO_ROOT) \
-w $(DOCKER_REPO_ROOT) \
--env HTTP_PROXY=$(HTTP_PROXY) \
--env HTTPS_PROXY=$(HTTPS_PROXY) \
$(CODE_GENERATOR_IMAGE) \
/go/src/k8s.io/code-generator/generate-groups.sh \
all \
client,deepcopy,informer,lister \
$(GO_PKG)/$(REPO)/client \
$(GO_PKG)/$(REPO)/apis \
"$(API_GROUPS)" \
--go-header-file "./hack/license/go.txt"
rm -rf ./apis/voyager/v1beta1/zz_generated.conversion.go
@docker run --rm \
-u $$(id -u):$$(id -g) \
-v /tmp:/.cache \
-v $$(pwd):$(DOCKER_REPO_ROOT) \
-w $(DOCKER_REPO_ROOT) \
Expand Down
4 changes: 2 additions & 2 deletions apis/voyager/v1/dns_resolver.go
Expand Up @@ -47,8 +47,8 @@ const (
)

var (
DNSResolverHoldKeys = sets.NewString("nx", "other", "refused", "timeout", "valid", "obsolete")
DNSResolverTimeoutKeys = sets.NewString("resolve", "retry")
DNSResolverHoldKeys = sets.New[string]("nx", "other", "refused", "timeout", "valid", "obsolete")
DNSResolverTimeoutKeys = sets.New[string]("resolve", "retry")
)

type DNSResolver struct {
Expand Down
1,422 changes: 1,113 additions & 309 deletions apis/voyager/v1/openapi_generated.go

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions apis/voyager/v1/validator.go
Expand Up @@ -61,7 +61,7 @@ func (r Ingress) IsValid(cloudProvider string) error {
}

timeouts, _ := get[DefaultsTimeOut](r.Annotations)
if err := checkMapKeys(timeouts.(map[string]string), sets.NewString(timeoutKeys...)); err != nil {
if err := checkMapKeys(timeouts.(map[string]string), sets.New[string](timeoutKeys...)); err != nil {
return errors.Errorf("invalid value for annotation %s. Reason: %s", DefaultsTimeOut, err)
}

Expand Down Expand Up @@ -445,10 +445,10 @@ func checkExclusiveWildcard(address string, port int, defined map[string]*addres
return nil
}

func checkMapKeys(m map[string]string, keys sets.String) error {
diff := sets.StringKeySet(m).Difference(keys)
func checkMapKeys(m map[string]string, keys sets.Set[string]) error {
diff := sets.KeySet[string](m).Difference(keys)
if diff.Len() != 0 {
return errors.Errorf("invalid keys: %v", diff.List())
return errors.Errorf("invalid keys: %v", diff.UnsortedList())
}
return nil
}

0 comments on commit b98cecb

Please sign in to comment.