Skip to content

Commit

Permalink
feat: bump up CRD version to v1beta1 (#664)
Browse files Browse the repository at this point in the history
  • Loading branch information
binbin-li authored Mar 9, 2023
1 parent 7cf6951 commit fd211bf
Show file tree
Hide file tree
Showing 67 changed files with 2,756 additions and 121 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ jobs:
- name: Save logs
if: ${{ always() }}
run: |
kubectl logs -n gatekeeper-system -l control-plane=controller-manager --tail=-1 > logs-externaldata-controller.json
kubectl logs -n gatekeeper-system -l control-plane=audit-controller --tail=-1 > logs-externaldata-audit.json
kubectl logs -n gatekeeper-system -l app=ratify --tail=-1 > logs-ratify-preinstall.json
kubectl logs -n gatekeeper-system -l app.kubernetes.io/name=ratify --tail=-1 > logs-ratify.json
kubectl logs -n gatekeeper-system -l control-plane=controller-manager --tail=-1 > logs-externaldata-controller-${{ matrix.KUBERNETES_VERSION }}-${{ matrix.GATEKEEPER_VERSION }}.json
kubectl logs -n gatekeeper-system -l control-plane=audit-controller --tail=-1 > logs-externaldata-audit-${{ matrix.KUBERNETES_VERSION }}-${{ matrix.GATEKEEPER_VERSION }}.json
kubectl logs -n gatekeeper-system -l app=ratify --tail=-1 > logs-ratify-preinstall-${{ matrix.KUBERNETES_VERSION }}-${{ matrix.GATEKEEPER_VERSION }}.json
kubectl logs -n gatekeeper-system -l app.kubernetes.io/name=ratify --tail=-1 > logs-ratify-${{ matrix.KUBERNETES_VERSION }}-${{ matrix.GATEKEEPER_VERSION }}.json
- name: Upload artifacts
uses: actions/upload-artifact@v3
if: ${{ always() }}
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,12 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
generate: controller-gen conversion-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. Also generate conversions between structs of different API versions.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(CONVERSION_GEN) \
--input-dirs "./api/v1beta1,./api/v1alpha1" \
--go-header-file "./hack/boilerplate.go.txt" \
--output-file-base "zz_generated.conversion"

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand Down Expand Up @@ -458,10 +462,12 @@ $(LOCALBIN):
KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
CONVERSION_GEN ?= $(LOCALBIN)/conversion-gen

## Tool Versions
KUSTOMIZE_VERSION ?= v3.8.7
CONTROLLER_TOOLS_VERSION ?= v0.9.2
CONVERSION_TOOLS_VERSION ?= v0.26.1

KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
Expand All @@ -473,3 +479,8 @@ $(KUSTOMIZE): $(LOCALBIN)
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

.PHONY: conversion-gen
conversion-gen: $(CONVERSION_GEN) ## Download conversion-gen locally if necessary.
$(CONVERSION_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/conversion-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/conversion-gen@$(CONVERSION_TOOLS_VERSION)
27 changes: 27 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,31 @@ resources:
kind: CertificateStore
path: github.com/deislabs/ratify/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: Verifier
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: Store
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
- api:
crdVersion: v1
namespaced: true
controller: true
domain: ratify.deislabs.io
group: config
kind: CertificateStore
path: github.com/deislabs/ratify/api/v1beta1
version: v1beta1
version: "3"
16 changes: 16 additions & 0 deletions api/group.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
Copyright The Ratify 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 apis
57 changes: 57 additions & 0 deletions api/unversioned/certificatestore_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
Copyright The Ratify 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.
*/

// +kubebuilder:skip
package unversioned

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

// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// CertificateStoreSpec defines the desired state of CertificateStore
type CertificateStoreSpec struct {
// Important: Run "make" to regenerate code after modifying this file

// Name of the certificate store provider
Provider string `json:"provider,omitempty"`

// Parameters of the certificate store
Parameters runtime.RawExtension `json:"parameters,omitempty"`
}

// CertificateStoreStatus defines the observed state of CertificateStore
type CertificateStoreStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

// CertificateStore is the Schema for the certificatestores API
type CertificateStore struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CertificateStoreSpec `json:"spec,omitempty"`
Status CertificateStoreStatus `json:"status,omitempty"`
}

// CertificateStoreList contains a list of CertificateStore
type CertificateStoreList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []CertificateStore `json:"items"`
}
31 changes: 31 additions & 0 deletions api/unversioned/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright The Ratify 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 unversioned

import runtime "k8s.io/apimachinery/pkg/runtime"

// PluginSource defines the fields needed to download a plugin from an OCI Artifact source
type PluginSource struct {
// Important: Run "make" to regenerate code after modifying this file

// OCI Artifact source to download the plugin from
Artifact string `json:"artifact,omitempty"`

// +kubebuilder:pruning:PreserveUnknownFields
// AuthProvider to use to authenticate to the OCI Artifact source, optional
AuthProvider runtime.RawExtension `json:"authProvider,omitempty"`
}
19 changes: 19 additions & 0 deletions api/unversioned/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
Copyright The Ratify 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 unversioned

// +kubebuilder:object:generate=true
59 changes: 59 additions & 0 deletions api/unversioned/store_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
Copyright The Ratify 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.
*/

// +kubebuilder:skip
package unversioned

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

// StoreSpec defines the desired state of Store
type StoreSpec struct {
// Important: Run "make" to regenerate code after modifying this file

// Name of the store
Name string `json:"name,omitempty"`
// Plugin path, optional
Address string `json:"address,omitempty"`
// OCI Artifact source to download the plugin from, optional
Source *PluginSource `json:"source,omitempty"`

// Parameters of the store
Parameters runtime.RawExtension `json:"parameters,omitempty"`
}

// StoreStatus defines the observed state of Store
type StoreStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

// Store is the Schema for the stores API
type Store struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec StoreSpec `json:"spec,omitempty"`
Status StoreStatus `json:"status,omitempty"`
}

// StoreList contains a list of Store
type StoreList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Store `json:"items"`
}
65 changes: 65 additions & 0 deletions api/unversioned/verifier_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
Copyright The Ratify 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.
*/

// +kubebuilder:skip
package unversioned

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

// VerifierSpec defines the desired state of Verifier
type VerifierSpec struct {
// Important: Run "make" to regenerate code after modifying this file

// Name of the verifier
Name string `json:"name,omitempty"`

// The type of artifact this verifier handles
ArtifactTypes string `json:"artifactTypes,omitempty"`

// # Optional. URL/file path
Address string `json:"address,omitempty"`

// OCI Artifact source to download the plugin from, optional
Source *PluginSource `json:"source,omitempty"`

// Parameters for this verifier
Parameters runtime.RawExtension `json:"parameters,omitempty"`
}

// VerifierStatus defines the observed state of Verifier
type VerifierStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}

// Verifier is the Schema for the verifiers API
type Verifier struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec VerifierSpec `json:"spec,omitempty"`
Status VerifierStatus `json:"status,omitempty"`
}

// VerifierList contains a list of Verifier
type VerifierList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Verifier `json:"items"`
}
Loading

0 comments on commit fd211bf

Please sign in to comment.