forked from sigstore/cosign
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This sets up the scaffolding for the
cosigned
CRD types.
This mostly contains the boilerplate stuff like codegen and whatnot to bootstrap a Knative controller. This doesn't contain any of the meaningful type definition aspects, which will follow in a subsequent PR. Sets up for sigstore#1417 Signed-off-by: Matt Moore <mattmoor@chainguard.dev>
- Loading branch information
Showing
579 changed files
with
73,096 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# | ||
# Copyright 2022 The Sigstore 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 | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: Codegen | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: ['main', 'release-*'] | ||
pull_request: | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
verify: | ||
name: Verify codegen | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
GOPATH: ${{ github.workspace }} | ||
|
||
steps: | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.17.x | ||
|
||
- uses: actions/checkout@v2 | ||
with: | ||
path: ./src/github.com/${{ github.repository }} | ||
fetch-depth: 0 | ||
|
||
|
||
- shell: bash | ||
working-directory: ./src/github.com/${{ github.repository }} | ||
run: ./hack/update-codegen.sh | ||
|
||
- uses: chainguard-dev/actions/nodiff@4ba8d060251254fc0e65500a8d3a90013a22a8d7 # main | ||
with: | ||
path: ./src/github.com/${{ github.repository }} | ||
fixup-command: "./hack/update-codegen.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../third_party/VENDOR-LICENSE/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2022 The Sigstore 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 | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
//go:build tools | ||
// +build tools | ||
|
||
// Copyright 2022 The Sigstore 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 | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package tools | ||
|
||
// This package imports things required by this repository, to force `go mod` to see them as dependencies | ||
import ( | ||
_ "k8s.io/code-generator" | ||
_ "knative.dev/hack" | ||
|
||
// codegen: hack/generate-knative.sh | ||
_ "knative.dev/pkg/hack" | ||
|
||
_ "k8s.io/code-generator/cmd/client-gen" | ||
_ "k8s.io/code-generator/cmd/deepcopy-gen" | ||
_ "k8s.io/code-generator/cmd/defaulter-gen" | ||
_ "k8s.io/code-generator/cmd/informer-gen" | ||
_ "k8s.io/code-generator/cmd/lister-gen" | ||
_ "k8s.io/kube-openapi/cmd/openapi-gen" | ||
_ "knative.dev/pkg/codegen/cmd/injection-gen" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2022 The Sigstore 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 | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
pushd $(dirname "$0")/.. | ||
# Removed by update-deps | ||
echo === Vendoring scripts | ||
go mod vendor | ||
|
||
source $(dirname $0)/../vendor/knative.dev/hack/codegen-library.sh | ||
|
||
TMP_DIR="$(mktemp -d)" | ||
trap 'rm -rf ${TMP_DIR}' EXIT | ||
# Use the same go mod cache to speed things up. | ||
export GOMODCACHE=${GOPATH}/pkg/mod | ||
export GOPATH=${TMP_DIR} | ||
|
||
|
||
TMP_REPO_PATH="${TMP_DIR}/src/github.com/sigstore/cosign" | ||
mkdir -p "$(dirname "${TMP_REPO_PATH}")" && ln -s "${REPO_ROOT_DIR}" "${TMP_REPO_PATH}" | ||
|
||
echo "=== Update Codegen for ${MODULE_NAME}" | ||
|
||
group "Kubernetes Codegen" | ||
|
||
# generate the code with: | ||
# --output-base because this script should also be able to run inside the vendor dir of | ||
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir | ||
# instead of the $GOPATH directly. For normal projects this can be dropped. | ||
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \ | ||
github.com/sigstore/cosign/pkg/client github.com/sigstore/cosign/pkg/apis \ | ||
"cosigned:v1alpha1" \ | ||
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt | ||
|
||
group "Knative Codegen" | ||
|
||
# Knative Injection | ||
${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \ | ||
github.com/sigstore/cosign/pkg/client github.com/sigstore/cosign/pkg/apis \ | ||
"cosigned:v1alpha1" \ | ||
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt | ||
|
||
group "Update deps post-codegen" | ||
|
||
# Make sure our dependencies are up-to-date | ||
${REPO_ROOT_DIR}/hack/update-deps.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2022 The Sigstore 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 | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
pushd $(dirname "$0")/.. | ||
echo === Vendoring scripts | ||
go mod vendor | ||
|
||
source $(dirname "$0")/../vendor/knative.dev/hack/library.sh | ||
|
||
go_update_deps "$@" | ||
|
||
echo === Removing vendor/ | ||
rm -rf $REPO_ROOT_DIR/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2022 The Sigstore 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 | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package cosigned | ||
|
||
const ( | ||
// GroupName is the name of the API group. | ||
GroupName = "cosigned.sigstore.dev" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2022 The Sigstore 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 | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package v1alpha1 | ||
|
||
import "context" | ||
|
||
// SetDefaults implements apis.Defaultable | ||
func (*ClusterImagePolicy) SetDefaults(ctx context.Context) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright 2022 The Sigstore 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 | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"knative.dev/pkg/apis" | ||
"knative.dev/pkg/kmeta" | ||
) | ||
|
||
// ClusterImagePolicy defines... | ||
// | ||
// +genclient | ||
// +genclient:nonNamespaced | ||
// +genreconciler:krshapedlogic=false | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
type ClusterImagePolicy struct { | ||
metav1.TypeMeta `json:",inline"` | ||
// +optional | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// Spec holds the desired state of the ClusterImagePolicy (from the client). | ||
// +optional | ||
Spec ClusterImagePolicySpec `json:"spec,omitempty"` | ||
} | ||
|
||
var ( | ||
// Check that ClusterImagePolicy can be validated and defaulted. | ||
_ apis.Validatable = (*ClusterImagePolicy)(nil) | ||
_ apis.Defaultable = (*ClusterImagePolicy)(nil) | ||
_ kmeta.OwnerRefable = (*ClusterImagePolicy)(nil) | ||
) | ||
|
||
// GetGroupVersionKind implements kmeta.OwnerRefable | ||
func (*ClusterImagePolicy) GetGroupVersionKind() schema.GroupVersionKind { | ||
return SchemeGroupVersion.WithKind("ClusterImagePolicy") | ||
} | ||
|
||
// ClusterImagePolicySpec holds the desired state of the ClusterImagePolicy (from the client). | ||
type ClusterImagePolicySpec struct { | ||
// TODO(#1417): Flesh out the specification from the API spec. | ||
} | ||
|
||
// ClusterImagePolicyList is a list of ClusterImagePolicy resources | ||
// | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
type ClusterImagePolicyList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata"` | ||
|
||
Items []ClusterImagePolicy `json:"items"` | ||
} |
Oops, something went wrong.