Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add config type boilerplate #6

Merged
merged 2 commits into from
Nov 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ repos:
name: License headers - Go
stages: [commit]
files: "(.*\\.go|go.mod)$"
exclude: zz_generated
args:
- --license-filepath
- header.txt
Expand Down
9 changes: 6 additions & 3 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
ginkgo 2.4.0
ginkgo 2.5.0
golang 1.19.3
golangci-lint 1.50.1
goreleaser 1.12.3
golang 1.19.2
helm 3.10.1
kube-controller-tools 0.10.0
kubebuilder 3.7.0
pre-commit 2.20.0
upx 3.96
upx 4.0.0
shfmt 3.5.1
kube-code-generator 0.25.3
16 changes: 16 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
domain: kubeletimagecredentialprovidershim.d2iq.com
layout:
- go.kubebuilder.io/v3
multigroup: true
projectName: project
repo: github.com/mesosphere/kubelet-image-credential-provider-shim
resources:
- api:
crdVersion: v1
namespaced: true
domain: kubeletimagecredentialprovidershim.d2iq.com
group: config
kind: KubeletImageCredentialProviderShimConfig
path: github.com/mesosphere/kubelet-image-credential-provider-shim/apis/config/v1alpha1
version: v1alpha1
version: "3"
26 changes: 26 additions & 0 deletions apis/config/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2022 D2iQ, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

// Package v1alpha1 contains API Schema definitions for the config v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=config.kubeletimagecredentialprovidershim.d2iq.com
package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects.
GroupVersion = schema.GroupVersion{
Group: "config.kubeletimagecredentialprovidershim.d2iq.com",
Version: "v1alpha1",
}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2022 D2iQ, Inc. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

//go:generate controller-gen object paths=.
//go:generate bash -ec "cd ../../.. && defaulter-gen -h hack/boilerplate.go.txt -i ./apis/config/v1alpha1 -o ."

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

//nolint:gochecknoinits // init is the convention for registering API types.
func init() {
SchemeBuilder.Register(&KubeletImageCredentialProviderShimConfig{})
}

// +kubebuilder:object:root=true
type KubeletImageCredentialProviderShimConfig struct {
//nolint:revive // inline is not an official json struct tag value, but is required bu Kubernetes.
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
}
34 changes: 34 additions & 0 deletions apis/config/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions apis/config/v1alpha1/zz_generated.defaults.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 19 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@ require (
github.com/stretchr/testify v1.8.1
go.etcd.io/etcd/client/pkg/v3 v3.5.5
k8s.io/apimachinery v0.25.3
k8s.io/client-go v0.25.3
k8s.io/kubelet v0.25.3
sigs.k8s.io/controller-runtime v0.13.1
)

require (
cloud.google.com/go v0.97.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
github.com/Azure/go-autorest/autorest v0.11.27 // indirect
github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect
github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
github.com/Azure/go-autorest/logger v0.2.1 // indirect
github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -29,16 +40,22 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
go.uber.org/zap v1.21.0 // indirect
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
golang.org/x/sys v0.0.0-20220913175220-63ea55921009 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.70.1 // indirect
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.2.0 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading