Skip to content

Commit 212b668

Browse files
authored
Store metadata for packagerevisions in CRs (#3579)
1 parent 82f5a72 commit 212b668

38 files changed

+1548
-207
lines changed

porch/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ PORCH = $(BUILDDIR)/porch
152152
run-local: porch
153153
KUBECONFIG=$(KUBECONFIG) kubectl apply -f deployments/local/localconfig.yaml
154154
KUBECONFIG=$(KUBECONFIG) kubectl apply -f api/porchconfig/v1alpha1/
155+
KUBECONFIG=$(KUBECONFIG) kubectl apply -f internal/api/porchinternal/v1alpha1/
155156
$(PORCH) \
156157
--secure-port 9443 \
157158
--standalone-debug-mode \
@@ -253,3 +254,17 @@ deploy-no-sa: deployment-config-no-sa
253254

254255
.PHONY: push-and-deploy-no-sa
255256
push-and-deploy-no-sa: push-images deploy-no-sa
257+
258+
.PHONY: run-in-kind
259+
run-in-kind:
260+
IMAGE_REPO=porch-kind make build-images
261+
kind load docker-image porch-kind/porch-server:${IMAGE_TAG}
262+
kind load docker-image porch-kind/porch-controllers:${IMAGE_TAG}
263+
kind load docker-image porch-kind/porch-function-runner:${IMAGE_TAG}
264+
kind load docker-image porch-kind/porch-wrapper-server:${IMAGE_TAG}
265+
kind load docker-image porch-kind/test-git-server:${IMAGE_TAG}
266+
IMAGE_REPO=porch-kind make deployment-config
267+
kubectl apply --wait --recursive --filename ./.build/deploy
268+
kubectl rollout status deployment function-runner --namespace porch-system
269+
kubectl rollout status deployment porch-controllers --namespace porch-system
270+
kubectl rollout status deployment porch-server --namespace porch-system

porch/api/generated/clientset/versioned/fake/register.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

porch/api/generated/clientset/versioned/scheme/register.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

porch/build/Dockerfile.porch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ COPY pkg pkg
4848
COPY porch/api porch/api
4949
COPY porch/cmd porch/cmd
5050
COPY porch/pkg porch/pkg
51+
COPY porch/internal porch/internal
5152
COPY porch/controllers porch/controllers
5253
COPY porch/func porch/func
5354

porch/deployments/porch/5-rbac.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ rules:
2727
- apiGroups: ["config.porch.kpt.dev"]
2828
resources: ["repositories", "repositories/status"]
2929
verbs: ["get", "list", "watch", "create", "update", "patch"]
30+
- apiGroups: ["config.porch.kpt.dev"]
31+
resources: ["packagerevs", "packagerevs/status"]
32+
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
3033
# Needed for priority and fairness
3134
- apiGroups: ["flowcontrol.apiserver.k8s.io"]
3235
resources: ["flowschemas", "prioritylevelconfigurations"]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
---
16+
apiVersion: apiextensions.k8s.io/v1
17+
kind: CustomResourceDefinition
18+
metadata:
19+
annotations:
20+
controller-gen.kubebuilder.io/version: v0.8.0
21+
creationTimestamp: null
22+
name: packagerevs.config.porch.kpt.dev
23+
spec:
24+
group: config.porch.kpt.dev
25+
names:
26+
kind: PackageRev
27+
listKind: PackageRevList
28+
plural: packagerevs
29+
singular: packagerev
30+
scope: Namespaced
31+
versions:
32+
- name: v1alpha1
33+
schema:
34+
openAPIV3Schema:
35+
description: PackageRev
36+
properties:
37+
apiVersion:
38+
description: 'APIVersion defines the versioned schema of this representation
39+
of an object. Servers should convert recognized schemas to the latest
40+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
41+
type: string
42+
kind:
43+
description: 'Kind is a string value representing the REST resource this
44+
object represents. Servers may infer this from the endpoint the client
45+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
46+
type: string
47+
metadata:
48+
type: object
49+
spec:
50+
description: PackageRevSpec defines the desired state of PackageRev
51+
type: object
52+
status:
53+
description: PackageRevStatus defines the observed state of PackageRev
54+
type: object
55+
type: object
56+
served: true
57+
storage: true
58+
subresources:
59+
status: {}
60+
status:
61+
acceptedNames:
62+
kind: ""
63+
plural: ""
64+
conditions: []
65+
storedVersions: []
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Package v1alpha1 contains API Schema definitions for the v1alpha1 API group
16+
// +kubebuilder:object:generate=true
17+
// +groupName=config.porch.kpt.dev
18+
package v1alpha1
19+
20+
import (
21+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
"k8s.io/apimachinery/pkg/runtime"
23+
"k8s.io/apimachinery/pkg/runtime/schema"
24+
)
25+
26+
//go:generate go run sigs.k8s.io/controller-tools/cmd/[email protected] object object:headerFile="../../../../scripts/boilerplate.go.txt" crd:crdVersions=v1 output:crd:artifacts:config=. paths=./...
27+
28+
var (
29+
// GroupVersion is group version used to register these objects
30+
GroupVersion = schema.GroupVersion{Group: "config.porch.kpt.dev", Version: "v1alpha1"}
31+
32+
// We removed SchemeBuilder to keep our dependencies small
33+
34+
KindRepository = KindInfo{
35+
Resource: GroupVersion.WithResource("packagerev"),
36+
objects: []runtime.Object{&PackageRev{}, &PackageRevList{}},
37+
}
38+
39+
AllKinds = []KindInfo{KindRepository}
40+
)
41+
42+
//+kubebuilder:object:generate=false
43+
44+
// KindInfo holds type meta-information
45+
type KindInfo struct {
46+
Resource schema.GroupVersionResource
47+
objects []runtime.Object
48+
}
49+
50+
// GroupResource returns the GroupResource for the kind
51+
func (k *KindInfo) GroupResource() schema.GroupResource {
52+
return k.Resource.GroupResource()
53+
}
54+
55+
func AddToScheme(scheme *runtime.Scheme) error {
56+
for _, kind := range AllKinds {
57+
scheme.AddKnownTypes(GroupVersion, kind.objects...)
58+
}
59+
metav1.AddToGroupVersion(scheme, GroupVersion)
60+
return nil
61+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// Copyright 2022 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package v1alpha1
16+
17+
import (
18+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
19+
)
20+
21+
//+kubebuilder:object:root=true
22+
//+kubebuilder:subresource:status
23+
//+kubebuilder:resource:path=packagerevs,singular=packagerev
24+
25+
// PackageRev
26+
type PackageRev struct {
27+
metav1.TypeMeta `json:",inline"`
28+
metav1.ObjectMeta `json:"metadata,omitempty"`
29+
30+
Spec PackageRevSpec `json:"spec,omitempty"`
31+
Status PackageRevStatus `json:"status,omitempty"`
32+
}
33+
34+
// PackageRevSpec defines the desired state of PackageRev
35+
type PackageRevSpec struct {
36+
}
37+
38+
// PackageRevStatus defines the observed state of PackageRev
39+
type PackageRevStatus struct {
40+
}
41+
42+
//+kubebuilder:object:root=true
43+
44+
// PackageRevList contains a list of PackageRev
45+
type PackageRevList struct {
46+
metav1.TypeMeta `json:",inline"`
47+
metav1.ListMeta `json:"metadata,omitempty"`
48+
Items []PackageRev `json:"items"`
49+
}

porch/internal/api/porchinternal/v1alpha1/zz_generated.deepcopy.go

Lines changed: 113 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)