Skip to content

Commit

Permalink
feat(HACBS-1409): remove KCP code
Browse files Browse the repository at this point in the history
This commit removes all the code from the repository that was added
solely to enable the release-service to work on KCP.

Signed-off-by: Johnny Bieren <[email protected]>
  • Loading branch information
johnbieren committed Nov 16, 2022
1 parent 0009b28 commit 167be36
Show file tree
Hide file tree
Showing 50 changed files with 221 additions and 2,991 deletions.
21 changes: 3 additions & 18 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ jobs:
run: |
rm -f bin/kustomize bin/controller-gen
make kustomize controller-gen
- name: Install kcp tooling
run: |
git clone https://github.com/kcp-dev/kcp ~/kcp
cd ~/kcp
git checkout v0.7.1
WHAT=./cmd/kubectl-kcp make install
- name: Cache go modules
id: cache-mod
uses: actions/cache@v2
Expand Down Expand Up @@ -81,21 +75,12 @@ jobs:
with:
version: "2022.1"
install-go: false
- name: Check kcp manifests
run: |
CONTROL_PLANE=kcp make generate manifests
if [[ ! -z $(git status ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' -s) ]]
then
echo "generated kcp sources are not up to date:"
git --no-pager diff ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen'
exit 1
fi
- name: Check kubernetes manifests
- name: Check manifests
run: |
CONTROL_PLANE=kubernetes make generate manifests
make generate manifests
if [[ ! -z $(git status ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' -s) ]]
then
echo "generated k8s sources are not up to date:"
echo "generated sources are not up to date:"
git --no-pager diff ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen'
exit 1
fi
Expand Down
3 changes: 1 addition & 2 deletions .tekton/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ spec:
value: Dockerfile
- name: infra-deployment-update-script
value: |
sed -i -e 's|\(https://github.com/redhat-appstudio/release-service/config/kcp?ref=\)\(.*\)|\1{{ revision }}|' -e 's/\(newTag: \).*/\1{{ revision }}/' components/hacbs/release-service/base/kustomization.yaml
./hack/generate-apiexport-overlays.sh components/hacbs/release-service/
sed -i -e 's|\(https://github.com/redhat-appstudio/release-service/config/default?ref=\)\(.*\)|\1{{ revision }}|' -e 's/\(newTag: \).*/\1{{ revision }}/' components/release/kustomization.yaml
pipelineRef:
name: docker-build
bundle: quay.io/redhat-appstudio/hacbs-core-service-templates-bundle:latest
Expand Down
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/
COPY gitops/ gitops/
COPY kcp/ kcp/
COPY metadata/ metadata/
COPY metrics/ metrics/
COPY syncer/ syncer/
Expand All @@ -34,4 +33,4 @@ WORKDIR /
COPY --from=builder /workspace/manager .
USER 65532:65532

ENTRYPOINT ["/manager"]
ENTRYPOINT ["/manager"]
6 changes: 0 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ TAG_NAME ?= next
CERT_MANAGER_VERSION ?= v1.8.0
ENABLE_WEBHOOKS ?= true

# CONTROL_PLANE defines the type of cluster that will be used. Possible values are kubernetes (default) and kcp.
CONTROL_PLANE ?= kubernetes

# DEFAULT_PERSISTENT_VOLUME_CLAIM defines the default PVC to be used in the Release pipeline workspace declaration.
DEFAULT_RELEASE_PVC ?= release-pvc

Expand Down Expand Up @@ -101,9 +98,6 @@ help: ## Display this help.
.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./..." output:crd:artifacts:config=config/crd/bases
ifeq ($(CONTROL_PLANE), kcp)
hack/generate-kcp-api.sh ## Generate KCP APIExport and APIResourceSchemas from CRDs
endif

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/release_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package v1alpha1
import (
"time"

"github.com/redhat-appstudio/release-service/kcp"
"github.com/redhat-appstudio/release-service/metrics"
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -104,8 +103,9 @@ type ReleaseStatus struct {
ReleaseStrategy string `json:"releaseStrategy,omitempty"`

// Target references where this relesae is intended to be released to
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// +optional
Target kcp.NamespaceReference `json:"target,omitempty"`
Target string `json:"target,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
9 changes: 4 additions & 5 deletions api/v1alpha1/releaseplan_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package v1alpha1

import (
"github.com/redhat-appstudio/release-service/kcp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -27,14 +26,15 @@ type ReleasePlanSpec struct {
// +optional
DisplayName string `json:"displayName"`

// Application is a reference to the application to be released in the managed workspace
// Application is a reference to the application to be released in the managed namespace
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// +required
Application string `json:"application"`

// Target references where to send the release requests
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// +required
Target kcp.NamespaceReference `json:"target"`
Target string `json:"target"`
}

// ReleasePlanStatus defines the observed state of ReleasePlan.
Expand All @@ -45,8 +45,7 @@ type ReleasePlanStatus struct {
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Display Name",type=string,priority=1,JSONPath=`.spec.displayName`
// +kubebuilder:printcolumn:name="Application",type=string,JSONPath=`.spec.application`
// +kubebuilder:printcolumn:name="Target Namespace",type=string,priority=1,JSONPath=`.spec.target.namespace`
// +kubebuilder:printcolumn:name="Target Workspace",type=string,priority=1,JSONPath=`.spec.target.workspace`
// +kubebuilder:printcolumn:name="Target",type=string,JSONPath=`.spec.target`

// ReleasePlan is the Schema for the ReleasePlans API.
type ReleasePlan struct {
Expand Down
5 changes: 1 addition & 4 deletions api/v1alpha1/releaseplan_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package v1alpha1
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-appstudio/release-service/kcp"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"

Expand All @@ -42,9 +41,7 @@ var _ = Describe("ReleasePlan webhook", func() {
Spec: ReleasePlanSpec{
DisplayName: "Test release plan",
Application: "application",
Target: kcp.NamespaceReference{
Namespace: "default",
},
Target: "default",
},
}
})
Expand Down
9 changes: 4 additions & 5 deletions api/v1alpha1/releaseplanadmission_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ limitations under the License.
package v1alpha1

import (
"github.com/redhat-appstudio/release-service/kcp"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand All @@ -27,14 +26,15 @@ type ReleasePlanAdmissionSpec struct {
// +optional
DisplayName string `json:"displayName"`

// Application is a reference to the application to be released in the managed workspace
// Application is a reference to the application to be released in the managed namespace
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// +required
Application string `json:"application"`

// Origin references where the release requests should come from
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// +required
Origin kcp.NamespaceReference `json:"origin"`
Origin string `json:"origin"`

// Environment defines which Environment will be used to release the application
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
Expand All @@ -57,8 +57,7 @@ type ReleasePlanAdmissionStatus struct {
// +kubebuilder:printcolumn:name="Application",type=string,JSONPath=`.spec.application`
// +kubebuilder:printcolumn:name="Environment",type=string,JSONPath=`.spec.environment`
// +kubebuilder:printcolumn:name="Strategy",type=string,JSONPath=`.spec.strategy`
// +kubebuilder:printcolumn:name="Origin Namespace",type=string,priority=1,JSONPath=`.spec.origin.namespace`
// +kubebuilder:printcolumn:name="Origin Workspace",type=string,priority=1,JSONPath=`.spec.origin.workspace`
// +kubebuilder:printcolumn:name="Origin",type=string,JSONPath=`.spec.origin`

// ReleasePlanAdmission is the Schema for the ReleasePlanAdmissions API.
type ReleasePlanAdmission struct {
Expand Down
9 changes: 3 additions & 6 deletions api/v1alpha1/releaseplanadmission_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package v1alpha1
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/redhat-appstudio/release-service/kcp"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"

Expand All @@ -40,11 +39,9 @@ var _ = Describe("ReleasePlanAdmission webhook", func() {
Namespace: "default",
},
Spec: ReleasePlanAdmissionSpec{
DisplayName: "Test release plan",
Application: "application",
Origin: kcp.NamespaceReference{
Namespace: "default",
},
DisplayName: "Test release plan",
Application: "application",
Origin: "default",
Environment: "environment",
ReleaseStrategy: "strategy",
},
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/releasestrategy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type ReleaseStrategySpec struct {
// +required
Policy string `json:"policy"`

// PersistentVolumeClaim is the pvc to use in the Release pipeline workspace
// PersistentVolumeClaim is the pvc to use in the Release pipeline namespace
// +kubebuilder:validation:Pattern=^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
// +optional
PersistentVolumeClaim string `json:"persistentVolumeClaim,omitempty"`
Expand Down
3 changes: 0 additions & 3 deletions api/v1alpha1/zz_generated.deepcopy.go

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

25 changes: 5 additions & 20 deletions config/crd/bases/appstudio.redhat.com_releaseplanadmissions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,8 @@ spec:
- jsonPath: .spec.strategy
name: Strategy
type: string
- jsonPath: .spec.origin.namespace
name: Origin Namespace
priority: 1
type: string
- jsonPath: .spec.origin.workspace
name: Origin Workspace
priority: 1
- jsonPath: .spec.origin
name: Origin
type: string
name: v1alpha1
schema:
Expand All @@ -60,7 +55,7 @@ spec:
properties:
application:
description: Application is a reference to the application to be released
in the managed workspace
in the managed namespace
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
displayName:
Expand All @@ -74,18 +69,8 @@ spec:
origin:
description: Origin references where the release requests should come
from
properties:
namespace:
description: Namespace references a namespace within the cluster
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
workspace:
description: Workspace references a KCP workspace within the cluster
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])(:[a-z0-9]([-a-z0-9]*[a-z0-9]))*$
type: string
required:
- namespace
type: object
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
releaseStrategy:
description: Release Strategy defines which strategy will be used
to release the application
Expand Down
25 changes: 5 additions & 20 deletions config/crd/bases/appstudio.redhat.com_releaseplans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,8 @@ spec:
- jsonPath: .spec.application
name: Application
type: string
- jsonPath: .spec.target.namespace
name: Target Namespace
priority: 1
type: string
- jsonPath: .spec.target.workspace
name: Target Workspace
priority: 1
- jsonPath: .spec.target
name: Target
type: string
name: v1alpha1
schema:
Expand All @@ -53,26 +48,16 @@ spec:
properties:
application:
description: Application is a reference to the application to be released
in the managed workspace
in the managed namespace
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
displayName:
description: DisplayName is the long name of the ReleasePlan
type: string
target:
description: Target references where to send the release requests
properties:
namespace:
description: Namespace references a namespace within the cluster
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
workspace:
description: Workspace references a KCP workspace within the cluster
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])(:[a-z0-9]([-a-z0-9]*[a-z0-9]))*$
type: string
required:
- namespace
type: object
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
required:
- application
- target
Expand Down
18 changes: 4 additions & 14 deletions config/crd/bases/appstudio.redhat.com_releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ spec:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
type FooStatus struct{ // Represents the observations of a foo's
current state. // Known .status.conditions.type are: \"Available\",
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
Expand Down Expand Up @@ -172,18 +172,8 @@ spec:
target:
description: Target references where this relesae is intended to be
released to
properties:
namespace:
description: Namespace references a namespace within the cluster
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
workspace:
description: Workspace references a KCP workspace within the cluster
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])(:[a-z0-9]([-a-z0-9]*[a-z0-9]))*$
type: string
required:
- namespace
type: object
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ spec:
type: array
persistentVolumeClaim:
description: PersistentVolumeClaim is the pvc to use in the Release
pipeline workspace
pipeline namespace
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
type: string
pipeline:
Expand Down
Loading

0 comments on commit 167be36

Please sign in to comment.