Skip to content

Commit 2ecd033

Browse files
committed
Update api, Dockerfile and Makefile to build power-kubeletplugin and container image
Signed-off-by: Jason Cho <[email protected]>
1 parent 925234a commit 2ecd033

File tree

7 files changed

+98
-18
lines changed

7 files changed

+98
-18
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# But not these files...
22
!/.gitignore
33

4+
#binaries
45
bin
6+
power-dra-kubeletplugin
57

68
!*.go
79
!go.sum

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ LABEL release="N/A"
2929
LABEL summary="Automate the management and monitoring of addition of specific Power devices to a Pod."
3030
LABEL description="Automate the management and monitoring of addition of specific Power devices to a Pod."
3131

32-
COPY test-kubeletplugin /usr/bin/power-dra-kubeletplugin
32+
COPY power-dra-kubeletplugin /usr/bin/power-dra-kubeletplugin

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# This project applies to ppc64le only
22
ARCH ?= ppc64le
33

4-
REGISTRY ?= quay.io/jcho0
4+
REGISTRY ?= quay.io/powercloud
55
REPOSITORY ?= power-dra-driver
66
TAG ?= v0.1.0
77

88
CONTAINER_RUNTIME ?= $(shell command -v podman 2> /dev/null || echo docker)
99

10+
include $(CURDIR)/versions.mk
11+
1012
########################################################################
1113
# Go Targets
1214

@@ -45,6 +47,12 @@ CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))
4547

4648
GOOS ?= linux
4749
GOARCH ?= ppc64le
50+
ifeq ($(VERSION),)
51+
CLI_VERSION = $(LIB_VERSION)$(if $(LIB_TAG),-$(LIB_TAG))
52+
else
53+
CLI_VERSION = $(VERSION)
54+
endif
55+
CLI_VERSION_PACKAGE = $(MODULE)/internal/info
4856

4957
CMDS := $(patsubst ./cmd/%/,%,$(sort $(dir $(wildcard ./cmd/*/))))
5058
CMD_TARGETS := $(patsubst %,cmd-%, $(CMDS))
@@ -57,7 +65,7 @@ cmds: $(CMD_TARGETS)
5765
$(CMD_TARGETS): cmd-%:
5866
CGO_LDFLAGS_ALLOW='-Wl,--unresolved-symbols=ignore-in-object-files' \
5967
CC=$(CC) CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) \
60-
go build -ldflags "-s -w -X $(CLI_VERSION_PACKAGE).gitCommit=$(GIT_COMMIT) -X $(CLI_VERSION_PACKAGE).version=$(CLI_VERSION)" $(COMMAND_BUILD_OPTIONS) cmd/$(*)
68+
go build -ldflags "-s -w -X $(CLI_VERSION_PACKAGE).gitCommit=$(GIT_COMMIT) -X $(CLI_VERSION_PACKAGE).version=$(VERSION)" $(COMMAND_BUILD_OPTIONS) $(MODULE)/cmd/$(*)
6169

6270
########################################################################
6371
# Container Targets

api/powervs-openshift-ipi.cis.ibm.net/resource/gpu/v1alpha1/gpuconfig.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"fmt"
2121

2222
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
23-
"k8s.io/utils/ptr"
2423
)
2524

2625
// +genclient
@@ -42,7 +41,7 @@ func DefaultGpuConfig() *GpuConfig {
4241
Sharing: &GpuSharing{
4342
Strategy: TimeSlicingStrategy,
4443
TimeSlicingConfig: &TimeSlicingConfig{
45-
Interval: ptr.To(DefaultTimeSlice),
44+
Interval: "Default",
4645
},
4746
},
4847
}
@@ -70,11 +69,3 @@ func (c *GpuConfig) Normalize() error {
7069
}
7170
return nil
7271
}
73-
74-
// Validate ensures that GpuConfig has a valid set of values.
75-
func (c *GpuConfig) Validate() error {
76-
if c.Sharing == nil {
77-
return fmt.Errorf("no sharing strategy set")
78-
}
79-
return c.Sharing.Validate()
80-
}

api/powervs-openshift-ipi.cis.ibm.net/resource/gpu/v1alpha1/validate.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (d TimeSliceInterval) Validate() error {
4040

4141
// Validate ensures that TimeSlicingConfig has a valid set of values.
4242
func (c *TimeSlicingConfig) Validate() error {
43-
return c.Interval.Validate()
43+
return c.Interval.Validate()
4444
}
4545

4646
// Validate ensures that SpacePartitioningConfig has a valid set of values.
@@ -67,8 +67,8 @@ func (s *GpuSharing) Validate() error {
6767

6868
// Validate ensures that GpuConfig has a valid set of values.
6969
func (c *GpuConfig) Validate() error {
70-
if c.Sharing == nil {
71-
return fmt.Errorf("no sharing strategy set")
72-
}
73-
return c.Sharing.Validate()
70+
if c.Sharing == nil {
71+
return fmt.Errorf("no sharing strategy set")
72+
}
73+
return c.Sharing.Validate()
7474
}

api/powervs-openshift-ipi.cis.ibm.net/resource/gpu/v1alpha1/zz_generated.deepcopy.go

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

versions.mk

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2025.
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+
GOLANG_VERSION ?= 1.23.1
16+
17+
DRIVER_NAME := power-dra-driver
18+
MODULE := github.com/IBM/$(DRIVER_NAME)
19+
20+
REGISTRY ?= quay.io/powercloud/power-dra-driver
21+
22+
VERSION ?= v0.1.0
23+
24+
GIT_COMMIT ?= $(shell git describe --match="" --dirty --long --always --abbrev=40 2> /dev/null || echo "")

0 commit comments

Comments
 (0)