-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(api): combine Cryostat and ClusterCryostat CRDs (#721)
* feat(api): combine Cryostat and ClusterCryostat CRDs * Make webhook internal, add tests * Add v1beta2 apiVersion with conversion webhook * Add conversion webhook tests * Run multi-namespace tests for Cryostat CRD * Formatting, generate bundle * Enable conversion webhooks * add conversion webhook to bundle, fixes * Remove log message * Update spec descriptors patch and initialization resource --------- Signed-off-by: Elliott Baron <[email protected]>
- Loading branch information
Showing
57 changed files
with
25,033 additions
and
397 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
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 @@ | ||
// Copyright The Cryostat 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 v1beta1 | ||
|
||
import ( | ||
operatorv1beta2 "github.com/cryostatio/cryostat-operator/api/v1beta2" | ||
"sigs.k8s.io/controller-runtime/pkg/conversion" | ||
) | ||
|
||
// TODO Remove this file with ClusterCryostat CRD | ||
|
||
var _ conversion.Convertible = &ClusterCryostat{} | ||
|
||
// ConvertTo converts this ClusterCryostat to the Hub version (v1beta2). | ||
func (src *ClusterCryostat) ConvertTo(dstRaw conversion.Hub) error { | ||
dst := dstRaw.(*operatorv1beta2.ClusterCryostat) | ||
|
||
// Copy ObjectMeta as-is | ||
dst.ObjectMeta = src.ObjectMeta | ||
|
||
// Convert existing Spec fields | ||
convertSpecTo(&src.Spec.CryostatSpec, &dst.Spec.CryostatSpec) | ||
dst.Spec.InstallNamespace = src.Spec.InstallNamespace | ||
dst.Spec.TargetNamespaces = src.Spec.TargetNamespaces | ||
|
||
// Convert existing Status fields | ||
convertStatusTo(&src.Status.CryostatStatus, &dst.Status.CryostatStatus) | ||
dst.Status.TargetNamespaces = src.Spec.TargetNamespaces | ||
|
||
return nil | ||
} | ||
|
||
// ConvertFrom converts from the Hub version (v1beta2) to this version. | ||
func (dst *ClusterCryostat) ConvertFrom(srcRaw conversion.Hub) error { | ||
src := srcRaw.(*operatorv1beta2.ClusterCryostat) | ||
|
||
// Copy ObjectMeta as-is | ||
dst.ObjectMeta = src.ObjectMeta | ||
|
||
// Convert existing Spec fields | ||
convertSpecFrom(&src.Spec.CryostatSpec, &dst.Spec.CryostatSpec) | ||
dst.Spec.InstallNamespace = src.Spec.InstallNamespace | ||
dst.Spec.TargetNamespaces = src.Spec.TargetNamespaces | ||
|
||
// Convert existing Status fields | ||
convertStatusFrom(&src.Status.CryostatStatus, &dst.Status.CryostatStatus) | ||
dst.Status.TargetNamespaces = src.Spec.TargetNamespaces | ||
|
||
return nil | ||
} |
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
Oops, something went wrong.