Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync upstream release 1.17 #149

Merged
merged 16 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

PROJECT upbound/crossplane

ARG --global GO_VERSION=1.22.3
ARG --global GO_VERSION=1.22.8

# reviewable checks that a branch is ready for review. Run it before opening a
# pull request. It will catch a lot of the things our CI workflow will catch.
Expand Down Expand Up @@ -62,7 +62,7 @@
WITH DOCKER --load crossplane-e2e/crossplane:latest=(+image --CROSSPLANE_VERSION=v0.0.0-e2e)
# TODO(negz:) Set GITHUB_ACTIONS=true and use RUN --raw-output when
# https://github.com/earthly/earthly/issues/4143 is fixed.
RUN gotestsum --no-color=false --format testname --junitfile e2e-tests.xml --raw-command go tool test2json -t -p E2E ./e2e -test.v ${FLAGS}

Check failure on line 65 in Earthfile

View workflow job for this annotation

GitHub Actions / e2e-tests (base)

Error

The command WITH DOCKER RUN --privileged gotestsum --no-color=false --format testname --junitfile e2e-tests.xml --raw-command go tool test2json -t -p E2E ./e2e -test.v ${FLAGS} did not complete successfully. Exit code 1

Check failure on line 65 in Earthfile

View workflow job for this annotation

GitHub Actions / e2e-tests (usage)

Error

The command WITH DOCKER RUN --privileged gotestsum --no-color=false --format testname --junitfile e2e-tests.xml --raw-command go tool test2json -t -p E2E ./e2e -test.v ${FLAGS} did not complete successfully. Exit code 1

Check failure on line 65 in Earthfile

View workflow job for this annotation

GitHub Actions / e2e-tests (ssa-claims)

Error

The command WITH DOCKER RUN --privileged gotestsum --no-color=false --format testname --junitfile e2e-tests.xml --raw-command go tool test2json -t -p E2E ./e2e -test.v ${FLAGS} did not complete successfully. Exit code 1

Check failure on line 65 in Earthfile

View workflow job for this annotation

GitHub Actions / e2e-tests (realtime-compositions)

Error

The command WITH DOCKER RUN --privileged gotestsum --no-color=false --format testname --junitfile e2e-tests.xml --raw-command go tool test2json -t -p E2E ./e2e -test.v ${FLAGS} did not complete successfully. Exit code 1
END
FINALLY
SAVE ARTIFACT --if-exists e2e-tests.xml AS LOCAL _output/tests/e2e-tests.xml
Expand Down
89 changes: 89 additions & 0 deletions apis/pkg/v1beta1/image_config_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
Copyright 2024 The Crossplane 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 (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// MatchType is the method used to match the image.
type MatchType string

const (
// Prefix is used to match the prefix of the image.
Prefix MatchType = "Prefix"
)

// +kubebuilder:object:root=true
// +genclient
// +genclient:nonNamespaced

// The ImageConfig resource is used to configure settings for package images.
//
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:resource:scope=Cluster,categories={crossplane}
type ImageConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ImageConfigSpec `json:"spec,omitempty"`
}

// +kubebuilder:object:root=true

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

// ImageMatch defines a rule for matching image.
type ImageMatch struct {
// Type is the type of match.
// +optional
// +kubebuilder:validation:Enum=Prefix
// +kubebuilder:default=Prefix
Type MatchType `json:"type,omitempty"`
// Prefix is the prefix that should be matched.
Prefix string `json:"prefix"`
}

// RegistryAuthentication contains the authentication information for a registry.
type RegistryAuthentication struct {
// PullSecretRef is a reference to a secret that contains the credentials for
// the registry.
PullSecretRef corev1.LocalObjectReference `json:"pullSecretRef"`
}

// RegistryConfig contains the configuration for the registry.
type RegistryConfig struct {
// Authentication is the authentication information for the registry.
// +optional
Authentication *RegistryAuthentication `json:"authentication,omitempty"`
}

// ImageConfigSpec contains the configuration for matching images.
type ImageConfigSpec struct {
// MatchImages is a list of image matching rules that should be satisfied.
// +kubebuilder:validation:XValidation:rule="size(self) > 0",message="matchImages should have at least one element."
MatchImages []ImageMatch `json:"matchImages"`
// Registry is the configuration for the registry.
// +optional
Registry *RegistryConfig `json:"registry,omitempty"`
}
9 changes: 9 additions & 0 deletions apis/pkg/v1beta1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,18 @@ var (
DeploymentRuntimeConfigGroupVersionKind = SchemeGroupVersion.WithKind(DeploymentRuntimeConfigKind)
)

// ImageConfig type metadata.
var (
ImageConfigKind = reflect.TypeOf(ImageConfig{}).Name()
ImageConfigGroupKind = schema.GroupKind{Group: Group, Kind: ImageConfigKind}.String()
ImageConfigKindAPIVersion = ImageConfigKind + "." + SchemeGroupVersion.String()
ImageConfigGroupVersionKind = SchemeGroupVersion.WithKind(ImageConfigKind)
)

func init() {
SchemeBuilder.Register(&Lock{}, &LockList{})
SchemeBuilder.Register(&Function{}, &FunctionList{})
SchemeBuilder.Register(&FunctionRevision{}, &FunctionRevisionList{})
SchemeBuilder.Register(&DeploymentRuntimeConfig{}, &DeploymentRuntimeConfigList{})
SchemeBuilder.Register(&ImageConfig{}, &ImageConfigList{})
}
134 changes: 134 additions & 0 deletions apis/pkg/v1beta1/zz_generated.deepcopy.go

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

101 changes: 101 additions & 0 deletions cluster/crds/pkg.crossplane.io_imageconfigs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.14.0
name: imageconfigs.pkg.crossplane.io
spec:
group: pkg.crossplane.io
names:
categories:
- crossplane
kind: ImageConfig
listKind: ImageConfigList
plural: imageconfigs
singular: imageconfig
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .metadata.creationTimestamp
name: AGE
type: date
name: v1beta1
schema:
openAPIV3Schema:
description: The ImageConfig resource is used to configure settings for package
images.
properties:
apiVersion:
description: |-
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
type: string
kind:
description: |-
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
type: string
metadata:
type: object
spec:
description: ImageConfigSpec contains the configuration for matching images.
properties:
matchImages:
description: MatchImages is a list of image matching rules that should
be satisfied.
items:
description: ImageMatch defines a rule for matching image.
properties:
prefix:
description: Prefix is the prefix that should be matched.
type: string
type:
default: Prefix
description: Type is the type of match.
enum:
- Prefix
type: string
required:
- prefix
type: object
type: array
x-kubernetes-validations:
- message: matchImages should have at least one element.
rule: size(self) > 0
registry:
description: Registry is the configuration for the registry.
properties:
authentication:
description: Authentication is the authentication information
for the registry.
properties:
pullSecretRef:
description: |-
PullSecretRef is a reference to a secret that contains the credentials for
the registry.
properties:
name:
description: |-
Name of the referent.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?
type: string
type: object
x-kubernetes-map-type: atomic
required:
- pullSecretRef
type: object
type: object
required:
- matchImages
type: object
type: object
served: true
storage: true
subresources: {}
2 changes: 1 addition & 1 deletion cmd/crank/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func NewRuntimeFunctionRunner(ctx context.Context, log logging.Logger, fns []pkg
conns[fn.GetName()] = conn
}

return &RuntimeFunctionRunner{conns: conns}, nil
return &RuntimeFunctionRunner{contexts: contexts, conns: conns}, nil
}

// RunFunction runs the named function.
Expand Down
Loading
Loading